diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/CHANGELOG.md b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/CHANGELOG.md index 8562d5cbc3b7..a3c0d526dbce 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/CHANGELOG.md +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 2.0.0 (2024-10-30) + +### Breaking Changes + + - This package now only targets the latest Api-Version available on Azure and removes APIs of other Api-Version. After this change, the package can have much smaller size. If your application requires a specific and non-latest Api-Version, it's recommended to pin this package to the previous released version; If your application always only use latest Api-Version, please ingore this change. + ## 1.5.0 (2024-07-22) ### Features Added diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/_meta.json b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/_meta.json index 64b1a409cac5..f95af25c6039 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/_meta.json +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/_meta.json @@ -1,18 +1,11 @@ { - "commit": "260f4f4012b3bebac33ea4db5c56105dd2fd33da", + "commit": "2776cb32cd6ca9ea953a13ae26c954b989e83367", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.10.2", "use": [ - "@autorest/python@6.15.0", + "@autorest/python@6.19.0", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/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.15.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", - "readme": "specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/readme.md", - "package-2020-04-30": "2024-05-15 18:25:55 +0200 7dae1e5f45f91ec89d16a628e102341490ced849 stable/2020-04-30/redhatopenshift.json", - "package-2021-09-01-preview": "2024-05-15 18:25:55 +0200 7dae1e5f45f91ec89d16a628e102341490ced849 preview/2021-09-01-preview/redhatopenshift.json", - "package-2022-04-01": "2024-05-15 18:25:55 +0200 7dae1e5f45f91ec89d16a628e102341490ced849 stable/2022-04-01/redhatopenshift.json", - "package-2022-09-04": "2024-05-15 18:25:55 +0200 7dae1e5f45f91ec89d16a628e102341490ced849 stable/2022-09-04/redhatopenshift.json", - "package-2023-04-01": "2024-05-15 18:25:55 +0200 7dae1e5f45f91ec89d16a628e102341490ced849 stable/2023-04-01/redhatopenshift.json", - "package-2023-09-04": "2024-05-15 18:25:55 +0200 7dae1e5f45f91ec89d16a628e102341490ced849 stable/2023-09-04/redhatopenshift.json", - "package-2023-11": "2024-05-15 18:25:55 +0200 7dae1e5f45f91ec89d16a628e102341490ced849 stable/2023-11-22/redhatopenshift.json" -} \ No newline at end of file + "autorest_command": "autorest specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --tag=package-2023-11 --use=@autorest/python@6.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "readme": "specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/readme.md" +} diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/assets.json b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/assets.json deleted file mode 100644 index cb32317f38d2..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/assets.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "AssetsRepo": "Azure/azure-sdk-assets", - "AssetsRepoPrefixPath": "python", - "TagPrefix": "python/redhatopenshift/azure-mgmt-redhatopenshift", - "Tag": "python/redhatopenshift/azure-mgmt-redhatopenshift_8a51d0a696" -} diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/__init__.py index bd784676913d..c64163c98d3d 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/__init__.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/__init__.py @@ -7,14 +7,20 @@ # -------------------------------------------------------------------------- from ._azure_red_hat_open_shift_client import AzureRedHatOpenShiftClient -__all__ = ['AzureRedHatOpenShiftClient'] +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__ = [ + "AzureRedHatOpenShiftClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) -__version__ = VERSION +_patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_azure_red_hat_open_shift_client.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_azure_red_hat_open_shift_client.py index eec84e4ca861..150eafc9e5da 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_azure_red_hat_open_shift_client.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_azure_red_hat_open_shift_client.py @@ -1,82 +1,79 @@ # coding=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 AzureRedHatOpenShiftClientConfiguration from ._serialization import Deserializer, Serializer +from .operations import ( + MachinePoolsOperations, + OpenShiftClustersOperations, + OpenShiftVersionsOperations, + Operations, + SecretsOperations, + SyncIdentityProvidersOperations, + SyncSetsOperations, +) 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 AzureRedHatOpenShiftClient(MultiApiClientMixin, _SDKClient): +class AzureRedHatOpenShiftClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Rest API for Azure Red Hat OpenShift 4. - 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.redhatopenshift.operations.Operations + :ivar open_shift_versions: OpenShiftVersionsOperations operations + :vartype open_shift_versions: azure.mgmt.redhatopenshift.operations.OpenShiftVersionsOperations + :ivar open_shift_clusters: OpenShiftClustersOperations operations + :vartype open_shift_clusters: azure.mgmt.redhatopenshift.operations.OpenShiftClustersOperations + :ivar machine_pools: MachinePoolsOperations operations + :vartype machine_pools: azure.mgmt.redhatopenshift.operations.MachinePoolsOperations + :ivar secrets: SecretsOperations operations + :vartype secrets: azure.mgmt.redhatopenshift.operations.SecretsOperations + :ivar sync_identity_providers: SyncIdentityProvidersOperations operations + :vartype sync_identity_providers: + azure.mgmt.redhatopenshift.operations.SyncIdentityProvidersOperations + :ivar sync_sets: SyncSetsOperations operations + :vartype sync_sets: azure.mgmt.redhatopenshift.operations.SyncSetsOperations :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 "2023-11-22". 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 = '2023-11-22' - _PROFILE_TAG = "azure.mgmt.redhatopenshift.AzureRedHatOpenShiftClient" - 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 = AzureRedHatOpenShiftClientConfiguration(credential, subscription_id, **kwargs) + ) -> None: + self._config = AzureRedHatOpenShiftClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -95,234 +92,54 @@ 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(AzureRedHatOpenShiftClient, 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.open_shift_versions = OpenShiftVersionsOperations( + self._client, self._config, self._serialize, self._deserialize ) + self.open_shift_clusters = OpenShiftClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.machine_pools = MachinePoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.secrets = SecretsOperations(self._client, self._config, self._serialize, self._deserialize) + self.sync_identity_providers = SyncIdentityProvidersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.sync_sets = SyncSetsOperations(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: - - * 2020-04-30: :mod:`v2020_04_30.models` - * 2021-09-01-preview: :mod:`v2021_09_01_preview.models` - * 2022-04-01: :mod:`v2022_04_01.models` - * 2022-09-04: :mod:`v2022_09_04.models` - * 2023-04-01: :mod:`v2023_04_01.models` - * 2023-09-04: :mod:`v2023_09_04.models` - * 2023-11-22: :mod:`v2023_11_22.models` - """ - if api_version == '2020-04-30': - from .v2020_04_30 import models - return models - elif api_version == '2021-09-01-preview': - from .v2021_09_01_preview import models - return models - elif api_version == '2022-04-01': - from .v2022_04_01 import models - return models - elif api_version == '2022-09-04': - from .v2022_09_04 import models - return models - elif api_version == '2023-04-01': - from .v2023_04_01 import models - return models - elif api_version == '2023-09-04': - from .v2023_09_04 import models - return models - elif api_version == '2023-11-22': - from .v2023_11_22 import models - return models - raise ValueError("API version {} is not available".format(api_version)) - - @property - def machine_pools(self): - """Instance depends on the API version: - - * 2022-09-04: :class:`MachinePoolsOperations` - * 2023-04-01: :class:`MachinePoolsOperations` - * 2023-09-04: :class:`MachinePoolsOperations` - * 2023-11-22: :class:`MachinePoolsOperations` - """ - api_version = self._get_api_version('machine_pools') - if api_version == '2022-09-04': - from .v2022_09_04.operations import MachinePoolsOperations as OperationClass - elif api_version == '2023-04-01': - from .v2023_04_01.operations import MachinePoolsOperations as OperationClass - elif api_version == '2023-09-04': - from .v2023_09_04.operations import MachinePoolsOperations as OperationClass - elif api_version == '2023-11-22': - from .v2023_11_22.operations import MachinePoolsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'machine_pools'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def open_shift_clusters(self): - """Instance depends on the API version: - - * 2020-04-30: :class:`OpenShiftClustersOperations` - * 2021-09-01-preview: :class:`OpenShiftClustersOperations` - * 2022-04-01: :class:`OpenShiftClustersOperations` - * 2022-09-04: :class:`OpenShiftClustersOperations` - * 2023-04-01: :class:`OpenShiftClustersOperations` - * 2023-09-04: :class:`OpenShiftClustersOperations` - * 2023-11-22: :class:`OpenShiftClustersOperations` - """ - api_version = self._get_api_version('open_shift_clusters') - if api_version == '2020-04-30': - from .v2020_04_30.operations import OpenShiftClustersOperations as OperationClass - elif api_version == '2021-09-01-preview': - from .v2021_09_01_preview.operations import OpenShiftClustersOperations as OperationClass - elif api_version == '2022-04-01': - from .v2022_04_01.operations import OpenShiftClustersOperations as OperationClass - elif api_version == '2022-09-04': - from .v2022_09_04.operations import OpenShiftClustersOperations as OperationClass - elif api_version == '2023-04-01': - from .v2023_04_01.operations import OpenShiftClustersOperations as OperationClass - elif api_version == '2023-09-04': - from .v2023_09_04.operations import OpenShiftClustersOperations as OperationClass - elif api_version == '2023-11-22': - from .v2023_11_22.operations import OpenShiftClustersOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'open_shift_clusters'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def open_shift_versions(self): - """Instance depends on the API version: - - * 2022-09-04: :class:`OpenShiftVersionsOperations` - * 2023-04-01: :class:`OpenShiftVersionsOperations` - * 2023-09-04: :class:`OpenShiftVersionsOperations` - * 2023-11-22: :class:`OpenShiftVersionsOperations` - """ - api_version = self._get_api_version('open_shift_versions') - if api_version == '2022-09-04': - from .v2022_09_04.operations import OpenShiftVersionsOperations as OperationClass - elif api_version == '2023-04-01': - from .v2023_04_01.operations import OpenShiftVersionsOperations as OperationClass - elif api_version == '2023-09-04': - from .v2023_09_04.operations import OpenShiftVersionsOperations as OperationClass - elif api_version == '2023-11-22': - from .v2023_11_22.operations import OpenShiftVersionsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'open_shift_versions'".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: - - * 2020-04-30: :class:`Operations` - * 2021-09-01-preview: :class:`Operations` - * 2022-04-01: :class:`Operations` - * 2022-09-04: :class:`Operations` - * 2023-04-01: :class:`Operations` - * 2023-09-04: :class:`Operations` - * 2023-11-22: :class:`Operations` - """ - api_version = self._get_api_version('operations') - if api_version == '2020-04-30': - from .v2020_04_30.operations import Operations as OperationClass - elif api_version == '2021-09-01-preview': - from .v2021_09_01_preview.operations import Operations as OperationClass - elif api_version == '2022-04-01': - from .v2022_04_01.operations import Operations as OperationClass - elif api_version == '2022-09-04': - from .v2022_09_04.operations import Operations as OperationClass - elif api_version == '2023-04-01': - from .v2023_04_01.operations import Operations as OperationClass - elif api_version == '2023-09-04': - from .v2023_09_04.operations import Operations as OperationClass - elif api_version == '2023-11-22': - from .v2023_11_22.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) - - @property - def secrets(self): - """Instance depends on the API version: + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. - * 2022-09-04: :class:`SecretsOperations` - * 2023-04-01: :class:`SecretsOperations` - * 2023-09-04: :class:`SecretsOperations` - * 2023-11-22: :class:`SecretsOperations` - """ - api_version = self._get_api_version('secrets') - if api_version == '2022-09-04': - from .v2022_09_04.operations import SecretsOperations as OperationClass - elif api_version == '2023-04-01': - from .v2023_04_01.operations import SecretsOperations as OperationClass - elif api_version == '2023-09-04': - from .v2023_09_04.operations import SecretsOperations as OperationClass - elif api_version == '2023-11-22': - from .v2023_11_22.operations import SecretsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'secrets'".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 sync_identity_providers(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-04: :class:`SyncIdentityProvidersOperations` - * 2023-04-01: :class:`SyncIdentityProvidersOperations` - * 2023-09-04: :class:`SyncIdentityProvidersOperations` - * 2023-11-22: :class:`SyncIdentityProvidersOperations` + :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('sync_identity_providers') - if api_version == '2022-09-04': - from .v2022_09_04.operations import SyncIdentityProvidersOperations as OperationClass - elif api_version == '2023-04-01': - from .v2023_04_01.operations import SyncIdentityProvidersOperations as OperationClass - elif api_version == '2023-09-04': - from .v2023_09_04.operations import SyncIdentityProvidersOperations as OperationClass - elif api_version == '2023-11-22': - from .v2023_11_22.operations import SyncIdentityProvidersOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'sync_identity_providers'".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 sync_sets(self): - """Instance depends on the API version: - * 2022-09-04: :class:`SyncSetsOperations` - * 2023-04-01: :class:`SyncSetsOperations` - * 2023-09-04: :class:`SyncSetsOperations` - * 2023-11-22: :class:`SyncSetsOperations` - """ - api_version = self._get_api_version('sync_sets') - if api_version == '2022-09-04': - from .v2022_09_04.operations import SyncSetsOperations as OperationClass - elif api_version == '2023-04-01': - from .v2023_04_01.operations import SyncSetsOperations as OperationClass - elif api_version == '2023-09-04': - from .v2023_09_04.operations import SyncSetsOperations as OperationClass - elif api_version == '2023-11-22': - from .v2023_11_22.operations import SyncSetsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'sync_sets'".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 - 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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_configuration.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_configuration.py index 93335816f882..db318d6f55d8 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_configuration.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_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 AzureRedHatOpenShiftClientConfiguration: + +class AzureRedHatOpenShiftClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for AzureRedHatOpenShiftClient. Note that all parameters used to create this instance are saved as instance @@ -29,14 +28,14 @@ class AzureRedHatOpenShiftClientConfiguration: :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-11-22". 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", "2023-11-22") + 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-redhatopenshift/{}'.format(VERSION)) + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-redhatopenshift/{}".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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/aio/operations/_patch.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_patch.py similarity index 100% rename from sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/aio/operations/_patch.py rename to sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_patch.py diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_serialization.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_serialization.py index 59f1fcf71bc9..8139854b97bb 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_serialization.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_version.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_version.py index b3f536e7f03a..48944bf3938a 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_version.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_version.py @@ -6,5 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.5.0" - +VERSION = "2.0.0" diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/__init__.py index f1c73a4bb9e1..b06f0016da77 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/__init__.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/__init__.py @@ -7,4 +7,17 @@ # -------------------------------------------------------------------------- from ._azure_red_hat_open_shift_client import AzureRedHatOpenShiftClient -__all__ = ['AzureRedHatOpenShiftClient'] + +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__ = [ + "AzureRedHatOpenShiftClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/_azure_red_hat_open_shift_client.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/_azure_red_hat_open_shift_client.py index 8b6e09316810..4862d11c40cd 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/_azure_red_hat_open_shift_client.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/_azure_red_hat_open_shift_client.py @@ -1,82 +1,81 @@ # coding=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 AzureRedHatOpenShiftClientConfiguration +from .operations import ( + MachinePoolsOperations, + OpenShiftClustersOperations, + OpenShiftVersionsOperations, + Operations, + SecretsOperations, + SyncIdentityProvidersOperations, + SyncSetsOperations, +) 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 AzureRedHatOpenShiftClient(MultiApiClientMixin, _SDKClient): +class AzureRedHatOpenShiftClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Rest API for Azure Red Hat OpenShift 4. - 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.redhatopenshift.aio.operations.Operations + :ivar open_shift_versions: OpenShiftVersionsOperations operations + :vartype open_shift_versions: + azure.mgmt.redhatopenshift.aio.operations.OpenShiftVersionsOperations + :ivar open_shift_clusters: OpenShiftClustersOperations operations + :vartype open_shift_clusters: + azure.mgmt.redhatopenshift.aio.operations.OpenShiftClustersOperations + :ivar machine_pools: MachinePoolsOperations operations + :vartype machine_pools: azure.mgmt.redhatopenshift.aio.operations.MachinePoolsOperations + :ivar secrets: SecretsOperations operations + :vartype secrets: azure.mgmt.redhatopenshift.aio.operations.SecretsOperations + :ivar sync_identity_providers: SyncIdentityProvidersOperations operations + :vartype sync_identity_providers: + azure.mgmt.redhatopenshift.aio.operations.SyncIdentityProvidersOperations + :ivar sync_sets: SyncSetsOperations operations + :vartype sync_sets: azure.mgmt.redhatopenshift.aio.operations.SyncSetsOperations :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 "2023-11-22". 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 = '2023-11-22' - _PROFILE_TAG = "azure.mgmt.redhatopenshift.AzureRedHatOpenShiftClient" - 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 = AzureRedHatOpenShiftClientConfiguration(credential, subscription_id, **kwargs) + self._config = AzureRedHatOpenShiftClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -95,234 +94,56 @@ 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(AzureRedHatOpenShiftClient, 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.open_shift_versions = OpenShiftVersionsOperations( + 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: - - * 2020-04-30: :mod:`v2020_04_30.models` - * 2021-09-01-preview: :mod:`v2021_09_01_preview.models` - * 2022-04-01: :mod:`v2022_04_01.models` - * 2022-09-04: :mod:`v2022_09_04.models` - * 2023-04-01: :mod:`v2023_04_01.models` - * 2023-09-04: :mod:`v2023_09_04.models` - * 2023-11-22: :mod:`v2023_11_22.models` - """ - if api_version == '2020-04-30': - from ..v2020_04_30 import models - return models - elif api_version == '2021-09-01-preview': - from ..v2021_09_01_preview import models - return models - elif api_version == '2022-04-01': - from ..v2022_04_01 import models - return models - elif api_version == '2022-09-04': - from ..v2022_09_04 import models - return models - elif api_version == '2023-04-01': - from ..v2023_04_01 import models - return models - elif api_version == '2023-09-04': - from ..v2023_09_04 import models - return models - elif api_version == '2023-11-22': - from ..v2023_11_22 import models - return models - raise ValueError("API version {} is not available".format(api_version)) - - @property - def machine_pools(self): - """Instance depends on the API version: - - * 2022-09-04: :class:`MachinePoolsOperations` - * 2023-04-01: :class:`MachinePoolsOperations` - * 2023-09-04: :class:`MachinePoolsOperations` - * 2023-11-22: :class:`MachinePoolsOperations` - """ - api_version = self._get_api_version('machine_pools') - if api_version == '2022-09-04': - from ..v2022_09_04.aio.operations import MachinePoolsOperations as OperationClass - elif api_version == '2023-04-01': - from ..v2023_04_01.aio.operations import MachinePoolsOperations as OperationClass - elif api_version == '2023-09-04': - from ..v2023_09_04.aio.operations import MachinePoolsOperations as OperationClass - elif api_version == '2023-11-22': - from ..v2023_11_22.aio.operations import MachinePoolsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'machine_pools'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def open_shift_clusters(self): - """Instance depends on the API version: - - * 2020-04-30: :class:`OpenShiftClustersOperations` - * 2021-09-01-preview: :class:`OpenShiftClustersOperations` - * 2022-04-01: :class:`OpenShiftClustersOperations` - * 2022-09-04: :class:`OpenShiftClustersOperations` - * 2023-04-01: :class:`OpenShiftClustersOperations` - * 2023-09-04: :class:`OpenShiftClustersOperations` - * 2023-11-22: :class:`OpenShiftClustersOperations` - """ - api_version = self._get_api_version('open_shift_clusters') - if api_version == '2020-04-30': - from ..v2020_04_30.aio.operations import OpenShiftClustersOperations as OperationClass - elif api_version == '2021-09-01-preview': - from ..v2021_09_01_preview.aio.operations import OpenShiftClustersOperations as OperationClass - elif api_version == '2022-04-01': - from ..v2022_04_01.aio.operations import OpenShiftClustersOperations as OperationClass - elif api_version == '2022-09-04': - from ..v2022_09_04.aio.operations import OpenShiftClustersOperations as OperationClass - elif api_version == '2023-04-01': - from ..v2023_04_01.aio.operations import OpenShiftClustersOperations as OperationClass - elif api_version == '2023-09-04': - from ..v2023_09_04.aio.operations import OpenShiftClustersOperations as OperationClass - elif api_version == '2023-11-22': - from ..v2023_11_22.aio.operations import OpenShiftClustersOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'open_shift_clusters'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def open_shift_versions(self): - """Instance depends on the API version: - - * 2022-09-04: :class:`OpenShiftVersionsOperations` - * 2023-04-01: :class:`OpenShiftVersionsOperations` - * 2023-09-04: :class:`OpenShiftVersionsOperations` - * 2023-11-22: :class:`OpenShiftVersionsOperations` - """ - api_version = self._get_api_version('open_shift_versions') - if api_version == '2022-09-04': - from ..v2022_09_04.aio.operations import OpenShiftVersionsOperations as OperationClass - elif api_version == '2023-04-01': - from ..v2023_04_01.aio.operations import OpenShiftVersionsOperations as OperationClass - elif api_version == '2023-09-04': - from ..v2023_09_04.aio.operations import OpenShiftVersionsOperations as OperationClass - elif api_version == '2023-11-22': - from ..v2023_11_22.aio.operations import OpenShiftVersionsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'open_shift_versions'".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: - - * 2020-04-30: :class:`Operations` - * 2021-09-01-preview: :class:`Operations` - * 2022-04-01: :class:`Operations` - * 2022-09-04: :class:`Operations` - * 2023-04-01: :class:`Operations` - * 2023-09-04: :class:`Operations` - * 2023-11-22: :class:`Operations` - """ - api_version = self._get_api_version('operations') - if api_version == '2020-04-30': - from ..v2020_04_30.aio.operations import Operations as OperationClass - elif api_version == '2021-09-01-preview': - from ..v2021_09_01_preview.aio.operations import Operations as OperationClass - elif api_version == '2022-04-01': - from ..v2022_04_01.aio.operations import Operations as OperationClass - elif api_version == '2022-09-04': - from ..v2022_09_04.aio.operations import Operations as OperationClass - elif api_version == '2023-04-01': - from ..v2023_04_01.aio.operations import Operations as OperationClass - elif api_version == '2023-09-04': - from ..v2023_09_04.aio.operations import Operations as OperationClass - elif api_version == '2023-11-22': - from ..v2023_11_22.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) - - @property - def secrets(self): - """Instance depends on the API version: - - * 2022-09-04: :class:`SecretsOperations` - * 2023-04-01: :class:`SecretsOperations` - * 2023-09-04: :class:`SecretsOperations` - * 2023-11-22: :class:`SecretsOperations` - """ - api_version = self._get_api_version('secrets') - if api_version == '2022-09-04': - from ..v2022_09_04.aio.operations import SecretsOperations as OperationClass - elif api_version == '2023-04-01': - from ..v2023_04_01.aio.operations import SecretsOperations as OperationClass - elif api_version == '2023-09-04': - from ..v2023_09_04.aio.operations import SecretsOperations as OperationClass - elif api_version == '2023-11-22': - from ..v2023_11_22.aio.operations import SecretsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'secrets'".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 sync_identity_providers(self): - """Instance depends on the API version: - - * 2022-09-04: :class:`SyncIdentityProvidersOperations` - * 2023-04-01: :class:`SyncIdentityProvidersOperations` - * 2023-09-04: :class:`SyncIdentityProvidersOperations` - * 2023-11-22: :class:`SyncIdentityProvidersOperations` + self.open_shift_clusters = OpenShiftClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.machine_pools = MachinePoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.secrets = SecretsOperations(self._client, self._config, self._serialize, self._deserialize) + self.sync_identity_providers = SyncIdentityProvidersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.sync_sets = SyncSetsOperations(self._client, self._config, self._serialize, self._deserialize) + + 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 """ - api_version = self._get_api_version('sync_identity_providers') - if api_version == '2022-09-04': - from ..v2022_09_04.aio.operations import SyncIdentityProvidersOperations as OperationClass - elif api_version == '2023-04-01': - from ..v2023_04_01.aio.operations import SyncIdentityProvidersOperations as OperationClass - elif api_version == '2023-09-04': - from ..v2023_09_04.aio.operations import SyncIdentityProvidersOperations as OperationClass - elif api_version == '2023-11-22': - from ..v2023_11_22.aio.operations import SyncIdentityProvidersOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'sync_identity_providers'".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 sync_sets(self): - """Instance depends on the 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 - * 2022-09-04: :class:`SyncSetsOperations` - * 2023-04-01: :class:`SyncSetsOperations` - * 2023-09-04: :class:`SyncSetsOperations` - * 2023-11-22: :class:`SyncSetsOperations` - """ - api_version = self._get_api_version('sync_sets') - if api_version == '2022-09-04': - from ..v2022_09_04.aio.operations import SyncSetsOperations as OperationClass - elif api_version == '2023-04-01': - from ..v2023_04_01.aio.operations import SyncSetsOperations as OperationClass - elif api_version == '2023-09-04': - from ..v2023_09_04.aio.operations import SyncSetsOperations as OperationClass - elif api_version == '2023-11-22': - from ..v2023_11_22.aio.operations import SyncSetsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'sync_sets'".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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/_configuration.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/_configuration.py index 3b64f48e3344..f3376438bb0e 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/_configuration.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/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 AzureRedHatOpenShiftClientConfiguration: + +class AzureRedHatOpenShiftClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for AzureRedHatOpenShiftClient. Note that all parameters used to create this instance are saved as instance @@ -29,14 +28,14 @@ class AzureRedHatOpenShiftClientConfiguration: :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-11-22". 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", "2023-11-22") + 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-redhatopenshift/{}'.format(VERSION)) + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-redhatopenshift/{}".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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/models/_patch.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/_patch.py similarity index 100% rename from sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/models/_patch.py rename to sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/_patch.py diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/__init__.py similarity index 100% rename from sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/__init__.py rename to sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/__init__.py diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/aio/operations/_machine_pools_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_machine_pools_operations.py similarity index 92% rename from sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/aio/operations/_machine_pools_operations.py rename to sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_machine_pools_operations.py index fc2c819921ec..6f7a5a2d00f2 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/aio/operations/_machine_pools_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_machine_pools_operations.py @@ -50,7 +50,7 @@ class MachinePoolsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2023_09_04.aio.AzureRedHatOpenShiftClient`'s + :class:`~azure.mgmt.redhatopenshift.aio.AzureRedHatOpenShiftClient`'s :attr:`machine_pools` attribute. """ @@ -62,7 +62,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, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.MachinePool"]: @@ -76,14 +75,13 @@ def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> A :param resource_name: The name of the OpenShift cluster resource. Required. :type resource_name: str :return: An iterator like instance of either MachinePool or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2023_09_04.models.MachinePool] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.models.MachinePool] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-04")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MachinePoolList] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -116,7 +114,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 ) @@ -164,7 +162,7 @@ async def get( :param child_resource_name: The name of the MachinePool resource. Required. :type child_resource_name: str :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.MachinePool + :rtype: ~azure.mgmt.redhatopenshift.models.MachinePool :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -178,7 +176,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 "2023-09-04")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MachinePool] = kwargs.pop("cls", None) _request = build_get_request( @@ -234,12 +232,12 @@ async def create_or_update( :param child_resource_name: The name of the MachinePool resource. Required. :type child_resource_name: str :param parameters: The MachinePool resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.MachinePool + :type parameters: ~azure.mgmt.redhatopenshift.models.MachinePool :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.MachinePool + :rtype: ~azure.mgmt.redhatopenshift.models.MachinePool :raises ~azure.core.exceptions.HttpResponseError: """ @@ -272,7 +270,7 @@ async def create_or_update( Default value is "application/json". :paramtype content_type: str :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.MachinePool + :rtype: ~azure.mgmt.redhatopenshift.models.MachinePool :raises ~azure.core.exceptions.HttpResponseError: """ @@ -299,9 +297,9 @@ async def create_or_update( :type child_resource_name: str :param parameters: The MachinePool resource. Is either a MachinePool type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.MachinePool or IO[bytes] + :type parameters: ~azure.mgmt.redhatopenshift.models.MachinePool or IO[bytes] :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.MachinePool + :rtype: ~azure.mgmt.redhatopenshift.models.MachinePool :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -315,7 +313,7 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-04")) + 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.MachinePool] = kwargs.pop("cls", None) @@ -352,11 +350,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("MachinePool", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("MachinePool", pipeline_response.http_response) + deserialized = self._deserialize("MachinePool", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -393,7 +387,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-04")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -444,12 +438,12 @@ async def update( :param child_resource_name: The name of the MachinePool resource. Required. :type child_resource_name: str :param parameters: The MachinePool resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.MachinePoolUpdate + :type parameters: ~azure.mgmt.redhatopenshift.models.MachinePoolUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.MachinePool + :rtype: ~azure.mgmt.redhatopenshift.models.MachinePool :raises ~azure.core.exceptions.HttpResponseError: """ @@ -481,7 +475,7 @@ async def update( Default value is "application/json". :paramtype content_type: str :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.MachinePool + :rtype: ~azure.mgmt.redhatopenshift.models.MachinePool :raises ~azure.core.exceptions.HttpResponseError: """ @@ -507,9 +501,9 @@ async def update( :type child_resource_name: str :param parameters: The MachinePool resource. Is either a MachinePoolUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.MachinePoolUpdate or IO[bytes] + :type parameters: ~azure.mgmt.redhatopenshift.models.MachinePoolUpdate or IO[bytes] :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.MachinePool + :rtype: ~azure.mgmt.redhatopenshift.models.MachinePool :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -523,7 +517,7 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-04")) + 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.MachinePool] = kwargs.pop("cls", None) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/aio/operations/_open_shift_clusters_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_open_shift_clusters_operations.py similarity index 91% rename from sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/aio/operations/_open_shift_clusters_operations.py rename to sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_open_shift_clusters_operations.py index 60cb51f7c44e..79143236e115 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/aio/operations/_open_shift_clusters_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_open_shift_clusters_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -55,7 +57,7 @@ class OpenShiftClustersOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2023_11_22.aio.AzureRedHatOpenShiftClient`'s + :class:`~azure.mgmt.redhatopenshift.aio.AzureRedHatOpenShiftClient`'s :attr:`open_shift_clusters` attribute. """ @@ -67,7 +69,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.OpenShiftCluster"]: @@ -77,13 +78,13 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.OpenShiftCluster"]: :return: An iterator like instance of either OpenShiftCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftCluster] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.models.OpenShiftCluster] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-11-22")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OpenShiftClusterList] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -114,7 +115,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 ) @@ -159,13 +160,13 @@ def list_by_resource_group( :type resource_group_name: str :return: An iterator like instance of either OpenShiftCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftCluster] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.models.OpenShiftCluster] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-11-22")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OpenShiftClusterList] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -197,7 +198,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 ) @@ -241,7 +242,7 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) :param resource_name: The name of the OpenShift cluster resource. Required. :type resource_name: str :return: OpenShiftCluster or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftCluster + :rtype: ~azure.mgmt.redhatopenshift.models.OpenShiftCluster :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -255,7 +256,7 @@ async def get(self, resource_group_name: str, resource_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 "2023-11-22")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OpenShiftCluster] = kwargs.pop("cls", None) _request = build_get_request( @@ -304,7 +305,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 "2023-11-22")) + 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) @@ -329,6 +330,7 @@ async def _create_or_update_initial( ) _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 @@ -337,15 +339,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -373,14 +374,13 @@ async def begin_create_or_update( :param resource_name: The name of the OpenShift cluster resource. Required. :type resource_name: str :param parameters: The OpenShift cluster resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftCluster + :type parameters: ~azure.mgmt.redhatopenshift.models.OpenShiftCluster :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 OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftCluster] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.models.OpenShiftCluster] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -411,8 +411,7 @@ async def begin_create_or_update( :paramtype content_type: str :return: An instance of AsyncLROPoller that returns either OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftCluster] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.models.OpenShiftCluster] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -436,17 +435,16 @@ async def begin_create_or_update( :type resource_name: str :param parameters: The OpenShift cluster resource. Is either a OpenShiftCluster type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftCluster or IO[bytes] + :type parameters: ~azure.mgmt.redhatopenshift.models.OpenShiftCluster or IO[bytes] :return: An instance of AsyncLROPoller that returns either OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftCluster] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.models.OpenShiftCluster] :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-11-22")) + 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.OpenShiftCluster] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -504,7 +502,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 "2023-11-22")) + 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( @@ -517,6 +515,7 @@ async def _delete_initial( ) _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 @@ -525,15 +524,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -558,7 +556,7 @@ async def begin_delete(self, resource_group_name: str, resource_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-11-22")) + 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 +611,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 "2023-11-22")) + 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) @@ -638,6 +636,7 @@ async def _update_initial( ) _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 @@ -646,15 +645,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -681,14 +679,13 @@ async def begin_update( :param resource_name: The name of the OpenShift cluster resource. Required. :type resource_name: str :param parameters: The OpenShift cluster resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftClusterUpdate + :type parameters: ~azure.mgmt.redhatopenshift.models.OpenShiftClusterUpdate :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 OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftCluster] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.models.OpenShiftCluster] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -718,8 +715,7 @@ async def begin_update( :paramtype content_type: str :return: An instance of AsyncLROPoller that returns either OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftCluster] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.models.OpenShiftCluster] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -742,18 +738,16 @@ async def begin_update( :type resource_name: str :param parameters: The OpenShift cluster resource. Is either a OpenShiftClusterUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftClusterUpdate or - IO[bytes] + :type parameters: ~azure.mgmt.redhatopenshift.models.OpenShiftClusterUpdate or IO[bytes] :return: An instance of AsyncLROPoller that returns either OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftCluster] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.models.OpenShiftCluster] :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-11-22")) + 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.OpenShiftCluster] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -812,7 +806,7 @@ async def list_admin_credentials( :param resource_name: The name of the OpenShift cluster resource. Required. :type resource_name: str :return: OpenShiftClusterAdminKubeconfig or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftClusterAdminKubeconfig + :rtype: ~azure.mgmt.redhatopenshift.models.OpenShiftClusterAdminKubeconfig :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -826,7 +820,7 @@ async def list_admin_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 "2023-11-22")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OpenShiftClusterAdminKubeconfig] = kwargs.pop("cls", None) _request = build_list_admin_credentials_request( @@ -872,7 +866,7 @@ async def list_credentials( :param resource_name: The name of the OpenShift cluster resource. Required. :type resource_name: str :return: OpenShiftClusterCredentials or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftClusterCredentials + :rtype: ~azure.mgmt.redhatopenshift.models.OpenShiftClusterCredentials :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -886,7 +880,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 "2023-11-22")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OpenShiftClusterCredentials] = kwargs.pop("cls", None) _request = build_list_credentials_request( diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/aio/operations/_open_shift_versions_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_open_shift_versions_operations.py similarity index 94% rename from sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/aio/operations/_open_shift_versions_operations.py rename to sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_open_shift_versions_operations.py index 622abc323fe3..14ef60644f08 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/aio/operations/_open_shift_versions_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_open_shift_versions_operations.py @@ -42,7 +42,7 @@ class OpenShiftVersionsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2022_09_04.aio.AzureRedHatOpenShiftClient`'s + :class:`~azure.mgmt.redhatopenshift.aio.AzureRedHatOpenShiftClient`'s :attr:`open_shift_versions` 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, location: str, **kwargs: Any) -> AsyncIterable["_models.OpenShiftVersion"]: @@ -66,13 +65,13 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.OpenShift :type location: str :return: An iterator like instance of either OpenShiftVersion or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftVersion] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.models.OpenShiftVersion] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OpenShiftVersionList] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -104,7 +103,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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/aio/operations/_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_operations.py similarity index 92% rename from sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/aio/operations/_operations.py rename to sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_operations.py index 59319cfa89f4..37358486a661 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/aio/operations/_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/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.redhatopenshift.v2023_09_04.aio.AzureRedHatOpenShiftClient`'s + :class:`~azure.mgmt.redhatopenshift.aio.AzureRedHatOpenShiftClient`'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"]: @@ -63,14 +62,13 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: The operation returns the RP operations. :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2023_09_04.models.Operation] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.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-09-04")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -100,7 +98,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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/operations/_patch.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_patch.py similarity index 100% rename from sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/operations/_patch.py rename to sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_patch.py diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/aio/operations/_secrets_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_secrets_operations.py similarity index 92% rename from sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/aio/operations/_secrets_operations.py rename to sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_secrets_operations.py index e4440a641a38..a89e55a7aa24 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/aio/operations/_secrets_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_secrets_operations.py @@ -50,7 +50,7 @@ class SecretsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2023_09_04.aio.AzureRedHatOpenShiftClient`'s + :class:`~azure.mgmt.redhatopenshift.aio.AzureRedHatOpenShiftClient`'s :attr:`secrets` attribute. """ @@ -62,7 +62,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, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.Secret"]: @@ -76,14 +75,13 @@ def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> A :param resource_name: The name of the OpenShift cluster resource. Required. :type resource_name: str :return: An iterator like instance of either Secret or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2023_09_04.models.Secret] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.models.Secret] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-04")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SecretList] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -116,7 +114,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 ) @@ -164,7 +162,7 @@ async def get( :param child_resource_name: The name of the Secret resource. Required. :type child_resource_name: str :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.Secret + :rtype: ~azure.mgmt.redhatopenshift.models.Secret :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -178,7 +176,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 "2023-09-04")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Secret] = kwargs.pop("cls", None) _request = build_get_request( @@ -233,12 +231,12 @@ async def create_or_update( :param child_resource_name: The name of the Secret resource. Required. :type child_resource_name: str :param parameters: The Secret resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.Secret + :type parameters: ~azure.mgmt.redhatopenshift.models.Secret :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.Secret + :rtype: ~azure.mgmt.redhatopenshift.models.Secret :raises ~azure.core.exceptions.HttpResponseError: """ @@ -270,7 +268,7 @@ async def create_or_update( Default value is "application/json". :paramtype content_type: str :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.Secret + :rtype: ~azure.mgmt.redhatopenshift.models.Secret :raises ~azure.core.exceptions.HttpResponseError: """ @@ -295,9 +293,9 @@ async def create_or_update( :param child_resource_name: The name of the Secret resource. Required. :type child_resource_name: str :param parameters: The Secret resource. Is either a Secret type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.Secret or IO[bytes] + :type parameters: ~azure.mgmt.redhatopenshift.models.Secret or IO[bytes] :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.Secret + :rtype: ~azure.mgmt.redhatopenshift.models.Secret :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -311,7 +309,7 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-04")) + 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.Secret] = kwargs.pop("cls", None) @@ -348,11 +346,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Secret", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Secret", pipeline_response.http_response) + deserialized = self._deserialize("Secret", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -389,7 +383,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-04")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -440,12 +434,12 @@ async def update( :param child_resource_name: The name of the Secret resource. Required. :type child_resource_name: str :param parameters: The Secret resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SecretUpdate + :type parameters: ~azure.mgmt.redhatopenshift.models.SecretUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.Secret + :rtype: ~azure.mgmt.redhatopenshift.models.Secret :raises ~azure.core.exceptions.HttpResponseError: """ @@ -477,7 +471,7 @@ async def update( Default value is "application/json". :paramtype content_type: str :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.Secret + :rtype: ~azure.mgmt.redhatopenshift.models.Secret :raises ~azure.core.exceptions.HttpResponseError: """ @@ -503,9 +497,9 @@ async def update( :type child_resource_name: str :param parameters: The Secret resource. Is either a SecretUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SecretUpdate or IO[bytes] + :type parameters: ~azure.mgmt.redhatopenshift.models.SecretUpdate or IO[bytes] :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.Secret + :rtype: ~azure.mgmt.redhatopenshift.models.Secret :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -519,7 +513,7 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-04")) + 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.Secret] = kwargs.pop("cls", None) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/aio/operations/_sync_identity_providers_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_sync_identity_providers_operations.py similarity index 92% rename from sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/aio/operations/_sync_identity_providers_operations.py rename to sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_sync_identity_providers_operations.py index 693c5f5e77ff..c0073ae25f44 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/aio/operations/_sync_identity_providers_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_sync_identity_providers_operations.py @@ -50,7 +50,7 @@ class SyncIdentityProvidersOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2022_09_04.aio.AzureRedHatOpenShiftClient`'s + :class:`~azure.mgmt.redhatopenshift.aio.AzureRedHatOpenShiftClient`'s :attr:`sync_identity_providers` attribute. """ @@ -62,7 +62,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( @@ -80,13 +79,13 @@ def list( :return: An iterator like instance of either SyncIdentityProvider or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.models.SyncIdentityProvider] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SyncIdentityProviderList] = 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 ) @@ -167,7 +166,7 @@ async def get( :param child_resource_name: The name of the SyncIdentityProvider resource. Required. :type child_resource_name: str :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider + :rtype: ~azure.mgmt.redhatopenshift.models.SyncIdentityProvider :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 "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SyncIdentityProvider] = kwargs.pop("cls", None) _request = build_get_request( @@ -237,12 +236,12 @@ async def create_or_update( :param child_resource_name: The name of the SyncIdentityProvider resource. Required. :type child_resource_name: str :param parameters: The SyncIdentityProvider resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider + :type parameters: ~azure.mgmt.redhatopenshift.models.SyncIdentityProvider :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider + :rtype: ~azure.mgmt.redhatopenshift.models.SyncIdentityProvider :raises ~azure.core.exceptions.HttpResponseError: """ @@ -275,7 +274,7 @@ async def create_or_update( Default value is "application/json". :paramtype content_type: str :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider + :rtype: ~azure.mgmt.redhatopenshift.models.SyncIdentityProvider :raises ~azure.core.exceptions.HttpResponseError: """ @@ -302,10 +301,9 @@ async def create_or_update( :type child_resource_name: str :param parameters: The SyncIdentityProvider resource. Is either a SyncIdentityProvider type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider or - IO[bytes] + :type parameters: ~azure.mgmt.redhatopenshift.models.SyncIdentityProvider or IO[bytes] :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider + :rtype: ~azure.mgmt.redhatopenshift.models.SyncIdentityProvider :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -319,7 +317,7 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-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.SyncIdentityProvider] = kwargs.pop("cls", None) @@ -356,11 +354,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SyncIdentityProvider", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SyncIdentityProvider", pipeline_response.http_response) + deserialized = self._deserialize("SyncIdentityProvider", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -398,7 +392,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -450,12 +444,12 @@ async def update( :param child_resource_name: The name of the SyncIdentityProvider resource. Required. :type child_resource_name: str :param parameters: The SyncIdentityProvider resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProviderUpdate + :type parameters: ~azure.mgmt.redhatopenshift.models.SyncIdentityProviderUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider + :rtype: ~azure.mgmt.redhatopenshift.models.SyncIdentityProvider :raises ~azure.core.exceptions.HttpResponseError: """ @@ -488,7 +482,7 @@ async def update( Default value is "application/json". :paramtype content_type: str :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider + :rtype: ~azure.mgmt.redhatopenshift.models.SyncIdentityProvider :raises ~azure.core.exceptions.HttpResponseError: """ @@ -515,10 +509,9 @@ async def update( :type child_resource_name: str :param parameters: The SyncIdentityProvider resource. Is either a SyncIdentityProviderUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProviderUpdate or - IO[bytes] + :type parameters: ~azure.mgmt.redhatopenshift.models.SyncIdentityProviderUpdate or IO[bytes] :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider + :rtype: ~azure.mgmt.redhatopenshift.models.SyncIdentityProvider :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -532,7 +525,7 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-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.SyncIdentityProvider] = kwargs.pop("cls", None) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_sync_sets_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_sync_sets_operations.py similarity index 92% rename from sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_sync_sets_operations.py rename to sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_sync_sets_operations.py index 405fd2e8dce1..4341fbe9b590 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_sync_sets_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_sync_sets_operations.py @@ -50,7 +50,7 @@ class SyncSetsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2022_09_04.aio.AzureRedHatOpenShiftClient`'s + :class:`~azure.mgmt.redhatopenshift.aio.AzureRedHatOpenShiftClient`'s :attr:`sync_sets` attribute. """ @@ -62,7 +62,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, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.SyncSet"]: @@ -76,14 +75,13 @@ def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> A :param resource_name: The name of the OpenShift cluster resource. Required. :type resource_name: str :return: An iterator like instance of either SyncSet or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.models.SyncSet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) 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-04")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SyncSetList] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -116,7 +114,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 ) @@ -164,7 +162,7 @@ async def get( :param child_resource_name: The name of the SyncSet resource. Required. :type child_resource_name: str :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet + :rtype: ~azure.mgmt.redhatopenshift.models.SyncSet :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -178,7 +176,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 "2022-09-04")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SyncSet] = kwargs.pop("cls", None) _request = build_get_request( @@ -233,12 +231,12 @@ async def create_or_update( :param child_resource_name: The name of the SyncSet resource. Required. :type child_resource_name: str :param parameters: The SyncSet resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet + :type parameters: ~azure.mgmt.redhatopenshift.models.SyncSet :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet + :rtype: ~azure.mgmt.redhatopenshift.models.SyncSet :raises ~azure.core.exceptions.HttpResponseError: """ @@ -270,7 +268,7 @@ async def create_or_update( Default value is "application/json". :paramtype content_type: str :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet + :rtype: ~azure.mgmt.redhatopenshift.models.SyncSet :raises ~azure.core.exceptions.HttpResponseError: """ @@ -296,9 +294,9 @@ async def create_or_update( :type child_resource_name: str :param parameters: The SyncSet resource. Is either a SyncSet type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet or IO[bytes] + :type parameters: ~azure.mgmt.redhatopenshift.models.SyncSet or IO[bytes] :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet + :rtype: ~azure.mgmt.redhatopenshift.models.SyncSet :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -312,7 +310,7 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) 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-04")) + 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.SyncSet] = kwargs.pop("cls", None) @@ -349,11 +347,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SyncSet", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SyncSet", pipeline_response.http_response) + deserialized = self._deserialize("SyncSet", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -390,7 +384,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) 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-04")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -441,12 +435,12 @@ async def update( :param child_resource_name: The name of the SyncSet resource. Required. :type child_resource_name: str :param parameters: The SyncSet resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSetUpdate + :type parameters: ~azure.mgmt.redhatopenshift.models.SyncSetUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet + :rtype: ~azure.mgmt.redhatopenshift.models.SyncSet :raises ~azure.core.exceptions.HttpResponseError: """ @@ -478,7 +472,7 @@ async def update( Default value is "application/json". :paramtype content_type: str :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet + :rtype: ~azure.mgmt.redhatopenshift.models.SyncSet :raises ~azure.core.exceptions.HttpResponseError: """ @@ -504,9 +498,9 @@ async def update( :type child_resource_name: str :param parameters: The SyncSet resource. Is either a SyncSetUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSetUpdate or IO[bytes] + :type parameters: ~azure.mgmt.redhatopenshift.models.SyncSetUpdate or IO[bytes] :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet + :rtype: ~azure.mgmt.redhatopenshift.models.SyncSet :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -520,7 +514,7 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) 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-04")) + 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.SyncSet] = kwargs.pop("cls", None) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/models.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/models.py deleted file mode 100644 index 85826bf559d4..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/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 .v2023_11_22.models import * diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/models/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/models/__init__.py similarity index 100% rename from sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/models/__init__.py rename to sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/models/__init__.py diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/models/_azure_red_hat_open_shift_client_enums.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/models/_azure_red_hat_open_shift_client_enums.py similarity index 100% rename from sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/models/_azure_red_hat_open_shift_client_enums.py rename to sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/models/_azure_red_hat_open_shift_client_enums.py diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/models/_models_py3.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/models/_models_py3.py similarity index 88% rename from sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/models/_models_py3.py rename to sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/models/_models_py3.py index cc8c2edaaaee..5e301305ffac 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/models/_models_py3.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/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 @@ -23,7 +23,7 @@ class APIServerProfile(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar visibility: API server visibility. Known values are: "Private" and "Public". - :vartype visibility: str or ~azure.mgmt.redhatopenshift.v2023_11_22.models.Visibility + :vartype visibility: str or ~azure.mgmt.redhatopenshift.models.Visibility :ivar url: The URL to access the cluster API server. :vartype url: str :ivar ip: The IP of the cluster API server. @@ -44,7 +44,7 @@ class APIServerProfile(_serialization.Model): def __init__(self, *, visibility: Optional[Union[str, "_models.Visibility"]] = None, **kwargs: Any) -> None: """ :keyword visibility: API server visibility. Known values are: "Private" and "Public". - :paramtype visibility: str or ~azure.mgmt.redhatopenshift.v2023_11_22.models.Visibility + :paramtype visibility: str or ~azure.mgmt.redhatopenshift.models.Visibility """ super().__init__(**kwargs) self.visibility = visibility @@ -65,7 +65,7 @@ class CloudErrorBody(_serialization.Model): error. :vartype target: str :ivar details: A list of additional details about the error. - :vartype details: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.CloudErrorBody] + :vartype details: list[~azure.mgmt.redhatopenshift.models.CloudErrorBody] """ _attribute_map = { @@ -95,7 +95,7 @@ def __init__( error. :paramtype target: str :keyword details: A list of additional details about the error. - :paramtype details: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.CloudErrorBody] + :paramtype details: list[~azure.mgmt.redhatopenshift.models.CloudErrorBody] """ super().__init__(**kwargs) self.code = code @@ -117,8 +117,7 @@ class ClusterProfile(_serialization.Model): :vartype resource_group_id: str :ivar fips_validated_modules: If FIPS validated crypto modules are used. Known values are: "Disabled" and "Enabled". - :vartype fips_validated_modules: str or - ~azure.mgmt.redhatopenshift.v2023_11_22.models.FipsValidatedModules + :vartype fips_validated_modules: str or ~azure.mgmt.redhatopenshift.models.FipsValidatedModules """ _attribute_map = { @@ -151,7 +150,7 @@ def __init__( :keyword fips_validated_modules: If FIPS validated crypto modules are used. Known values are: "Disabled" and "Enabled". :paramtype fips_validated_modules: str or - ~azure.mgmt.redhatopenshift.v2023_11_22.models.FipsValidatedModules + ~azure.mgmt.redhatopenshift.models.FipsValidatedModules """ super().__init__(**kwargs) self.pull_secret = pull_secret @@ -259,7 +258,7 @@ class IngressProfile(_serialization.Model): :ivar name: The ingress profile name. :vartype name: str :ivar visibility: Ingress visibility. Known values are: "Private" and "Public". - :vartype visibility: str or ~azure.mgmt.redhatopenshift.v2023_11_22.models.Visibility + :vartype visibility: str or ~azure.mgmt.redhatopenshift.models.Visibility :ivar ip: The IP of the ingress. :vartype ip: str """ @@ -285,7 +284,7 @@ def __init__( :keyword name: The ingress profile name. :paramtype name: str :keyword visibility: Ingress visibility. Known values are: "Private" and "Public". - :paramtype visibility: str or ~azure.mgmt.redhatopenshift.v2023_11_22.models.Visibility + :paramtype visibility: str or ~azure.mgmt.redhatopenshift.models.Visibility """ super().__init__(**kwargs) self.name = name @@ -300,12 +299,10 @@ class LoadBalancerProfile(_serialization.Model): :ivar managed_outbound_ips: The desired managed outbound IPs for the cluster public load balancer. - :vartype managed_outbound_ips: - ~azure.mgmt.redhatopenshift.v2023_11_22.models.ManagedOutboundIPs + :vartype managed_outbound_ips: ~azure.mgmt.redhatopenshift.models.ManagedOutboundIPs :ivar effective_outbound_ips: The list of effective outbound IP addresses of the public load balancer. - :vartype effective_outbound_ips: - list[~azure.mgmt.redhatopenshift.v2023_11_22.models.EffectiveOutboundIP] + :vartype effective_outbound_ips: list[~azure.mgmt.redhatopenshift.models.EffectiveOutboundIP] """ _validation = { @@ -321,8 +318,7 @@ def __init__(self, *, managed_outbound_ips: Optional["_models.ManagedOutboundIPs """ :keyword managed_outbound_ips: The desired managed outbound IPs for the cluster public load balancer. - :paramtype managed_outbound_ips: - ~azure.mgmt.redhatopenshift.v2023_11_22.models.ManagedOutboundIPs + :paramtype managed_outbound_ips: ~azure.mgmt.redhatopenshift.models.ManagedOutboundIPs """ super().__init__(**kwargs) self.managed_outbound_ips = managed_outbound_ips @@ -344,7 +340,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.redhatopenshift.v2023_11_22.models.SystemData + :vartype system_data: ~azure.mgmt.redhatopenshift.models.SystemData """ _validation = { @@ -386,7 +382,7 @@ class ProxyResource(Resource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :vartype system_data: ~azure.mgmt.redhatopenshift.models.SystemData """ @@ -405,7 +401,7 @@ class MachinePool(ProxyResource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :vartype system_data: ~azure.mgmt.redhatopenshift.models.SystemData :ivar resources: :vartype resources: str """ @@ -438,7 +434,7 @@ class MachinePoolList(_serialization.Model): """MachinePoolList represents a list of MachinePools. :ivar value: The list of Machine Pools. - :vartype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.MachinePool] + :vartype value: list[~azure.mgmt.redhatopenshift.models.MachinePool] :ivar next_link: The link used to get the next page of operations. :vartype next_link: str """ @@ -453,7 +449,7 @@ def __init__( ) -> None: """ :keyword value: The list of Machine Pools. - :paramtype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.MachinePool] + :paramtype value: list[~azure.mgmt.redhatopenshift.models.MachinePool] :keyword next_link: The link used to get the next page of operations. :paramtype next_link: str """ @@ -468,7 +464,7 @@ class MachinePoolUpdate(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :vartype system_data: ~azure.mgmt.redhatopenshift.models.SystemData :ivar resources: :vartype resources: str """ @@ -526,8 +522,7 @@ class MasterProfile(_serialization.Model): :vartype subnet_id: str :ivar encryption_at_host: Whether master virtual machines are encrypted at host. Known values are: "Disabled" and "Enabled". - :vartype encryption_at_host: str or - ~azure.mgmt.redhatopenshift.v2023_11_22.models.EncryptionAtHost + :vartype encryption_at_host: str or ~azure.mgmt.redhatopenshift.models.EncryptionAtHost :ivar disk_encryption_set_id: The resource ID of an associated DiskEncryptionSet, if applicable. :vartype disk_encryption_set_id: str @@ -556,8 +551,7 @@ def __init__( :paramtype subnet_id: str :keyword encryption_at_host: Whether master virtual machines are encrypted at host. Known values are: "Disabled" and "Enabled". - :paramtype encryption_at_host: str or - ~azure.mgmt.redhatopenshift.v2023_11_22.models.EncryptionAtHost + :paramtype encryption_at_host: str or ~azure.mgmt.redhatopenshift.models.EncryptionAtHost :keyword disk_encryption_set_id: The resource ID of an associated DiskEncryptionSet, if applicable. :paramtype disk_encryption_set_id: str @@ -578,14 +572,12 @@ class NetworkProfile(_serialization.Model): :vartype service_cidr: str :ivar outbound_type: The OutboundType used for egress traffic. Known values are: "Loadbalancer" and "UserDefinedRouting". - :vartype outbound_type: str or ~azure.mgmt.redhatopenshift.v2023_11_22.models.OutboundType + :vartype outbound_type: str or ~azure.mgmt.redhatopenshift.models.OutboundType :ivar load_balancer_profile: The cluster load balancer profile. - :vartype load_balancer_profile: - ~azure.mgmt.redhatopenshift.v2023_11_22.models.LoadBalancerProfile + :vartype load_balancer_profile: ~azure.mgmt.redhatopenshift.models.LoadBalancerProfile :ivar preconfigured_nsg: Specifies whether subnets are pre-attached with an NSG. Known values are: "Disabled" and "Enabled". - :vartype preconfigured_nsg: str or - ~azure.mgmt.redhatopenshift.v2023_11_22.models.PreconfiguredNSG + :vartype preconfigured_nsg: str or ~azure.mgmt.redhatopenshift.models.PreconfiguredNSG """ _attribute_map = { @@ -613,14 +605,12 @@ def __init__( :paramtype service_cidr: str :keyword outbound_type: The OutboundType used for egress traffic. Known values are: "Loadbalancer" and "UserDefinedRouting". - :paramtype outbound_type: str or ~azure.mgmt.redhatopenshift.v2023_11_22.models.OutboundType + :paramtype outbound_type: str or ~azure.mgmt.redhatopenshift.models.OutboundType :keyword load_balancer_profile: The cluster load balancer profile. - :paramtype load_balancer_profile: - ~azure.mgmt.redhatopenshift.v2023_11_22.models.LoadBalancerProfile + :paramtype load_balancer_profile: ~azure.mgmt.redhatopenshift.models.LoadBalancerProfile :keyword preconfigured_nsg: Specifies whether subnets are pre-attached with an NSG. Known values are: "Disabled" and "Enabled". - :paramtype preconfigured_nsg: str or - ~azure.mgmt.redhatopenshift.v2023_11_22.models.PreconfiguredNSG + :paramtype preconfigured_nsg: str or ~azure.mgmt.redhatopenshift.models.PreconfiguredNSG """ super().__init__(**kwargs) self.pod_cidr = pod_cidr @@ -648,7 +638,7 @@ class TrackedResource(Resource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :vartype system_data: ~azure.mgmt.redhatopenshift.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. @@ -701,35 +691,32 @@ class OpenShiftCluster(TrackedResource): # pylint: disable=too-many-instance-at :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :vartype system_data: ~azure.mgmt.redhatopenshift.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 provisioning_state: The cluster provisioning state. Known values are: "AdminUpdating", "Canceled", "Creating", "Deleting", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.redhatopenshift.v2023_11_22.models.ProvisioningState + :vartype provisioning_state: str or ~azure.mgmt.redhatopenshift.models.ProvisioningState :ivar cluster_profile: The cluster profile. - :vartype cluster_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.ClusterProfile + :vartype cluster_profile: ~azure.mgmt.redhatopenshift.models.ClusterProfile :ivar console_profile: The console profile. - :vartype console_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.ConsoleProfile + :vartype console_profile: ~azure.mgmt.redhatopenshift.models.ConsoleProfile :ivar service_principal_profile: The cluster service principal profile. - :vartype service_principal_profile: - ~azure.mgmt.redhatopenshift.v2023_11_22.models.ServicePrincipalProfile + :vartype service_principal_profile: ~azure.mgmt.redhatopenshift.models.ServicePrincipalProfile :ivar network_profile: The cluster network profile. - :vartype network_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.NetworkProfile + :vartype network_profile: ~azure.mgmt.redhatopenshift.models.NetworkProfile :ivar master_profile: The cluster master profile. - :vartype master_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MasterProfile + :vartype master_profile: ~azure.mgmt.redhatopenshift.models.MasterProfile :ivar worker_profiles: The cluster worker profiles. - :vartype worker_profiles: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.WorkerProfile] + :vartype worker_profiles: list[~azure.mgmt.redhatopenshift.models.WorkerProfile] :ivar worker_profiles_status: The cluster worker profiles status. - :vartype worker_profiles_status: - list[~azure.mgmt.redhatopenshift.v2023_11_22.models.WorkerProfile] + :vartype worker_profiles_status: list[~azure.mgmt.redhatopenshift.models.WorkerProfile] :ivar apiserver_profile: The cluster API server profile. - :vartype apiserver_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.APIServerProfile + :vartype apiserver_profile: ~azure.mgmt.redhatopenshift.models.APIServerProfile :ivar ingress_profiles: The cluster ingress profiles. - :vartype ingress_profiles: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.IngressProfile] + :vartype ingress_profiles: list[~azure.mgmt.redhatopenshift.models.IngressProfile] """ _validation = { @@ -783,26 +770,24 @@ def __init__( :paramtype location: str :keyword provisioning_state: The cluster provisioning state. Known values are: "AdminUpdating", "Canceled", "Creating", "Deleting", "Failed", "Succeeded", and "Updating". - :paramtype provisioning_state: str or - ~azure.mgmt.redhatopenshift.v2023_11_22.models.ProvisioningState + :paramtype provisioning_state: str or ~azure.mgmt.redhatopenshift.models.ProvisioningState :keyword cluster_profile: The cluster profile. - :paramtype cluster_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.ClusterProfile + :paramtype cluster_profile: ~azure.mgmt.redhatopenshift.models.ClusterProfile :keyword console_profile: The console profile. - :paramtype console_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.ConsoleProfile + :paramtype console_profile: ~azure.mgmt.redhatopenshift.models.ConsoleProfile :keyword service_principal_profile: The cluster service principal profile. :paramtype service_principal_profile: - ~azure.mgmt.redhatopenshift.v2023_11_22.models.ServicePrincipalProfile + ~azure.mgmt.redhatopenshift.models.ServicePrincipalProfile :keyword network_profile: The cluster network profile. - :paramtype network_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.NetworkProfile + :paramtype network_profile: ~azure.mgmt.redhatopenshift.models.NetworkProfile :keyword master_profile: The cluster master profile. - :paramtype master_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MasterProfile + :paramtype master_profile: ~azure.mgmt.redhatopenshift.models.MasterProfile :keyword worker_profiles: The cluster worker profiles. - :paramtype worker_profiles: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.WorkerProfile] + :paramtype worker_profiles: list[~azure.mgmt.redhatopenshift.models.WorkerProfile] :keyword apiserver_profile: The cluster API server profile. - :paramtype apiserver_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.APIServerProfile + :paramtype apiserver_profile: ~azure.mgmt.redhatopenshift.models.APIServerProfile :keyword ingress_profiles: The cluster ingress profiles. - :paramtype ingress_profiles: - list[~azure.mgmt.redhatopenshift.v2023_11_22.models.IngressProfile] + :paramtype ingress_profiles: list[~azure.mgmt.redhatopenshift.models.IngressProfile] """ super().__init__(tags=tags, location=location, **kwargs) self.provisioning_state = provisioning_state @@ -869,7 +854,7 @@ class OpenShiftClusterList(_serialization.Model): """OpenShiftClusterList represents a list of OpenShift clusters. :ivar value: The list of OpenShift clusters. - :vartype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftCluster] + :vartype value: list[~azure.mgmt.redhatopenshift.models.OpenShiftCluster] :ivar next_link: The link used to get the next page of operations. :vartype next_link: str """ @@ -888,7 +873,7 @@ def __init__( ) -> None: """ :keyword value: The list of OpenShift clusters. - :paramtype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftCluster] + :paramtype value: list[~azure.mgmt.redhatopenshift.models.OpenShiftCluster] :keyword next_link: The link used to get the next page of operations. :paramtype next_link: str """ @@ -905,31 +890,28 @@ class OpenShiftClusterUpdate(_serialization.Model): # pylint: disable=too-many- :ivar tags: The resource tags. :vartype tags: dict[str, str] :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :vartype system_data: ~azure.mgmt.redhatopenshift.models.SystemData :ivar provisioning_state: The cluster provisioning state. Known values are: "AdminUpdating", "Canceled", "Creating", "Deleting", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.redhatopenshift.v2023_11_22.models.ProvisioningState + :vartype provisioning_state: str or ~azure.mgmt.redhatopenshift.models.ProvisioningState :ivar cluster_profile: The cluster profile. - :vartype cluster_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.ClusterProfile + :vartype cluster_profile: ~azure.mgmt.redhatopenshift.models.ClusterProfile :ivar console_profile: The console profile. - :vartype console_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.ConsoleProfile + :vartype console_profile: ~azure.mgmt.redhatopenshift.models.ConsoleProfile :ivar service_principal_profile: The cluster service principal profile. - :vartype service_principal_profile: - ~azure.mgmt.redhatopenshift.v2023_11_22.models.ServicePrincipalProfile + :vartype service_principal_profile: ~azure.mgmt.redhatopenshift.models.ServicePrincipalProfile :ivar network_profile: The cluster network profile. - :vartype network_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.NetworkProfile + :vartype network_profile: ~azure.mgmt.redhatopenshift.models.NetworkProfile :ivar master_profile: The cluster master profile. - :vartype master_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MasterProfile + :vartype master_profile: ~azure.mgmt.redhatopenshift.models.MasterProfile :ivar worker_profiles: The cluster worker profiles. - :vartype worker_profiles: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.WorkerProfile] + :vartype worker_profiles: list[~azure.mgmt.redhatopenshift.models.WorkerProfile] :ivar worker_profiles_status: The cluster worker profiles status. - :vartype worker_profiles_status: - list[~azure.mgmt.redhatopenshift.v2023_11_22.models.WorkerProfile] + :vartype worker_profiles_status: list[~azure.mgmt.redhatopenshift.models.WorkerProfile] :ivar apiserver_profile: The cluster API server profile. - :vartype apiserver_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.APIServerProfile + :vartype apiserver_profile: ~azure.mgmt.redhatopenshift.models.APIServerProfile :ivar ingress_profiles: The cluster ingress profiles. - :vartype ingress_profiles: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.IngressProfile] + :vartype ingress_profiles: list[~azure.mgmt.redhatopenshift.models.IngressProfile] """ _validation = { @@ -972,26 +954,24 @@ def __init__( :paramtype tags: dict[str, str] :keyword provisioning_state: The cluster provisioning state. Known values are: "AdminUpdating", "Canceled", "Creating", "Deleting", "Failed", "Succeeded", and "Updating". - :paramtype provisioning_state: str or - ~azure.mgmt.redhatopenshift.v2023_11_22.models.ProvisioningState + :paramtype provisioning_state: str or ~azure.mgmt.redhatopenshift.models.ProvisioningState :keyword cluster_profile: The cluster profile. - :paramtype cluster_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.ClusterProfile + :paramtype cluster_profile: ~azure.mgmt.redhatopenshift.models.ClusterProfile :keyword console_profile: The console profile. - :paramtype console_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.ConsoleProfile + :paramtype console_profile: ~azure.mgmt.redhatopenshift.models.ConsoleProfile :keyword service_principal_profile: The cluster service principal profile. :paramtype service_principal_profile: - ~azure.mgmt.redhatopenshift.v2023_11_22.models.ServicePrincipalProfile + ~azure.mgmt.redhatopenshift.models.ServicePrincipalProfile :keyword network_profile: The cluster network profile. - :paramtype network_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.NetworkProfile + :paramtype network_profile: ~azure.mgmt.redhatopenshift.models.NetworkProfile :keyword master_profile: The cluster master profile. - :paramtype master_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MasterProfile + :paramtype master_profile: ~azure.mgmt.redhatopenshift.models.MasterProfile :keyword worker_profiles: The cluster worker profiles. - :paramtype worker_profiles: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.WorkerProfile] + :paramtype worker_profiles: list[~azure.mgmt.redhatopenshift.models.WorkerProfile] :keyword apiserver_profile: The cluster API server profile. - :paramtype apiserver_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.APIServerProfile + :paramtype apiserver_profile: ~azure.mgmt.redhatopenshift.models.APIServerProfile :keyword ingress_profiles: The cluster ingress profiles. - :paramtype ingress_profiles: - list[~azure.mgmt.redhatopenshift.v2023_11_22.models.IngressProfile] + :paramtype ingress_profiles: list[~azure.mgmt.redhatopenshift.models.IngressProfile] """ super().__init__(**kwargs) self.tags = tags @@ -1023,7 +1003,7 @@ class OpenShiftVersion(ProxyResource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :vartype system_data: ~azure.mgmt.redhatopenshift.models.SystemData :ivar version: Version represents the version to create the cluster at. :vartype version: str """ @@ -1056,7 +1036,7 @@ class OpenShiftVersionList(_serialization.Model): """OpenShiftVersionList represents a List of available versions. :ivar value: The List of available versions. - :vartype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftVersion] + :vartype value: list[~azure.mgmt.redhatopenshift.models.OpenShiftVersion] :ivar next_link: Next Link to next operation. :vartype next_link: str """ @@ -1075,7 +1055,7 @@ def __init__( ) -> None: """ :keyword value: The List of available versions. - :paramtype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftVersion] + :paramtype value: list[~azure.mgmt.redhatopenshift.models.OpenShiftVersion] :keyword next_link: Next Link to next operation. :paramtype next_link: str """ @@ -1090,7 +1070,7 @@ class Operation(_serialization.Model): :ivar name: Operation name: {provider}/{resource}/{operation}. :vartype name: str :ivar display: The object that describes the operation. - :vartype display: ~azure.mgmt.redhatopenshift.v2023_11_22.models.Display + :vartype display: ~azure.mgmt.redhatopenshift.models.Display :ivar origin: Sources of requests to this operation. Comma separated list with valid values user or system, e.g. "user,system". :vartype origin: str @@ -1114,7 +1094,7 @@ def __init__( :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str :keyword display: The object that describes the operation. - :paramtype display: ~azure.mgmt.redhatopenshift.v2023_11_22.models.Display + :paramtype display: ~azure.mgmt.redhatopenshift.models.Display :keyword origin: Sources of requests to this operation. Comma separated list with valid values user or system, e.g. "user,system". :paramtype origin: str @@ -1129,7 +1109,7 @@ class OperationList(_serialization.Model): """OperationList represents an RP operation list. :ivar value: List of operations supported by the resource provider. - :vartype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.Operation] + :vartype value: list[~azure.mgmt.redhatopenshift.models.Operation] :ivar next_link: The link used to get the next page of operations. :vartype next_link: str """ @@ -1144,7 +1124,7 @@ def __init__( ) -> None: """ :keyword value: List of operations supported by the resource provider. - :paramtype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.Operation] + :paramtype value: list[~azure.mgmt.redhatopenshift.models.Operation] :keyword next_link: The link used to get the next page of operations. :paramtype next_link: str """ @@ -1168,7 +1148,7 @@ class Secret(ProxyResource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :vartype system_data: ~azure.mgmt.redhatopenshift.models.SystemData :ivar secret_resources: The Secrets Resources. :vartype secret_resources: str """ @@ -1201,7 +1181,7 @@ class SecretList(_serialization.Model): """SecretList represents a list of Secrets. :ivar value: The list of secrets. - :vartype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.Secret] + :vartype value: list[~azure.mgmt.redhatopenshift.models.Secret] :ivar next_link: The link used to get the next page of operations. :vartype next_link: str """ @@ -1216,7 +1196,7 @@ def __init__( ) -> None: """ :keyword value: The list of secrets. - :paramtype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.Secret] + :paramtype value: list[~azure.mgmt.redhatopenshift.models.Secret] :keyword next_link: The link used to get the next page of operations. :paramtype next_link: str """ @@ -1231,7 +1211,7 @@ class SecretUpdate(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :vartype system_data: ~azure.mgmt.redhatopenshift.models.SystemData :ivar secret_resources: The Secrets Resources. :vartype secret_resources: str """ @@ -1296,7 +1276,7 @@ class SyncIdentityProvider(ProxyResource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :vartype system_data: ~azure.mgmt.redhatopenshift.models.SystemData :ivar resources: :vartype resources: str """ @@ -1329,7 +1309,7 @@ class SyncIdentityProviderList(_serialization.Model): """SyncSetList represents a list of SyncSets. :ivar value: The list of sync identity providers. - :vartype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncIdentityProvider] + :vartype value: list[~azure.mgmt.redhatopenshift.models.SyncIdentityProvider] :ivar next_link: The link used to get the next page of operations. :vartype next_link: str """ @@ -1348,7 +1328,7 @@ def __init__( ) -> None: """ :keyword value: The list of sync identity providers. - :paramtype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncIdentityProvider] + :paramtype value: list[~azure.mgmt.redhatopenshift.models.SyncIdentityProvider] :keyword next_link: The link used to get the next page of operations. :paramtype next_link: str """ @@ -1363,7 +1343,7 @@ class SyncIdentityProviderUpdate(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :vartype system_data: ~azure.mgmt.redhatopenshift.models.SystemData :ivar resources: :vartype resources: str """ @@ -1402,7 +1382,7 @@ class SyncSet(ProxyResource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :vartype system_data: ~azure.mgmt.redhatopenshift.models.SystemData :ivar resources: Resources represents the SyncSets configuration. :vartype resources: str """ @@ -1435,7 +1415,7 @@ class SyncSetList(_serialization.Model): """SyncSetList represents a list of SyncSets. :ivar value: The list of syncsets. - :vartype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncSet] + :vartype value: list[~azure.mgmt.redhatopenshift.models.SyncSet] :ivar next_link: The link used to get the next page of operations. :vartype next_link: str """ @@ -1450,7 +1430,7 @@ def __init__( ) -> None: """ :keyword value: The list of syncsets. - :paramtype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncSet] + :paramtype value: list[~azure.mgmt.redhatopenshift.models.SyncSet] :keyword next_link: The link used to get the next page of operations. :paramtype next_link: str """ @@ -1465,7 +1445,7 @@ class SyncSetUpdate(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :vartype system_data: ~azure.mgmt.redhatopenshift.models.SystemData :ivar resources: Resources represents the SyncSets configuration. :vartype resources: str """ @@ -1496,15 +1476,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.redhatopenshift.v2023_11_22.models.CreatedByType + :vartype created_by_type: str or ~azure.mgmt.redhatopenshift.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.redhatopenshift.v2023_11_22.models.CreatedByType + :vartype last_modified_by_type: str or ~azure.mgmt.redhatopenshift.models.CreatedByType :ivar last_modified_at: The timestamp of resource last modification (UTC). :vartype last_modified_at: ~datetime.datetime """ @@ -1534,15 +1513,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.redhatopenshift.v2023_11_22.models.CreatedByType + :paramtype created_by_type: str or ~azure.mgmt.redhatopenshift.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.redhatopenshift.v2023_11_22.models.CreatedByType + :paramtype last_modified_by_type: str or ~azure.mgmt.redhatopenshift.models.CreatedByType :keyword last_modified_at: The timestamp of resource last modification (UTC). :paramtype last_modified_at: ~datetime.datetime """ @@ -1570,8 +1548,7 @@ class WorkerProfile(_serialization.Model): :vartype count: int :ivar encryption_at_host: Whether master virtual machines are encrypted at host. Known values are: "Disabled" and "Enabled". - :vartype encryption_at_host: str or - ~azure.mgmt.redhatopenshift.v2023_11_22.models.EncryptionAtHost + :vartype encryption_at_host: str or ~azure.mgmt.redhatopenshift.models.EncryptionAtHost :ivar disk_encryption_set_id: The resource ID of an associated DiskEncryptionSet, if applicable. :vartype disk_encryption_set_id: str @@ -1612,8 +1589,7 @@ def __init__( :paramtype count: int :keyword encryption_at_host: Whether master virtual machines are encrypted at host. Known values are: "Disabled" and "Enabled". - :paramtype encryption_at_host: str or - ~azure.mgmt.redhatopenshift.v2023_11_22.models.EncryptionAtHost + :paramtype encryption_at_host: str or ~azure.mgmt.redhatopenshift.models.EncryptionAtHost :keyword disk_encryption_set_id: The resource ID of an associated DiskEncryptionSet, if applicable. :paramtype disk_encryption_set_id: str diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/aio/operations/_patch.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/models/_patch.py similarity index 100% rename from sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/aio/operations/_patch.py rename to sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/models/_patch.py diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/__init__.py similarity index 100% rename from sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/__init__.py rename to sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/__init__.py diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/operations/_machine_pools_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_machine_pools_operations.py similarity index 94% rename from sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/operations/_machine_pools_operations.py rename to sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_machine_pools_operations.py index 8dcdfbd4d221..2f081db2d010 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/operations/_machine_pools_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_machine_pools_operations.py @@ -27,7 +27,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 @@ -284,7 +284,7 @@ class MachinePoolsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2023_11_22.AzureRedHatOpenShiftClient`'s + :class:`~azure.mgmt.redhatopenshift.AzureRedHatOpenShiftClient`'s :attr:`machine_pools` attribute. """ @@ -296,7 +296,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(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.MachinePool"]: @@ -310,14 +309,13 @@ def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> I :param resource_name: The name of the OpenShift cluster resource. Required. :type resource_name: str :return: An iterator like instance of either MachinePool or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2023_11_22.models.MachinePool] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.models.MachinePool] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-11-22")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MachinePoolList] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -350,7 +348,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 ) @@ -398,7 +396,7 @@ def get( :param child_resource_name: The name of the MachinePool resource. Required. :type child_resource_name: str :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MachinePool + :rtype: ~azure.mgmt.redhatopenshift.models.MachinePool :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -412,7 +410,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-11-22")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MachinePool] = kwargs.pop("cls", None) _request = build_get_request( @@ -468,12 +466,12 @@ def create_or_update( :param child_resource_name: The name of the MachinePool resource. Required. :type child_resource_name: str :param parameters: The MachinePool resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MachinePool + :type parameters: ~azure.mgmt.redhatopenshift.models.MachinePool :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MachinePool + :rtype: ~azure.mgmt.redhatopenshift.models.MachinePool :raises ~azure.core.exceptions.HttpResponseError: """ @@ -506,7 +504,7 @@ def create_or_update( Default value is "application/json". :paramtype content_type: str :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MachinePool + :rtype: ~azure.mgmt.redhatopenshift.models.MachinePool :raises ~azure.core.exceptions.HttpResponseError: """ @@ -533,9 +531,9 @@ def create_or_update( :type child_resource_name: str :param parameters: The MachinePool resource. Is either a MachinePool type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MachinePool or IO[bytes] + :type parameters: ~azure.mgmt.redhatopenshift.models.MachinePool or IO[bytes] :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MachinePool + :rtype: ~azure.mgmt.redhatopenshift.models.MachinePool :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -549,7 +547,7 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-11-22")) + 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.MachinePool] = kwargs.pop("cls", None) @@ -586,11 +584,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("MachinePool", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("MachinePool", pipeline_response.http_response) + deserialized = self._deserialize("MachinePool", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -627,7 +621,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-11-22")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -678,12 +672,12 @@ def update( :param child_resource_name: The name of the MachinePool resource. Required. :type child_resource_name: str :param parameters: The MachinePool resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MachinePoolUpdate + :type parameters: ~azure.mgmt.redhatopenshift.models.MachinePoolUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MachinePool + :rtype: ~azure.mgmt.redhatopenshift.models.MachinePool :raises ~azure.core.exceptions.HttpResponseError: """ @@ -715,7 +709,7 @@ def update( Default value is "application/json". :paramtype content_type: str :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MachinePool + :rtype: ~azure.mgmt.redhatopenshift.models.MachinePool :raises ~azure.core.exceptions.HttpResponseError: """ @@ -741,9 +735,9 @@ def update( :type child_resource_name: str :param parameters: The MachinePool resource. Is either a MachinePoolUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MachinePoolUpdate or IO[bytes] + :type parameters: ~azure.mgmt.redhatopenshift.models.MachinePoolUpdate or IO[bytes] :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MachinePool + :rtype: ~azure.mgmt.redhatopenshift.models.MachinePool :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -757,7 +751,7 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-11-22")) + 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.MachinePool] = kwargs.pop("cls", None) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/operations/_open_shift_clusters_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_open_shift_clusters_operations.py similarity index 93% rename from sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/operations/_open_shift_clusters_operations.py rename to sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_open_shift_clusters_operations.py index 23d7cb701255..3827260193c8 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/operations/_open_shift_clusters_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_open_shift_clusters_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -29,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 @@ -306,7 +308,7 @@ class OpenShiftClustersOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2023_11_22.AzureRedHatOpenShiftClient`'s + :class:`~azure.mgmt.redhatopenshift.AzureRedHatOpenShiftClient`'s :attr:`open_shift_clusters` attribute. """ @@ -318,7 +320,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(self, **kwargs: Any) -> Iterable["_models.OpenShiftCluster"]: @@ -327,14 +328,13 @@ def list(self, **kwargs: Any) -> Iterable["_models.OpenShiftCluster"]: The operation returns properties of each OpenShift cluster. :return: An iterator like instance of either OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftCluster] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.models.OpenShiftCluster] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-11-22")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OpenShiftClusterList] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -365,7 +365,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 ) @@ -407,14 +407,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 OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftCluster] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.models.OpenShiftCluster] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-11-22")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OpenShiftClusterList] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -446,7 +445,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 ) @@ -490,7 +489,7 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m :param resource_name: The name of the OpenShift cluster resource. Required. :type resource_name: str :return: OpenShiftCluster or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftCluster + :rtype: ~azure.mgmt.redhatopenshift.models.OpenShiftCluster :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -504,7 +503,7 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-11-22")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OpenShiftCluster] = kwargs.pop("cls", None) _request = build_get_request( @@ -553,7 +552,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-11-22")) + 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) @@ -578,6 +577,7 @@ def _create_or_update_initial( ) _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 @@ -586,15 +586,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -622,14 +621,13 @@ def begin_create_or_update( :param resource_name: The name of the OpenShift cluster resource. Required. :type resource_name: str :param parameters: The OpenShift cluster resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftCluster + :type parameters: ~azure.mgmt.redhatopenshift.models.OpenShiftCluster :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 OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftCluster] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.models.OpenShiftCluster] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -660,8 +658,7 @@ def begin_create_or_update( :paramtype content_type: str :return: An instance of LROPoller that returns either OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftCluster] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.models.OpenShiftCluster] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -685,17 +682,16 @@ def begin_create_or_update( :type resource_name: str :param parameters: The OpenShift cluster resource. Is either a OpenShiftCluster type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftCluster or IO[bytes] + :type parameters: ~azure.mgmt.redhatopenshift.models.OpenShiftCluster or IO[bytes] :return: An instance of LROPoller that returns either OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftCluster] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.models.OpenShiftCluster] :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-11-22")) + 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.OpenShiftCluster] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -751,7 +747,7 @@ def _delete_initial(self, resource_group_name: str, resource_name: str, **kwargs _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-11-22")) + 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( @@ -764,6 +760,7 @@ def _delete_initial(self, resource_group_name: str, resource_name: str, **kwargs ) _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 @@ -772,15 +769,14 @@ def _delete_initial(self, resource_group_name: str, resource_name: str, **kwargs response = pipeline_response.http_response if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -805,7 +801,7 @@ def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-11-22")) + 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) @@ -860,7 +856,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 "2023-11-22")) + 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) @@ -885,6 +881,7 @@ def _update_initial( ) _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 @@ -893,15 +890,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -928,14 +924,13 @@ def begin_update( :param resource_name: The name of the OpenShift cluster resource. Required. :type resource_name: str :param parameters: The OpenShift cluster resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftClusterUpdate + :type parameters: ~azure.mgmt.redhatopenshift.models.OpenShiftClusterUpdate :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 OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftCluster] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.models.OpenShiftCluster] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -965,8 +960,7 @@ def begin_update( :paramtype content_type: str :return: An instance of LROPoller that returns either OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftCluster] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.models.OpenShiftCluster] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -989,18 +983,16 @@ def begin_update( :type resource_name: str :param parameters: The OpenShift cluster resource. Is either a OpenShiftClusterUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftClusterUpdate or - IO[bytes] + :type parameters: ~azure.mgmt.redhatopenshift.models.OpenShiftClusterUpdate or IO[bytes] :return: An instance of LROPoller that returns either OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftCluster] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.models.OpenShiftCluster] :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-11-22")) + 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.OpenShiftCluster] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1059,7 +1051,7 @@ def list_admin_credentials( :param resource_name: The name of the OpenShift cluster resource. Required. :type resource_name: str :return: OpenShiftClusterAdminKubeconfig or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftClusterAdminKubeconfig + :rtype: ~azure.mgmt.redhatopenshift.models.OpenShiftClusterAdminKubeconfig :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -1073,7 +1065,7 @@ def list_admin_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 "2023-11-22")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OpenShiftClusterAdminKubeconfig] = kwargs.pop("cls", None) _request = build_list_admin_credentials_request( @@ -1119,7 +1111,7 @@ def list_credentials( :param resource_name: The name of the OpenShift cluster resource. Required. :type resource_name: str :return: OpenShiftClusterCredentials or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftClusterCredentials + :rtype: ~azure.mgmt.redhatopenshift.models.OpenShiftClusterCredentials :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -1133,7 +1125,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 "2023-11-22")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OpenShiftClusterCredentials] = kwargs.pop("cls", None) _request = build_list_credentials_request( diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/operations/_open_shift_versions_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_open_shift_versions_operations.py similarity index 93% rename from sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/operations/_open_shift_versions_operations.py rename to sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_open_shift_versions_operations.py index 4c08a4e26e92..12d2e067cef5 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/operations/_open_shift_versions_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_open_shift_versions_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 @@ -73,7 +73,7 @@ class OpenShiftVersionsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2023_11_22.AzureRedHatOpenShiftClient`'s + :class:`~azure.mgmt.redhatopenshift.AzureRedHatOpenShiftClient`'s :attr:`open_shift_versions` attribute. """ @@ -85,7 +85,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(self, location: str, **kwargs: Any) -> Iterable["_models.OpenShiftVersion"]: @@ -96,14 +95,13 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.OpenShiftVersi :param location: The name of Azure region. Required. :type location: str :return: An iterator like instance of either OpenShiftVersion or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftVersion] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.models.OpenShiftVersion] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-11-22")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OpenShiftVersionList] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -135,7 +133,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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/operations/_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_operations.py similarity index 94% rename from sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/operations/_operations.py rename to sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_operations.py index 8021ebb3f9f0..82b84ed4a039 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/operations/_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_operations.py @@ -26,7 +26,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from ..._serialization import Serializer +from .._serialization import Serializer if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -64,7 +64,7 @@ class Operations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2023_11_22.AzureRedHatOpenShiftClient`'s + :class:`~azure.mgmt.redhatopenshift.AzureRedHatOpenShiftClient`'s :attr:`operations` attribute. """ @@ -76,7 +76,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(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -85,13 +84,13 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: The operation returns the RP operations. :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2023_11_22.models.Operation] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.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-11-22")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -121,7 +120,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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/models/_patch.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_patch.py similarity index 100% rename from sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/models/_patch.py rename to sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_patch.py diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/operations/_secrets_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_secrets_operations.py similarity index 94% rename from sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/operations/_secrets_operations.py rename to sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_secrets_operations.py index a002588cc113..50d3ed02c9fc 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/operations/_secrets_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_secrets_operations.py @@ -27,7 +27,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 @@ -284,7 +284,7 @@ class SecretsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2023_11_22.AzureRedHatOpenShiftClient`'s + :class:`~azure.mgmt.redhatopenshift.AzureRedHatOpenShiftClient`'s :attr:`secrets` attribute. """ @@ -296,7 +296,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(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.Secret"]: @@ -310,13 +309,13 @@ def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> I :param resource_name: The name of the OpenShift cluster resource. Required. :type resource_name: str :return: An iterator like instance of either Secret or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2023_11_22.models.Secret] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.models.Secret] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-11-22")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SecretList] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -349,7 +348,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 ) @@ -397,7 +396,7 @@ def get( :param child_resource_name: The name of the Secret resource. Required. :type child_resource_name: str :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.Secret + :rtype: ~azure.mgmt.redhatopenshift.models.Secret :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -411,7 +410,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-11-22")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Secret] = kwargs.pop("cls", None) _request = build_get_request( @@ -466,12 +465,12 @@ def create_or_update( :param child_resource_name: The name of the Secret resource. Required. :type child_resource_name: str :param parameters: The Secret resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.Secret + :type parameters: ~azure.mgmt.redhatopenshift.models.Secret :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.Secret + :rtype: ~azure.mgmt.redhatopenshift.models.Secret :raises ~azure.core.exceptions.HttpResponseError: """ @@ -503,7 +502,7 @@ def create_or_update( Default value is "application/json". :paramtype content_type: str :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.Secret + :rtype: ~azure.mgmt.redhatopenshift.models.Secret :raises ~azure.core.exceptions.HttpResponseError: """ @@ -528,9 +527,9 @@ def create_or_update( :param child_resource_name: The name of the Secret resource. Required. :type child_resource_name: str :param parameters: The Secret resource. Is either a Secret type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.Secret or IO[bytes] + :type parameters: ~azure.mgmt.redhatopenshift.models.Secret or IO[bytes] :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.Secret + :rtype: ~azure.mgmt.redhatopenshift.models.Secret :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -544,7 +543,7 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-11-22")) + 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.Secret] = kwargs.pop("cls", None) @@ -581,11 +580,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Secret", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Secret", pipeline_response.http_response) + deserialized = self._deserialize("Secret", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -622,7 +617,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-11-22")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -673,12 +668,12 @@ def update( :param child_resource_name: The name of the Secret resource. Required. :type child_resource_name: str :param parameters: The Secret resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SecretUpdate + :type parameters: ~azure.mgmt.redhatopenshift.models.SecretUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.Secret + :rtype: ~azure.mgmt.redhatopenshift.models.Secret :raises ~azure.core.exceptions.HttpResponseError: """ @@ -710,7 +705,7 @@ def update( Default value is "application/json". :paramtype content_type: str :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.Secret + :rtype: ~azure.mgmt.redhatopenshift.models.Secret :raises ~azure.core.exceptions.HttpResponseError: """ @@ -736,9 +731,9 @@ def update( :type child_resource_name: str :param parameters: The Secret resource. Is either a SecretUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SecretUpdate or IO[bytes] + :type parameters: ~azure.mgmt.redhatopenshift.models.SecretUpdate or IO[bytes] :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.Secret + :rtype: ~azure.mgmt.redhatopenshift.models.Secret :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -752,7 +747,7 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-11-22")) + 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.Secret] = kwargs.pop("cls", None) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/operations/_sync_identity_providers_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_sync_identity_providers_operations.py similarity index 94% rename from sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/operations/_sync_identity_providers_operations.py rename to sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_sync_identity_providers_operations.py index 5c65fde12376..a51a465de2cb 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/operations/_sync_identity_providers_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_sync_identity_providers_operations.py @@ -27,7 +27,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 @@ -284,7 +284,7 @@ class SyncIdentityProvidersOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2023_11_22.AzureRedHatOpenShiftClient`'s + :class:`~azure.mgmt.redhatopenshift.AzureRedHatOpenShiftClient`'s :attr:`sync_identity_providers` attribute. """ @@ -296,7 +296,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( @@ -313,14 +312,13 @@ def list( :type resource_name: str :return: An iterator like instance of either SyncIdentityProvider or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncIdentityProvider] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.models.SyncIdentityProvider] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-11-22")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SyncIdentityProviderList] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -353,7 +351,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 ) @@ -401,7 +399,7 @@ def get( :param child_resource_name: The name of the SyncIdentityProvider resource. Required. :type child_resource_name: str :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncIdentityProvider + :rtype: ~azure.mgmt.redhatopenshift.models.SyncIdentityProvider :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -415,7 +413,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-11-22")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SyncIdentityProvider] = kwargs.pop("cls", None) _request = build_get_request( @@ -471,12 +469,12 @@ def create_or_update( :param child_resource_name: The name of the SyncIdentityProvider resource. Required. :type child_resource_name: str :param parameters: The SyncIdentityProvider resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncIdentityProvider + :type parameters: ~azure.mgmt.redhatopenshift.models.SyncIdentityProvider :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncIdentityProvider + :rtype: ~azure.mgmt.redhatopenshift.models.SyncIdentityProvider :raises ~azure.core.exceptions.HttpResponseError: """ @@ -509,7 +507,7 @@ def create_or_update( Default value is "application/json". :paramtype content_type: str :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncIdentityProvider + :rtype: ~azure.mgmt.redhatopenshift.models.SyncIdentityProvider :raises ~azure.core.exceptions.HttpResponseError: """ @@ -536,10 +534,9 @@ def create_or_update( :type child_resource_name: str :param parameters: The SyncIdentityProvider resource. Is either a SyncIdentityProvider type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncIdentityProvider or - IO[bytes] + :type parameters: ~azure.mgmt.redhatopenshift.models.SyncIdentityProvider or IO[bytes] :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncIdentityProvider + :rtype: ~azure.mgmt.redhatopenshift.models.SyncIdentityProvider :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -553,7 +550,7 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-11-22")) + 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.SyncIdentityProvider] = kwargs.pop("cls", None) @@ -590,11 +587,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SyncIdentityProvider", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SyncIdentityProvider", pipeline_response.http_response) + deserialized = self._deserialize("SyncIdentityProvider", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -632,7 +625,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-11-22")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -684,12 +677,12 @@ def update( :param child_resource_name: The name of the SyncIdentityProvider resource. Required. :type child_resource_name: str :param parameters: The SyncIdentityProvider resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncIdentityProviderUpdate + :type parameters: ~azure.mgmt.redhatopenshift.models.SyncIdentityProviderUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncIdentityProvider + :rtype: ~azure.mgmt.redhatopenshift.models.SyncIdentityProvider :raises ~azure.core.exceptions.HttpResponseError: """ @@ -722,7 +715,7 @@ def update( Default value is "application/json". :paramtype content_type: str :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncIdentityProvider + :rtype: ~azure.mgmt.redhatopenshift.models.SyncIdentityProvider :raises ~azure.core.exceptions.HttpResponseError: """ @@ -749,10 +742,9 @@ def update( :type child_resource_name: str :param parameters: The SyncIdentityProvider resource. Is either a SyncIdentityProviderUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncIdentityProviderUpdate or - IO[bytes] + :type parameters: ~azure.mgmt.redhatopenshift.models.SyncIdentityProviderUpdate or IO[bytes] :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncIdentityProvider + :rtype: ~azure.mgmt.redhatopenshift.models.SyncIdentityProvider :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -766,7 +758,7 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-11-22")) + 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.SyncIdentityProvider] = kwargs.pop("cls", None) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/operations/_sync_sets_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_sync_sets_operations.py similarity index 94% rename from sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/operations/_sync_sets_operations.py rename to sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_sync_sets_operations.py index b55f230cc64b..940fc9c62cc3 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/operations/_sync_sets_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_sync_sets_operations.py @@ -27,7 +27,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 @@ -284,7 +284,7 @@ class SyncSetsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2023_11_22.AzureRedHatOpenShiftClient`'s + :class:`~azure.mgmt.redhatopenshift.AzureRedHatOpenShiftClient`'s :attr:`sync_sets` attribute. """ @@ -296,7 +296,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(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.SyncSet"]: @@ -310,13 +309,13 @@ def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> I :param resource_name: The name of the OpenShift cluster resource. Required. :type resource_name: str :return: An iterator like instance of either SyncSet or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncSet] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.models.SyncSet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-11-22")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SyncSetList] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -349,7 +348,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 ) @@ -397,7 +396,7 @@ def get( :param child_resource_name: The name of the SyncSet resource. Required. :type child_resource_name: str :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncSet + :rtype: ~azure.mgmt.redhatopenshift.models.SyncSet :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -411,7 +410,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-11-22")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SyncSet] = kwargs.pop("cls", None) _request = build_get_request( @@ -466,12 +465,12 @@ def create_or_update( :param child_resource_name: The name of the SyncSet resource. Required. :type child_resource_name: str :param parameters: The SyncSet resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncSet + :type parameters: ~azure.mgmt.redhatopenshift.models.SyncSet :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncSet + :rtype: ~azure.mgmt.redhatopenshift.models.SyncSet :raises ~azure.core.exceptions.HttpResponseError: """ @@ -503,7 +502,7 @@ def create_or_update( Default value is "application/json". :paramtype content_type: str :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncSet + :rtype: ~azure.mgmt.redhatopenshift.models.SyncSet :raises ~azure.core.exceptions.HttpResponseError: """ @@ -529,9 +528,9 @@ def create_or_update( :type child_resource_name: str :param parameters: The SyncSet resource. Is either a SyncSet type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncSet or IO[bytes] + :type parameters: ~azure.mgmt.redhatopenshift.models.SyncSet or IO[bytes] :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncSet + :rtype: ~azure.mgmt.redhatopenshift.models.SyncSet :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -545,7 +544,7 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-11-22")) + 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.SyncSet] = kwargs.pop("cls", None) @@ -582,11 +581,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SyncSet", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SyncSet", pipeline_response.http_response) + deserialized = self._deserialize("SyncSet", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -623,7 +618,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-11-22")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -674,12 +669,12 @@ def update( :param child_resource_name: The name of the SyncSet resource. Required. :type child_resource_name: str :param parameters: The SyncSet resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncSetUpdate + :type parameters: ~azure.mgmt.redhatopenshift.models.SyncSetUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncSet + :rtype: ~azure.mgmt.redhatopenshift.models.SyncSet :raises ~azure.core.exceptions.HttpResponseError: """ @@ -711,7 +706,7 @@ def update( Default value is "application/json". :paramtype content_type: str :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncSet + :rtype: ~azure.mgmt.redhatopenshift.models.SyncSet :raises ~azure.core.exceptions.HttpResponseError: """ @@ -737,9 +732,9 @@ def update( :type child_resource_name: str :param parameters: The SyncSet resource. Is either a SyncSetUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncSetUpdate or IO[bytes] + :type parameters: ~azure.mgmt.redhatopenshift.models.SyncSetUpdate or IO[bytes] :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncSet + :rtype: ~azure.mgmt.redhatopenshift.models.SyncSet :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -753,7 +748,7 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-11-22")) + 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.SyncSet] = kwargs.pop("cls", None) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/__init__.py deleted file mode 100644 index 04ebd4beb61a..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/__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 ._azure_red_hat_open_shift4_client import AzureRedHatOpenShift4Client -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__ = [ - "AzureRedHatOpenShift4Client", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/_azure_red_hat_open_shift4_client.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/_azure_red_hat_open_shift4_client.py deleted file mode 100644 index 9bd774f2b860..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/_azure_red_hat_open_shift4_client.py +++ /dev/null @@ -1,118 +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 AzureRedHatOpenShift4ClientConfiguration -from .operations import OpenShiftClustersOperations, Operations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class AzureRedHatOpenShift4Client: # pylint: disable=client-accepts-api-version-keyword - """Rest API for Azure Red Hat OpenShift 4. - - :ivar operations: Operations operations - :vartype operations: azure.mgmt.redhatopenshift.v2020_04_30.operations.Operations - :ivar open_shift_clusters: OpenShiftClustersOperations operations - :vartype open_shift_clusters: - azure.mgmt.redhatopenshift.v2020_04_30.operations.OpenShiftClustersOperations - :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 "2020-04-30". 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 = AzureRedHatOpenShift4ClientConfiguration( - 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, "2020-04-30") - self.open_shift_clusters = OpenShiftClustersOperations( - self._client, self._config, self._serialize, self._deserialize, "2020-04-30" - ) - - 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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/_configuration.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/_configuration.py deleted file mode 100644 index 23afe242fb58..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/_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 AzureRedHatOpenShift4ClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for AzureRedHatOpenShift4Client. - - 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 "2020-04-30". 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", "2020-04-30") - - 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-redhatopenshift/{}".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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/_metadata.json b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/_metadata.json deleted file mode 100644 index f1e7abfa6b09..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/_metadata.json +++ /dev/null @@ -1,111 +0,0 @@ -{ - "chosen_version": "2020-04-30", - "total_api_version_list": ["2020-04-30"], - "client": { - "name": "AzureRedHatOpenShift4Client", - "filename": "_azure_red_hat_open_shift4_client", - "description": "Rest API for Azure Red Hat OpenShift 4.", - "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\": [\"AzureRedHatOpenShift4ClientConfiguration\"], \".._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\": [\"AzureRedHatOpenShift4ClientConfiguration\"], \"..._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", - "open_shift_clusters": "OpenShiftClustersOperations" - } -} diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/_patch.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/_patch.py deleted file mode 100644 index 17dbc073e01b..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/_patch.py +++ /dev/null @@ -1,32 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/_version.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/_version.py deleted file mode 100644 index b2efd13ce94d..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/_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 = "1.5.0" diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/aio/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/aio/__init__.py deleted file mode 100644 index 796011f698f4..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/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 ._azure_red_hat_open_shift4_client import AzureRedHatOpenShift4Client - -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__ = [ - "AzureRedHatOpenShift4Client", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/aio/_azure_red_hat_open_shift4_client.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/aio/_azure_red_hat_open_shift4_client.py deleted file mode 100644 index 695fcb47608d..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/aio/_azure_red_hat_open_shift4_client.py +++ /dev/null @@ -1,120 +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 AzureRedHatOpenShift4ClientConfiguration -from .operations import OpenShiftClustersOperations, Operations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class AzureRedHatOpenShift4Client: # pylint: disable=client-accepts-api-version-keyword - """Rest API for Azure Red Hat OpenShift 4. - - :ivar operations: Operations operations - :vartype operations: azure.mgmt.redhatopenshift.v2020_04_30.aio.operations.Operations - :ivar open_shift_clusters: OpenShiftClustersOperations operations - :vartype open_shift_clusters: - azure.mgmt.redhatopenshift.v2020_04_30.aio.operations.OpenShiftClustersOperations - :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 "2020-04-30". 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 = AzureRedHatOpenShift4ClientConfiguration( - 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, "2020-04-30") - self.open_shift_clusters = OpenShiftClustersOperations( - self._client, self._config, self._serialize, self._deserialize, "2020-04-30" - ) - - 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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/aio/_configuration.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/aio/_configuration.py deleted file mode 100644 index cf288368b1ba..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/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 AzureRedHatOpenShift4ClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for AzureRedHatOpenShift4Client. - - 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 "2020-04-30". 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", "2020-04-30") - - 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-redhatopenshift/{}".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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/aio/_patch.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/aio/_patch.py deleted file mode 100644 index 17dbc073e01b..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/aio/_patch.py +++ /dev/null @@ -1,32 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/aio/operations/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/aio/operations/__init__.py deleted file mode 100644 index 70ea64711791..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/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 ._operations import Operations -from ._open_shift_clusters_operations import OpenShiftClustersOperations - -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", - "OpenShiftClustersOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/aio/operations/_open_shift_clusters_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/aio/operations/_open_shift_clusters_operations.py deleted file mode 100644 index 44db503ec2a2..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/aio/operations/_open_shift_clusters_operations.py +++ /dev/null @@ -1,860 +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, - 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._open_shift_clusters_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 OpenShiftClustersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2020_04_30.aio.AzureRedHatOpenShift4Client`'s - :attr:`open_shift_clusters` 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.OpenShiftCluster"]: - """Lists OpenShift clusters in the specified subscription. - - The operation returns properties of each OpenShift cluster. - - :return: An iterator like instance of either OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2020_04_30.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-30")) - cls: ClsType[_models.OpenShiftClusterList] = 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("OpenShiftClusterList", 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) - raise HttpResponseError(response=response, 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.OpenShiftCluster"]: - """Lists OpenShift clusters in the specified subscription and resource group. - - The operation returns properties of each OpenShift cluster. - - :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 OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2020_04_30.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-30")) - cls: ClsType[_models.OpenShiftClusterList] = 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("OpenShiftClusterList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.OpenShiftCluster: - """Gets a OpenShift cluster with the specified subscription, resource group and resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: OpenShiftCluster or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2020_04_30.models.OpenShiftCluster - :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 "2020-04-30")) - cls: ClsType[_models.OpenShiftCluster] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenShiftCluster", 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, - resource_name: str, - parameters: Union[_models.OpenShiftCluster, IO[bytes]], - **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 "2020-04-30")) - 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, "OpenShiftCluster") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - 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 = 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]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - 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, - resource_name: str, - parameters: _models.OpenShiftCluster, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2020_04_30.models.OpenShiftCluster - :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 OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2020_04_30.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :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: An instance of AsyncLROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2020_04_30.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - parameters: Union[_models.OpenShiftCluster, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a OpenShiftCluster type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2020_04_30.models.OpenShiftCluster or IO[bytes] - :return: An instance of AsyncLROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2020_04_30.models.OpenShiftCluster] - :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 "2020-04-30")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OpenShiftCluster] = 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, - resource_name=resource_name, - parameters=parameters, - 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("OpenShiftCluster", 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.OpenShiftCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OpenShiftCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, resource_name: str, **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 "2020-04-30")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - 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, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Deletes a OpenShift cluster with the specified subscription, resource group and resource name. - - The operation returns nothing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: 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 "2020-04-30")) - 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, - resource_name=resource_name, - 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, **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 _update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: Union[_models.OpenShiftClusterUpdate, IO[bytes]], - **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 "2020-04-30")) - 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, "OpenShiftClusterUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - 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 = 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]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.OpenShiftClusterUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2020_04_30.models.OpenShiftClusterUpdate - :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 OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2020_04_30.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :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: An instance of AsyncLROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2020_04_30.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - resource_name: str, - parameters: Union[_models.OpenShiftClusterUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a OpenShiftClusterUpdate type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2020_04_30.models.OpenShiftClusterUpdate or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2020_04_30.models.OpenShiftCluster] - :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 "2020-04-30")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OpenShiftCluster] = 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, - resource_name=resource_name, - parameters=parameters, - 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("OpenShiftCluster", 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.OpenShiftCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OpenShiftCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace_async - async def list_credentials( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.OpenShiftClusterCredentials: - """Lists credentials of an OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns the credentials. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: OpenShiftClusterCredentials or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2020_04_30.models.OpenShiftClusterCredentials - :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 "2020-04-30")) - cls: ClsType[_models.OpenShiftClusterCredentials] = kwargs.pop("cls", None) - - _request = build_list_credentials_request( - resource_group_name=resource_group_name, - resource_name=resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenShiftClusterCredentials", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/aio/operations/_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/aio/operations/_operations.py deleted file mode 100644 index f34869f4e7b7..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/aio/operations/_operations.py +++ /dev/null @@ -1,133 +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.redhatopenshift.v2020_04_30.aio.AzureRedHatOpenShift4Client`'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"]: - """Lists all of the available RP operations. - - The operation returns the RP operations. - - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2020_04_30.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 "2020-04-30")) - cls: ClsType[_models.OperationList] = 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("OperationList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/models/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/models/__init__.py deleted file mode 100644 index 0ac56ca3b505..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/models/__init__.py +++ /dev/null @@ -1,59 +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 APIServerProfile -from ._models_py3 import CloudErrorBody -from ._models_py3 import ClusterProfile -from ._models_py3 import ConsoleProfile -from ._models_py3 import Display -from ._models_py3 import IngressProfile -from ._models_py3 import MasterProfile -from ._models_py3 import NetworkProfile -from ._models_py3 import OpenShiftCluster -from ._models_py3 import OpenShiftClusterCredentials -from ._models_py3 import OpenShiftClusterList -from ._models_py3 import OpenShiftClusterUpdate -from ._models_py3 import Operation -from ._models_py3 import OperationList -from ._models_py3 import Resource -from ._models_py3 import ServicePrincipalProfile -from ._models_py3 import TrackedResource -from ._models_py3 import WorkerProfile - -from ._azure_red_hat_open_shift4_client_enums import ProvisioningState -from ._azure_red_hat_open_shift4_client_enums import VMSize -from ._azure_red_hat_open_shift4_client_enums import Visibility -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "APIServerProfile", - "CloudErrorBody", - "ClusterProfile", - "ConsoleProfile", - "Display", - "IngressProfile", - "MasterProfile", - "NetworkProfile", - "OpenShiftCluster", - "OpenShiftClusterCredentials", - "OpenShiftClusterList", - "OpenShiftClusterUpdate", - "Operation", - "OperationList", - "Resource", - "ServicePrincipalProfile", - "TrackedResource", - "WorkerProfile", - "ProvisioningState", - "VMSize", - "Visibility", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/models/_azure_red_hat_open_shift4_client_enums.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/models/_azure_red_hat_open_shift4_client_enums.py deleted file mode 100644 index f5808017d0a0..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/models/_azure_red_hat_open_shift4_client_enums.py +++ /dev/null @@ -1,36 +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 ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ProvisioningState represents a provisioning state.""" - - ADMIN_UPDATING = "AdminUpdating" - CREATING = "Creating" - DELETING = "Deleting" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class Visibility(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Visibility represents visibility.""" - - PRIVATE = "Private" - PUBLIC = "Public" - - -class VMSize(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """VMSize represents a VM size.""" - - STANDARD_D2_S_V3 = "Standard_D2s_v3" - STANDARD_D4_S_V3 = "Standard_D4s_v3" - STANDARD_D8_S_V3 = "Standard_D8s_v3" diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/models/_models_py3.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/models/_models_py3.py deleted file mode 100644 index f44c63b4e988..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/models/_models_py3.py +++ /dev/null @@ -1,826 +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. -# -------------------------------------------------------------------------- - -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 APIServerProfile(_serialization.Model): - """APIServerProfile represents an API server profile. - - :ivar visibility: API server visibility (immutable). Known values are: "Private" and "Public". - :vartype visibility: str or ~azure.mgmt.redhatopenshift.v2020_04_30.models.Visibility - :ivar url: The URL to access the cluster API server (immutable). - :vartype url: str - :ivar ip: The IP of the cluster API server (immutable). - :vartype ip: str - """ - - _attribute_map = { - "visibility": {"key": "visibility", "type": "str"}, - "url": {"key": "url", "type": "str"}, - "ip": {"key": "ip", "type": "str"}, - } - - def __init__( - self, - *, - visibility: Optional[Union[str, "_models.Visibility"]] = None, - url: Optional[str] = None, - ip: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword visibility: API server visibility (immutable). Known values are: "Private" and - "Public". - :paramtype visibility: str or ~azure.mgmt.redhatopenshift.v2020_04_30.models.Visibility - :keyword url: The URL to access the cluster API server (immutable). - :paramtype url: str - :keyword ip: The IP of the cluster API server (immutable). - :paramtype ip: str - """ - super().__init__(**kwargs) - self.visibility = visibility - self.url = url - self.ip = ip - - -class CloudErrorBody(_serialization.Model): - """CloudErrorBody represents the body of a cloud error. - - :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :vartype code: str - :ivar message: A message describing the error, intended to be suitable for display in a user - interface. - :vartype message: str - :ivar target: The target of the particular error. For example, the name of the property in - error. - :vartype target: str - :ivar details: A list of additional details about the error. - :vartype details: list[~azure.mgmt.redhatopenshift.v2020_04_30.models.CloudErrorBody] - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[CloudErrorBody]"}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[List["_models.CloudErrorBody"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :paramtype code: str - :keyword message: A message describing the error, intended to be suitable for display in a user - interface. - :paramtype message: str - :keyword target: The target of the particular error. For example, the name of the property in - error. - :paramtype target: str - :keyword details: A list of additional details about the error. - :paramtype details: list[~azure.mgmt.redhatopenshift.v2020_04_30.models.CloudErrorBody] - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - -class ClusterProfile(_serialization.Model): - """ClusterProfile represents a cluster profile. - - :ivar pull_secret: The pull secret for the cluster (immutable). - :vartype pull_secret: str - :ivar domain: The domain for the cluster (immutable). - :vartype domain: str - :ivar version: The version of the cluster (immutable). - :vartype version: str - :ivar resource_group_id: The ID of the cluster resource group (immutable). - :vartype resource_group_id: str - """ - - _attribute_map = { - "pull_secret": {"key": "pullSecret", "type": "str"}, - "domain": {"key": "domain", "type": "str"}, - "version": {"key": "version", "type": "str"}, - "resource_group_id": {"key": "resourceGroupId", "type": "str"}, - } - - def __init__( - self, - *, - pull_secret: Optional[str] = None, - domain: Optional[str] = None, - version: Optional[str] = None, - resource_group_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword pull_secret: The pull secret for the cluster (immutable). - :paramtype pull_secret: str - :keyword domain: The domain for the cluster (immutable). - :paramtype domain: str - :keyword version: The version of the cluster (immutable). - :paramtype version: str - :keyword resource_group_id: The ID of the cluster resource group (immutable). - :paramtype resource_group_id: str - """ - super().__init__(**kwargs) - self.pull_secret = pull_secret - self.domain = domain - self.version = version - self.resource_group_id = resource_group_id - - -class ConsoleProfile(_serialization.Model): - """ConsoleProfile represents a console profile. - - :ivar url: The URL to access the cluster console (immutable). - :vartype url: str - """ - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - } - - def __init__(self, *, url: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword url: The URL to access the cluster console (immutable). - :paramtype url: str - """ - super().__init__(**kwargs) - self.url = url - - -class Display(_serialization.Model): - """Display represents the display details of an operation. - - :ivar provider: Friendly name of the resource provider. - :vartype provider: str - :ivar resource: Resource type on which the operation is performed. - :vartype resource: str - :ivar operation: Operation type: read, write, delete, listKeys/action, etc. - :vartype operation: str - :ivar description: Friendly name of the operation. - :vartype description: str - """ - - _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__( - self, - *, - provider: Optional[str] = None, - resource: Optional[str] = None, - operation: Optional[str] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword provider: Friendly name of the resource provider. - :paramtype provider: str - :keyword resource: Resource type on which the operation is performed. - :paramtype resource: str - :keyword operation: Operation type: read, write, delete, listKeys/action, etc. - :paramtype operation: str - :keyword description: Friendly name of the operation. - :paramtype description: str - """ - super().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class IngressProfile(_serialization.Model): - """IngressProfile represents an ingress profile. - - :ivar name: The ingress profile name. Must be "default" (immutable). - :vartype name: str - :ivar visibility: Ingress visibility (immutable). Known values are: "Private" and "Public". - :vartype visibility: str or ~azure.mgmt.redhatopenshift.v2020_04_30.models.Visibility - :ivar ip: The IP of the ingress (immutable). - :vartype ip: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "visibility": {"key": "visibility", "type": "str"}, - "ip": {"key": "ip", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - visibility: Optional[Union[str, "_models.Visibility"]] = None, - ip: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The ingress profile name. Must be "default" (immutable). - :paramtype name: str - :keyword visibility: Ingress visibility (immutable). Known values are: "Private" and "Public". - :paramtype visibility: str or ~azure.mgmt.redhatopenshift.v2020_04_30.models.Visibility - :keyword ip: The IP of the ingress (immutable). - :paramtype ip: str - """ - super().__init__(**kwargs) - self.name = name - self.visibility = visibility - self.ip = ip - - -class MasterProfile(_serialization.Model): - """MasterProfile represents a master profile. - - :ivar vm_size: The size of the master VMs (immutable). Known values are: "Standard_D2s_v3", - "Standard_D4s_v3", and "Standard_D8s_v3". - :vartype vm_size: str or ~azure.mgmt.redhatopenshift.v2020_04_30.models.VMSize - :ivar subnet_id: The Azure resource ID of the master subnet (immutable). - :vartype subnet_id: str - """ - - _attribute_map = { - "vm_size": {"key": "vmSize", "type": "str"}, - "subnet_id": {"key": "subnetId", "type": "str"}, - } - - def __init__( - self, *, vm_size: Optional[Union[str, "_models.VMSize"]] = None, subnet_id: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword vm_size: The size of the master VMs (immutable). Known values are: "Standard_D2s_v3", - "Standard_D4s_v3", and "Standard_D8s_v3". - :paramtype vm_size: str or ~azure.mgmt.redhatopenshift.v2020_04_30.models.VMSize - :keyword subnet_id: The Azure resource ID of the master subnet (immutable). - :paramtype subnet_id: str - """ - super().__init__(**kwargs) - self.vm_size = vm_size - self.subnet_id = subnet_id - - -class NetworkProfile(_serialization.Model): - """NetworkProfile represents a network profile. - - :ivar pod_cidr: The CIDR used for OpenShift/Kubernetes Pods (immutable). - :vartype pod_cidr: str - :ivar service_cidr: The CIDR used for OpenShift/Kubernetes Services (immutable). - :vartype service_cidr: str - """ - - _attribute_map = { - "pod_cidr": {"key": "podCidr", "type": "str"}, - "service_cidr": {"key": "serviceCidr", "type": "str"}, - } - - def __init__(self, *, pod_cidr: Optional[str] = None, service_cidr: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword pod_cidr: The CIDR used for OpenShift/Kubernetes Pods (immutable). - :paramtype pod_cidr: str - :keyword service_cidr: The CIDR used for OpenShift/Kubernetes Services (immutable). - :paramtype service_cidr: str - """ - super().__init__(**kwargs) - self.pod_cidr = pod_cidr - self.service_cidr = service_cidr - - -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 - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = 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 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}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "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 OpenShiftCluster(TrackedResource): # pylint: disable=too-many-instance-attributes - """OpenShiftCluster represents an Azure Red Hat OpenShift cluster. - - 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 tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar provisioning_state: The cluster provisioning state (immutable). Known values are: - "AdminUpdating", "Creating", "Deleting", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.redhatopenshift.v2020_04_30.models.ProvisioningState - :ivar cluster_profile: The cluster profile. - :vartype cluster_profile: ~azure.mgmt.redhatopenshift.v2020_04_30.models.ClusterProfile - :ivar console_profile: The console profile. - :vartype console_profile: ~azure.mgmt.redhatopenshift.v2020_04_30.models.ConsoleProfile - :ivar service_principal_profile: The cluster service principal profile. - :vartype service_principal_profile: - ~azure.mgmt.redhatopenshift.v2020_04_30.models.ServicePrincipalProfile - :ivar network_profile: The cluster network profile. - :vartype network_profile: ~azure.mgmt.redhatopenshift.v2020_04_30.models.NetworkProfile - :ivar master_profile: The cluster master profile. - :vartype master_profile: ~azure.mgmt.redhatopenshift.v2020_04_30.models.MasterProfile - :ivar worker_profiles: The cluster worker profiles. - :vartype worker_profiles: list[~azure.mgmt.redhatopenshift.v2020_04_30.models.WorkerProfile] - :ivar apiserver_profile: The cluster API server profile. - :vartype apiserver_profile: ~azure.mgmt.redhatopenshift.v2020_04_30.models.APIServerProfile - :ivar ingress_profiles: The cluster ingress profiles. - :vartype ingress_profiles: list[~azure.mgmt.redhatopenshift.v2020_04_30.models.IngressProfile] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "cluster_profile": {"key": "properties.clusterProfile", "type": "ClusterProfile"}, - "console_profile": {"key": "properties.consoleProfile", "type": "ConsoleProfile"}, - "service_principal_profile": {"key": "properties.servicePrincipalProfile", "type": "ServicePrincipalProfile"}, - "network_profile": {"key": "properties.networkProfile", "type": "NetworkProfile"}, - "master_profile": {"key": "properties.masterProfile", "type": "MasterProfile"}, - "worker_profiles": {"key": "properties.workerProfiles", "type": "[WorkerProfile]"}, - "apiserver_profile": {"key": "properties.apiserverProfile", "type": "APIServerProfile"}, - "ingress_profiles": {"key": "properties.ingressProfiles", "type": "[IngressProfile]"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, - cluster_profile: Optional["_models.ClusterProfile"] = None, - console_profile: Optional["_models.ConsoleProfile"] = None, - service_principal_profile: Optional["_models.ServicePrincipalProfile"] = None, - network_profile: Optional["_models.NetworkProfile"] = None, - master_profile: Optional["_models.MasterProfile"] = None, - worker_profiles: Optional[List["_models.WorkerProfile"]] = None, - apiserver_profile: Optional["_models.APIServerProfile"] = None, - ingress_profiles: Optional[List["_models.IngressProfile"]] = 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 provisioning_state: The cluster provisioning state (immutable). Known values are: - "AdminUpdating", "Creating", "Deleting", "Failed", "Succeeded", and "Updating". - :paramtype provisioning_state: str or - ~azure.mgmt.redhatopenshift.v2020_04_30.models.ProvisioningState - :keyword cluster_profile: The cluster profile. - :paramtype cluster_profile: ~azure.mgmt.redhatopenshift.v2020_04_30.models.ClusterProfile - :keyword console_profile: The console profile. - :paramtype console_profile: ~azure.mgmt.redhatopenshift.v2020_04_30.models.ConsoleProfile - :keyword service_principal_profile: The cluster service principal profile. - :paramtype service_principal_profile: - ~azure.mgmt.redhatopenshift.v2020_04_30.models.ServicePrincipalProfile - :keyword network_profile: The cluster network profile. - :paramtype network_profile: ~azure.mgmt.redhatopenshift.v2020_04_30.models.NetworkProfile - :keyword master_profile: The cluster master profile. - :paramtype master_profile: ~azure.mgmt.redhatopenshift.v2020_04_30.models.MasterProfile - :keyword worker_profiles: The cluster worker profiles. - :paramtype worker_profiles: list[~azure.mgmt.redhatopenshift.v2020_04_30.models.WorkerProfile] - :keyword apiserver_profile: The cluster API server profile. - :paramtype apiserver_profile: ~azure.mgmt.redhatopenshift.v2020_04_30.models.APIServerProfile - :keyword ingress_profiles: The cluster ingress profiles. - :paramtype ingress_profiles: - list[~azure.mgmt.redhatopenshift.v2020_04_30.models.IngressProfile] - """ - super().__init__(tags=tags, location=location, **kwargs) - self.provisioning_state = provisioning_state - self.cluster_profile = cluster_profile - self.console_profile = console_profile - self.service_principal_profile = service_principal_profile - self.network_profile = network_profile - self.master_profile = master_profile - self.worker_profiles = worker_profiles - self.apiserver_profile = apiserver_profile - self.ingress_profiles = ingress_profiles - - -class OpenShiftClusterCredentials(_serialization.Model): - """OpenShiftClusterCredentials represents an OpenShift cluster's credentials. - - :ivar kubeadmin_username: The username for the kubeadmin user. - :vartype kubeadmin_username: str - :ivar kubeadmin_password: The password for the kubeadmin user. - :vartype kubeadmin_password: str - """ - - _attribute_map = { - "kubeadmin_username": {"key": "kubeadminUsername", "type": "str"}, - "kubeadmin_password": {"key": "kubeadminPassword", "type": "str"}, - } - - def __init__( - self, *, kubeadmin_username: Optional[str] = None, kubeadmin_password: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword kubeadmin_username: The username for the kubeadmin user. - :paramtype kubeadmin_username: str - :keyword kubeadmin_password: The password for the kubeadmin user. - :paramtype kubeadmin_password: str - """ - super().__init__(**kwargs) - self.kubeadmin_username = kubeadmin_username - self.kubeadmin_password = kubeadmin_password - - -class OpenShiftClusterList(_serialization.Model): - """OpenShiftClusterList represents a list of OpenShift clusters. - - :ivar value: The list of OpenShift clusters. - :vartype value: list[~azure.mgmt.redhatopenshift.v2020_04_30.models.OpenShiftCluster] - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[OpenShiftCluster]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.OpenShiftCluster"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The list of OpenShift clusters. - :paramtype value: list[~azure.mgmt.redhatopenshift.v2020_04_30.models.OpenShiftCluster] - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class OpenShiftClusterUpdate(_serialization.Model): - """OpenShiftCluster represents an Azure Red Hat OpenShift cluster. - - :ivar tags: The resource tags. - :vartype tags: dict[str, str] - :ivar provisioning_state: The cluster provisioning state (immutable). Known values are: - "AdminUpdating", "Creating", "Deleting", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.redhatopenshift.v2020_04_30.models.ProvisioningState - :ivar cluster_profile: The cluster profile. - :vartype cluster_profile: ~azure.mgmt.redhatopenshift.v2020_04_30.models.ClusterProfile - :ivar console_profile: The console profile. - :vartype console_profile: ~azure.mgmt.redhatopenshift.v2020_04_30.models.ConsoleProfile - :ivar service_principal_profile: The cluster service principal profile. - :vartype service_principal_profile: - ~azure.mgmt.redhatopenshift.v2020_04_30.models.ServicePrincipalProfile - :ivar network_profile: The cluster network profile. - :vartype network_profile: ~azure.mgmt.redhatopenshift.v2020_04_30.models.NetworkProfile - :ivar master_profile: The cluster master profile. - :vartype master_profile: ~azure.mgmt.redhatopenshift.v2020_04_30.models.MasterProfile - :ivar worker_profiles: The cluster worker profiles. - :vartype worker_profiles: list[~azure.mgmt.redhatopenshift.v2020_04_30.models.WorkerProfile] - :ivar apiserver_profile: The cluster API server profile. - :vartype apiserver_profile: ~azure.mgmt.redhatopenshift.v2020_04_30.models.APIServerProfile - :ivar ingress_profiles: The cluster ingress profiles. - :vartype ingress_profiles: list[~azure.mgmt.redhatopenshift.v2020_04_30.models.IngressProfile] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "cluster_profile": {"key": "properties.clusterProfile", "type": "ClusterProfile"}, - "console_profile": {"key": "properties.consoleProfile", "type": "ConsoleProfile"}, - "service_principal_profile": {"key": "properties.servicePrincipalProfile", "type": "ServicePrincipalProfile"}, - "network_profile": {"key": "properties.networkProfile", "type": "NetworkProfile"}, - "master_profile": {"key": "properties.masterProfile", "type": "MasterProfile"}, - "worker_profiles": {"key": "properties.workerProfiles", "type": "[WorkerProfile]"}, - "apiserver_profile": {"key": "properties.apiserverProfile", "type": "APIServerProfile"}, - "ingress_profiles": {"key": "properties.ingressProfiles", "type": "[IngressProfile]"}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, - cluster_profile: Optional["_models.ClusterProfile"] = None, - console_profile: Optional["_models.ConsoleProfile"] = None, - service_principal_profile: Optional["_models.ServicePrincipalProfile"] = None, - network_profile: Optional["_models.NetworkProfile"] = None, - master_profile: Optional["_models.MasterProfile"] = None, - worker_profiles: Optional[List["_models.WorkerProfile"]] = None, - apiserver_profile: Optional["_models.APIServerProfile"] = None, - ingress_profiles: Optional[List["_models.IngressProfile"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: The resource tags. - :paramtype tags: dict[str, str] - :keyword provisioning_state: The cluster provisioning state (immutable). Known values are: - "AdminUpdating", "Creating", "Deleting", "Failed", "Succeeded", and "Updating". - :paramtype provisioning_state: str or - ~azure.mgmt.redhatopenshift.v2020_04_30.models.ProvisioningState - :keyword cluster_profile: The cluster profile. - :paramtype cluster_profile: ~azure.mgmt.redhatopenshift.v2020_04_30.models.ClusterProfile - :keyword console_profile: The console profile. - :paramtype console_profile: ~azure.mgmt.redhatopenshift.v2020_04_30.models.ConsoleProfile - :keyword service_principal_profile: The cluster service principal profile. - :paramtype service_principal_profile: - ~azure.mgmt.redhatopenshift.v2020_04_30.models.ServicePrincipalProfile - :keyword network_profile: The cluster network profile. - :paramtype network_profile: ~azure.mgmt.redhatopenshift.v2020_04_30.models.NetworkProfile - :keyword master_profile: The cluster master profile. - :paramtype master_profile: ~azure.mgmt.redhatopenshift.v2020_04_30.models.MasterProfile - :keyword worker_profiles: The cluster worker profiles. - :paramtype worker_profiles: list[~azure.mgmt.redhatopenshift.v2020_04_30.models.WorkerProfile] - :keyword apiserver_profile: The cluster API server profile. - :paramtype apiserver_profile: ~azure.mgmt.redhatopenshift.v2020_04_30.models.APIServerProfile - :keyword ingress_profiles: The cluster ingress profiles. - :paramtype ingress_profiles: - list[~azure.mgmt.redhatopenshift.v2020_04_30.models.IngressProfile] - """ - super().__init__(**kwargs) - self.tags = tags - self.provisioning_state = provisioning_state - self.cluster_profile = cluster_profile - self.console_profile = console_profile - self.service_principal_profile = service_principal_profile - self.network_profile = network_profile - self.master_profile = master_profile - self.worker_profiles = worker_profiles - self.apiserver_profile = apiserver_profile - self.ingress_profiles = ingress_profiles - - -class Operation(_serialization.Model): - """Operation represents an RP operation. - - :ivar name: Operation name: {provider}/{resource}/{operation}. - :vartype name: str - :ivar display: The object that describes the operation. - :vartype display: ~azure.mgmt.redhatopenshift.v2020_04_30.models.Display - :ivar origin: Sources of requests to this operation. Comma separated list with valid values - user or system, e.g. "user,system". - :vartype origin: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "display": {"key": "display", "type": "Display"}, - "origin": {"key": "origin", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - display: Optional["_models.Display"] = None, - origin: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Operation name: {provider}/{resource}/{operation}. - :paramtype name: str - :keyword display: The object that describes the operation. - :paramtype display: ~azure.mgmt.redhatopenshift.v2020_04_30.models.Display - :keyword origin: Sources of requests to this operation. Comma separated list with valid values - user or system, e.g. "user,system". - :paramtype origin: str - """ - super().__init__(**kwargs) - self.name = name - self.display = display - self.origin = origin - - -class OperationList(_serialization.Model): - """OperationList represents an RP operation list. - - :ivar value: List of operations supported by the resource provider. - :vartype value: list[~azure.mgmt.redhatopenshift.v2020_04_30.models.Operation] - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Operation]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: List of operations supported by the resource provider. - :paramtype value: list[~azure.mgmt.redhatopenshift.v2020_04_30.models.Operation] - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServicePrincipalProfile(_serialization.Model): - """ServicePrincipalProfile represents a service principal profile. - - :ivar client_id: The client ID used for the cluster (immutable). - :vartype client_id: str - :ivar client_secret: The client secret used for the cluster (immutable). - :vartype client_secret: str - """ - - _attribute_map = { - "client_id": {"key": "clientId", "type": "str"}, - "client_secret": {"key": "clientSecret", "type": "str"}, - } - - def __init__(self, *, client_id: Optional[str] = None, client_secret: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword client_id: The client ID used for the cluster (immutable). - :paramtype client_id: str - :keyword client_secret: The client secret used for the cluster (immutable). - :paramtype client_secret: str - """ - super().__init__(**kwargs) - self.client_id = client_id - self.client_secret = client_secret - - -class WorkerProfile(_serialization.Model): - """WorkerProfile represents a worker profile. - - :ivar name: The worker profile name. Must be "worker" (immutable). - :vartype name: str - :ivar vm_size: The size of the worker VMs (immutable). Known values are: "Standard_D2s_v3", - "Standard_D4s_v3", and "Standard_D8s_v3". - :vartype vm_size: str or ~azure.mgmt.redhatopenshift.v2020_04_30.models.VMSize - :ivar disk_size_gb: The disk size of the worker VMs. Must be 128 or greater (immutable). - :vartype disk_size_gb: int - :ivar subnet_id: The Azure resource ID of the worker subnet (immutable). - :vartype subnet_id: str - :ivar count: The number of worker VMs. Must be between 3 and 20 (immutable). - :vartype count: int - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "vm_size": {"key": "vmSize", "type": "str"}, - "disk_size_gb": {"key": "diskSizeGB", "type": "int"}, - "subnet_id": {"key": "subnetId", "type": "str"}, - "count": {"key": "count", "type": "int"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - vm_size: Optional[Union[str, "_models.VMSize"]] = None, - disk_size_gb: Optional[int] = None, - subnet_id: Optional[str] = None, - count: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The worker profile name. Must be "worker" (immutable). - :paramtype name: str - :keyword vm_size: The size of the worker VMs (immutable). Known values are: "Standard_D2s_v3", - "Standard_D4s_v3", and "Standard_D8s_v3". - :paramtype vm_size: str or ~azure.mgmt.redhatopenshift.v2020_04_30.models.VMSize - :keyword disk_size_gb: The disk size of the worker VMs. Must be 128 or greater (immutable). - :paramtype disk_size_gb: int - :keyword subnet_id: The Azure resource ID of the worker subnet (immutable). - :paramtype subnet_id: str - :keyword count: The number of worker VMs. Must be between 3 and 20 (immutable). - :paramtype count: int - """ - super().__init__(**kwargs) - self.name = name - self.vm_size = vm_size - self.disk_size_gb = disk_size_gb - self.subnet_id = subnet_id - self.count = count diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/operations/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/operations/__init__.py deleted file mode 100644 index 70ea64711791..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/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 ._operations import Operations -from ._open_shift_clusters_operations import OpenShiftClustersOperations - -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", - "OpenShiftClustersOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/operations/_open_shift_clusters_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/operations/_open_shift_clusters_operations.py deleted file mode 100644 index 8c67b1a3dffd..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/operations/_open_shift_clusters_operations.py +++ /dev/null @@ -1,1075 +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, - 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_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", "2020-04-30")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.RedHatOpenShift/openShiftClusters" - ) # pylint: disable=line-too-long - 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", "2020-04-30")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("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, resource_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", "2020-04-30")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _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, resource_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", "2020-04-30")) - 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.RedHatOpenShift/openShiftClusters/{resourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, resource_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", "2020-04-30")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, resource_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", "2020-04-30")) - 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.RedHatOpenShift/openShiftClusters/{resourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_credentials_request( - resource_group_name: str, resource_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", "2020-04-30")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}/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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _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 OpenShiftClustersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2020_04_30.AzureRedHatOpenShift4Client`'s - :attr:`open_shift_clusters` 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.OpenShiftCluster"]: - """Lists OpenShift clusters in the specified subscription. - - The operation returns properties of each OpenShift cluster. - - :return: An iterator like instance of either OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2020_04_30.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-30")) - cls: ClsType[_models.OpenShiftClusterList] = 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("OpenShiftClusterList", 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) - raise HttpResponseError(response=response, 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.OpenShiftCluster"]: - """Lists OpenShift clusters in the specified subscription and resource group. - - The operation returns properties of each OpenShift cluster. - - :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 OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2020_04_30.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-30")) - cls: ClsType[_models.OpenShiftClusterList] = 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("OpenShiftClusterList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.OpenShiftCluster: - """Gets a OpenShift cluster with the specified subscription, resource group and resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: OpenShiftCluster or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2020_04_30.models.OpenShiftCluster - :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 "2020-04-30")) - cls: ClsType[_models.OpenShiftCluster] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenShiftCluster", 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, - resource_name: str, - parameters: Union[_models.OpenShiftCluster, IO[bytes]], - **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 "2020-04-30")) - 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, "OpenShiftCluster") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - 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 = 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]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.OpenShiftCluster, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2020_04_30.models.OpenShiftCluster - :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 OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2020_04_30.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :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: An instance of LROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2020_04_30.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - parameters: Union[_models.OpenShiftCluster, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a OpenShiftCluster type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2020_04_30.models.OpenShiftCluster or IO[bytes] - :return: An instance of LROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2020_04_30.models.OpenShiftCluster] - :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 "2020-04-30")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OpenShiftCluster] = 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, - resource_name=resource_name, - parameters=parameters, - 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("OpenShiftCluster", 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.OpenShiftCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OpenShiftCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, resource_name: str, **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 "2020-04-30")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes a OpenShift cluster with the specified subscription, resource group and resource name. - - The operation returns nothing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: 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 "2020-04-30")) - 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, - resource_name=resource_name, - 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, **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 _update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: Union[_models.OpenShiftClusterUpdate, IO[bytes]], - **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 "2020-04-30")) - 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, "OpenShiftClusterUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - 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 = 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]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.OpenShiftClusterUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2020_04_30.models.OpenShiftClusterUpdate - :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 OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2020_04_30.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :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: An instance of LROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2020_04_30.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - resource_name: str, - parameters: Union[_models.OpenShiftClusterUpdate, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a OpenShiftClusterUpdate type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2020_04_30.models.OpenShiftClusterUpdate or - IO[bytes] - :return: An instance of LROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2020_04_30.models.OpenShiftCluster] - :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 "2020-04-30")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OpenShiftCluster] = 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, - resource_name=resource_name, - parameters=parameters, - 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("OpenShiftCluster", 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.OpenShiftCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OpenShiftCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_credentials( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.OpenShiftClusterCredentials: - """Lists credentials of an OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns the credentials. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: OpenShiftClusterCredentials or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2020_04_30.models.OpenShiftClusterCredentials - :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 "2020-04-30")) - cls: ClsType[_models.OpenShiftClusterCredentials] = kwargs.pop("cls", None) - - _request = build_list_credentials_request( - resource_group_name=resource_group_name, - resource_name=resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenShiftClusterCredentials", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/operations/_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/operations/_operations.py deleted file mode 100644 index b123302fad75..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/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", "2020-04-30")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.RedHatOpenShift/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.redhatopenshift.v2020_04_30.AzureRedHatOpenShift4Client`'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"]: - """Lists all of the available RP operations. - - The operation returns the RP operations. - - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2020_04_30.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 "2020-04-30")) - cls: ClsType[_models.OperationList] = 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("OperationList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/py.typed b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2020_04_30/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/__init__.py deleted file mode 100644 index c64163c98d3d..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_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 ._azure_red_hat_open_shift_client import AzureRedHatOpenShiftClient -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__ = [ - "AzureRedHatOpenShiftClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/_azure_red_hat_open_shift_client.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/_azure_red_hat_open_shift_client.py deleted file mode 100644 index a080b5dcbc7d..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/_azure_red_hat_open_shift_client.py +++ /dev/null @@ -1,120 +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 AzureRedHatOpenShiftClientConfiguration -from .operations import OpenShiftClustersOperations, Operations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class AzureRedHatOpenShiftClient: # pylint: disable=client-accepts-api-version-keyword - """Rest API for Azure Red Hat OpenShift 4. - - :ivar operations: Operations operations - :vartype operations: azure.mgmt.redhatopenshift.v2021_09_01_preview.operations.Operations - :ivar open_shift_clusters: OpenShiftClustersOperations operations - :vartype open_shift_clusters: - azure.mgmt.redhatopenshift.v2021_09_01_preview.operations.OpenShiftClustersOperations - :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 "2021-09-01-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 = AzureRedHatOpenShiftClientConfiguration( - 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, "2021-09-01-preview" - ) - self.open_shift_clusters = OpenShiftClustersOperations( - self._client, self._config, self._serialize, self._deserialize, "2021-09-01-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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/_configuration.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/_configuration.py deleted file mode 100644 index 2934493ae671..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_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 AzureRedHatOpenShiftClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for AzureRedHatOpenShiftClient. - - 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 "2021-09-01-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", "2021-09-01-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-redhatopenshift/{}".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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/_metadata.json b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/_metadata.json deleted file mode 100644 index 5444f7fe616c..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/_metadata.json +++ /dev/null @@ -1,111 +0,0 @@ -{ - "chosen_version": "2021-09-01-preview", - "total_api_version_list": ["2021-09-01-preview"], - "client": { - "name": "AzureRedHatOpenShiftClient", - "filename": "_azure_red_hat_open_shift_client", - "description": "Rest API for Azure Red Hat OpenShift 4.", - "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\": [\"AzureRedHatOpenShiftClientConfiguration\"], \".._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\": [\"AzureRedHatOpenShiftClientConfiguration\"], \"..._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", - "open_shift_clusters": "OpenShiftClustersOperations" - } -} diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/_patch.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/_patch.py deleted file mode 100644 index 17dbc073e01b..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/_patch.py +++ /dev/null @@ -1,32 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/_version.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/_version.py deleted file mode 100644 index b2efd13ce94d..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_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 = "1.5.0" diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/aio/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/aio/__init__.py deleted file mode 100644 index b06f0016da77..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_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 ._azure_red_hat_open_shift_client import AzureRedHatOpenShiftClient - -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__ = [ - "AzureRedHatOpenShiftClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/aio/_azure_red_hat_open_shift_client.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/aio/_azure_red_hat_open_shift_client.py deleted file mode 100644 index 8b07e1466a27..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/aio/_azure_red_hat_open_shift_client.py +++ /dev/null @@ -1,122 +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 AzureRedHatOpenShiftClientConfiguration -from .operations import OpenShiftClustersOperations, Operations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class AzureRedHatOpenShiftClient: # pylint: disable=client-accepts-api-version-keyword - """Rest API for Azure Red Hat OpenShift 4. - - :ivar operations: Operations operations - :vartype operations: azure.mgmt.redhatopenshift.v2021_09_01_preview.aio.operations.Operations - :ivar open_shift_clusters: OpenShiftClustersOperations operations - :vartype open_shift_clusters: - azure.mgmt.redhatopenshift.v2021_09_01_preview.aio.operations.OpenShiftClustersOperations - :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 "2021-09-01-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 = AzureRedHatOpenShiftClientConfiguration( - 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, "2021-09-01-preview" - ) - self.open_shift_clusters = OpenShiftClustersOperations( - self._client, self._config, self._serialize, self._deserialize, "2021-09-01-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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/aio/_configuration.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/aio/_configuration.py deleted file mode 100644 index 106c00c06955..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_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 AzureRedHatOpenShiftClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for AzureRedHatOpenShiftClient. - - 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 "2021-09-01-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", "2021-09-01-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-redhatopenshift/{}".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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/aio/_patch.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/aio/_patch.py deleted file mode 100644 index 17dbc073e01b..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/aio/_patch.py +++ /dev/null @@ -1,32 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/aio/operations/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/aio/operations/__init__.py deleted file mode 100644 index 70ea64711791..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_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 ._operations import Operations -from ._open_shift_clusters_operations import OpenShiftClustersOperations - -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", - "OpenShiftClustersOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/aio/operations/_open_shift_clusters_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/aio/operations/_open_shift_clusters_operations.py deleted file mode 100644 index 99092d7cb22f..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/aio/operations/_open_shift_clusters_operations.py +++ /dev/null @@ -1,944 +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, - 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._open_shift_clusters_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_admin_credentials_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 OpenShiftClustersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2021_09_01_preview.aio.AzureRedHatOpenShiftClient`'s - :attr:`open_shift_clusters` 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.OpenShiftCluster"]: - """Lists OpenShift clusters in the specified subscription. - - The operation returns properties of each OpenShift cluster. - - :return: An iterator like instance of either OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.OpenShiftClusterList] = 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("OpenShiftClusterList", 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) - raise HttpResponseError(response=response, 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.OpenShiftCluster"]: - """Lists OpenShift clusters in the specified subscription and resource group. - - The operation returns properties of each OpenShift cluster. - - :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 OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.OpenShiftClusterList] = 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("OpenShiftClusterList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.OpenShiftCluster: - """Gets a OpenShift cluster with the specified subscription, resource group and resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: OpenShiftCluster or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftCluster - :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 "2021-09-01-preview") - ) - cls: ClsType[_models.OpenShiftCluster] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenShiftCluster", 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, - resource_name: str, - parameters: Union[_models.OpenShiftCluster, IO[bytes]], - **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 "2021-09-01-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, "OpenShiftCluster") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - 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 = 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]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - 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, - resource_name: str, - parameters: _models.OpenShiftCluster, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftCluster - :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 OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :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: An instance of AsyncLROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - parameters: Union[_models.OpenShiftCluster, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a OpenShiftCluster type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftCluster or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftCluster] - :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 "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OpenShiftCluster] = 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, - resource_name=resource_name, - parameters=parameters, - 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("OpenShiftCluster", 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.OpenShiftCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OpenShiftCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, resource_name: str, **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 "2021-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - 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, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Deletes a OpenShift cluster with the specified subscription, resource group and resource name. - - The operation returns nothing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: 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 "2021-09-01-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, - resource_name=resource_name, - 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, **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 _update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: Union[_models.OpenShiftClusterUpdate, IO[bytes]], - **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 "2021-09-01-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, "OpenShiftClusterUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - 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 = 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]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.OpenShiftClusterUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftClusterUpdate - :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 OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :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: An instance of AsyncLROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - resource_name: str, - parameters: Union[_models.OpenShiftClusterUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a OpenShiftClusterUpdate type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftClusterUpdate - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftCluster] - :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 "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OpenShiftCluster] = 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, - resource_name=resource_name, - parameters=parameters, - 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("OpenShiftCluster", 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.OpenShiftCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OpenShiftCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace_async - async def list_admin_credentials( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.OpenShiftClusterAdminKubeconfig: - """Lists admin kubeconfig of an OpenShift cluster with the specified subscription, resource group - and resource name. - - The operation returns the admin kubeconfig. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: OpenShiftClusterAdminKubeconfig or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftClusterAdminKubeconfig - :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 "2021-09-01-preview") - ) - cls: ClsType[_models.OpenShiftClusterAdminKubeconfig] = kwargs.pop("cls", None) - - _request = build_list_admin_credentials_request( - resource_group_name=resource_group_name, - resource_name=resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenShiftClusterAdminKubeconfig", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def list_credentials( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.OpenShiftClusterCredentials: - """Lists credentials of an OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns the credentials. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: OpenShiftClusterCredentials or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftClusterCredentials - :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 "2021-09-01-preview") - ) - cls: ClsType[_models.OpenShiftClusterCredentials] = kwargs.pop("cls", None) - - _request = build_list_credentials_request( - resource_group_name=resource_group_name, - resource_name=resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenShiftClusterCredentials", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/aio/operations/_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/aio/operations/_operations.py deleted file mode 100644 index b6a872e8155f..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/aio/operations/_operations.py +++ /dev/null @@ -1,135 +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.redhatopenshift.v2021_09_01_preview.aio.AzureRedHatOpenShiftClient`'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"]: - """Lists all of the available RP operations. - - The operation returns the RP operations. - - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2021_09_01_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 "2021-09-01-preview") - ) - cls: ClsType[_models.OperationList] = 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("OperationList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/models/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/models/__init__.py deleted file mode 100644 index cc65ebeef995..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/models/__init__.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 ._models_py3 import APIServerProfile -from ._models_py3 import CloudErrorBody -from ._models_py3 import ClusterProfile -from ._models_py3 import ConsoleProfile -from ._models_py3 import Display -from ._models_py3 import IngressProfile -from ._models_py3 import MasterProfile -from ._models_py3 import NetworkProfile -from ._models_py3 import OpenShiftCluster -from ._models_py3 import OpenShiftClusterAdminKubeconfig -from ._models_py3 import OpenShiftClusterCredentials -from ._models_py3 import OpenShiftClusterList -from ._models_py3 import OpenShiftClusterUpdate -from ._models_py3 import Operation -from ._models_py3 import OperationList -from ._models_py3 import Resource -from ._models_py3 import ServicePrincipalProfile -from ._models_py3 import SystemData -from ._models_py3 import TrackedResource -from ._models_py3 import WorkerProfile - -from ._azure_red_hat_open_shift_client_enums import CreatedByType -from ._azure_red_hat_open_shift_client_enums import EncryptionAtHost -from ._azure_red_hat_open_shift_client_enums import ProvisioningState -from ._azure_red_hat_open_shift_client_enums import SoftwareDefinedNetwork -from ._azure_red_hat_open_shift_client_enums import VMSize -from ._azure_red_hat_open_shift_client_enums import Visibility -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "APIServerProfile", - "CloudErrorBody", - "ClusterProfile", - "ConsoleProfile", - "Display", - "IngressProfile", - "MasterProfile", - "NetworkProfile", - "OpenShiftCluster", - "OpenShiftClusterAdminKubeconfig", - "OpenShiftClusterCredentials", - "OpenShiftClusterList", - "OpenShiftClusterUpdate", - "Operation", - "OperationList", - "Resource", - "ServicePrincipalProfile", - "SystemData", - "TrackedResource", - "WorkerProfile", - "CreatedByType", - "EncryptionAtHost", - "ProvisioningState", - "SoftwareDefinedNetwork", - "VMSize", - "Visibility", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/models/_azure_red_hat_open_shift_client_enums.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/models/_azure_red_hat_open_shift_client_enums.py deleted file mode 100644 index 6e7d46b1c503..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/models/_azure_red_hat_open_shift_client_enums.py +++ /dev/null @@ -1,79 +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 EncryptionAtHost(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """EncryptionAtHost represents encryption at host state.""" - - DISABLED = "Disabled" - ENABLED = "Enabled" - - -class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ProvisioningState represents a provisioning state.""" - - ADMIN_UPDATING = "AdminUpdating" - CREATING = "Creating" - DELETING = "Deleting" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class SoftwareDefinedNetwork(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """SoftwareDefinedNetwork constants.""" - - OVN_KUBERNETES = "OVNKubernetes" - OPEN_SHIFT_SDN = "OpenShiftSDN" - - -class Visibility(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Visibility represents visibility.""" - - PRIVATE = "Private" - PUBLIC = "Public" - - -class VMSize(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """VMSize represents a VM size.""" - - STANDARD_D16_AS_V4 = "Standard_D16as_v4" - STANDARD_D16_S_V3 = "Standard_D16s_v3" - STANDARD_D2_S_V3 = "Standard_D2s_v3" - STANDARD_D32_AS_V4 = "Standard_D32as_v4" - STANDARD_D32_S_V3 = "Standard_D32s_v3" - STANDARD_D4_AS_V4 = "Standard_D4as_v4" - STANDARD_D4_S_V3 = "Standard_D4s_v3" - STANDARD_D8_AS_V4 = "Standard_D8as_v4" - STANDARD_D8_S_V3 = "Standard_D8s_v3" - STANDARD_E16_S_V3 = "Standard_E16s_v3" - STANDARD_E32_S_V3 = "Standard_E32s_v3" - STANDARD_E4_S_V3 = "Standard_E4s_v3" - STANDARD_E64_I_V3 = "Standard_E64i_v3" - STANDARD_E64_IS_V3 = "Standard_E64is_v3" - STANDARD_E8_S_V3 = "Standard_E8s_v3" - STANDARD_F16_S_V2 = "Standard_F16s_v2" - STANDARD_F32_S_V2 = "Standard_F32s_v2" - STANDARD_F4_S_V2 = "Standard_F4s_v2" - STANDARD_F72_S_V2 = "Standard_F72s_v2" - STANDARD_F8_S_V2 = "Standard_F8s_v2" - STANDARD_G5 = "Standard_G5" - STANDARD_GS5 = "Standard_GS5" - STANDARD_M128_MS = "Standard_M128ms" diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/models/_models_py3.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/models/_models_py3.py deleted file mode 100644 index 4a293e70ef63..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/models/_models_py3.py +++ /dev/null @@ -1,1026 +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 APIServerProfile(_serialization.Model): - """APIServerProfile represents an API server profile. - - :ivar visibility: API server visibility. Known values are: "Private" and "Public". - :vartype visibility: str or ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.Visibility - :ivar url: The URL to access the cluster API server. - :vartype url: str - :ivar ip: The IP of the cluster API server. - :vartype ip: str - """ - - _attribute_map = { - "visibility": {"key": "visibility", "type": "str"}, - "url": {"key": "url", "type": "str"}, - "ip": {"key": "ip", "type": "str"}, - } - - def __init__( - self, - *, - visibility: Optional[Union[str, "_models.Visibility"]] = None, - url: Optional[str] = None, - ip: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword visibility: API server visibility. Known values are: "Private" and "Public". - :paramtype visibility: str or ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.Visibility - :keyword url: The URL to access the cluster API server. - :paramtype url: str - :keyword ip: The IP of the cluster API server. - :paramtype ip: str - """ - super().__init__(**kwargs) - self.visibility = visibility - self.url = url - self.ip = ip - - -class CloudErrorBody(_serialization.Model): - """CloudErrorBody represents the body of a cloud error. - - :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :vartype code: str - :ivar message: A message describing the error, intended to be suitable for display in a user - interface. - :vartype message: str - :ivar target: The target of the particular error. For example, the name of the property in - error. - :vartype target: str - :ivar details: A list of additional details about the error. - :vartype details: list[~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.CloudErrorBody] - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[CloudErrorBody]"}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[List["_models.CloudErrorBody"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :paramtype code: str - :keyword message: A message describing the error, intended to be suitable for display in a user - interface. - :paramtype message: str - :keyword target: The target of the particular error. For example, the name of the property in - error. - :paramtype target: str - :keyword details: A list of additional details about the error. - :paramtype details: list[~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.CloudErrorBody] - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - -class ClusterProfile(_serialization.Model): - """ClusterProfile represents a cluster profile. - - :ivar pull_secret: The pull secret for the cluster. - :vartype pull_secret: str - :ivar domain: The domain for the cluster. - :vartype domain: str - :ivar version: The version of the cluster. - :vartype version: str - :ivar resource_group_id: The ID of the cluster resource group. - :vartype resource_group_id: str - """ - - _attribute_map = { - "pull_secret": {"key": "pullSecret", "type": "str"}, - "domain": {"key": "domain", "type": "str"}, - "version": {"key": "version", "type": "str"}, - "resource_group_id": {"key": "resourceGroupId", "type": "str"}, - } - - def __init__( - self, - *, - pull_secret: Optional[str] = None, - domain: Optional[str] = None, - version: Optional[str] = None, - resource_group_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword pull_secret: The pull secret for the cluster. - :paramtype pull_secret: str - :keyword domain: The domain for the cluster. - :paramtype domain: str - :keyword version: The version of the cluster. - :paramtype version: str - :keyword resource_group_id: The ID of the cluster resource group. - :paramtype resource_group_id: str - """ - super().__init__(**kwargs) - self.pull_secret = pull_secret - self.domain = domain - self.version = version - self.resource_group_id = resource_group_id - - -class ConsoleProfile(_serialization.Model): - """ConsoleProfile represents a console profile. - - :ivar url: The URL to access the cluster console. - :vartype url: str - """ - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - } - - def __init__(self, *, url: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword url: The URL to access the cluster console. - :paramtype url: str - """ - super().__init__(**kwargs) - self.url = url - - -class Display(_serialization.Model): - """Display represents the display details of an operation. - - :ivar provider: Friendly name of the resource provider. - :vartype provider: str - :ivar resource: Resource type on which the operation is performed. - :vartype resource: str - :ivar operation: Operation type: read, write, delete, listKeys/action, etc. - :vartype operation: str - :ivar description: Friendly name of the operation. - :vartype description: str - """ - - _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__( - self, - *, - provider: Optional[str] = None, - resource: Optional[str] = None, - operation: Optional[str] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword provider: Friendly name of the resource provider. - :paramtype provider: str - :keyword resource: Resource type on which the operation is performed. - :paramtype resource: str - :keyword operation: Operation type: read, write, delete, listKeys/action, etc. - :paramtype operation: str - :keyword description: Friendly name of the operation. - :paramtype description: str - """ - super().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class IngressProfile(_serialization.Model): - """IngressProfile represents an ingress profile. - - :ivar name: The ingress profile name. - :vartype name: str - :ivar visibility: Ingress visibility. Known values are: "Private" and "Public". - :vartype visibility: str or ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.Visibility - :ivar ip: The IP of the ingress. - :vartype ip: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "visibility": {"key": "visibility", "type": "str"}, - "ip": {"key": "ip", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - visibility: Optional[Union[str, "_models.Visibility"]] = None, - ip: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The ingress profile name. - :paramtype name: str - :keyword visibility: Ingress visibility. Known values are: "Private" and "Public". - :paramtype visibility: str or ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.Visibility - :keyword ip: The IP of the ingress. - :paramtype ip: str - """ - super().__init__(**kwargs) - self.name = name - self.visibility = visibility - self.ip = ip - - -class MasterProfile(_serialization.Model): - """MasterProfile represents a master profile. - - :ivar vm_size: The size of the master VMs. Known values are: "Standard_D16as_v4", - "Standard_D16s_v3", "Standard_D2s_v3", "Standard_D32as_v4", "Standard_D32s_v3", - "Standard_D4as_v4", "Standard_D4s_v3", "Standard_D8as_v4", "Standard_D8s_v3", - "Standard_E16s_v3", "Standard_E32s_v3", "Standard_E4s_v3", "Standard_E64i_v3", - "Standard_E64is_v3", "Standard_E8s_v3", "Standard_F16s_v2", "Standard_F32s_v2", - "Standard_F4s_v2", "Standard_F72s_v2", "Standard_F8s_v2", "Standard_G5", "Standard_GS5", and - "Standard_M128ms". - :vartype vm_size: str or ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.VMSize - :ivar subnet_id: The Azure resource ID of the master subnet. - :vartype subnet_id: str - :ivar encryption_at_host: Whether master virtual machines are encrypted at host. Known values - are: "Disabled" and "Enabled". - :vartype encryption_at_host: str or - ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.EncryptionAtHost - :ivar disk_encryption_set_id: The resource ID of an associated DiskEncryptionSet, if - applicable. - :vartype disk_encryption_set_id: str - """ - - _attribute_map = { - "vm_size": {"key": "vmSize", "type": "str"}, - "subnet_id": {"key": "subnetId", "type": "str"}, - "encryption_at_host": {"key": "encryptionAtHost", "type": "str"}, - "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, - } - - def __init__( - self, - *, - vm_size: Optional[Union[str, "_models.VMSize"]] = None, - subnet_id: Optional[str] = None, - encryption_at_host: Optional[Union[str, "_models.EncryptionAtHost"]] = None, - disk_encryption_set_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword vm_size: The size of the master VMs. Known values are: "Standard_D16as_v4", - "Standard_D16s_v3", "Standard_D2s_v3", "Standard_D32as_v4", "Standard_D32s_v3", - "Standard_D4as_v4", "Standard_D4s_v3", "Standard_D8as_v4", "Standard_D8s_v3", - "Standard_E16s_v3", "Standard_E32s_v3", "Standard_E4s_v3", "Standard_E64i_v3", - "Standard_E64is_v3", "Standard_E8s_v3", "Standard_F16s_v2", "Standard_F32s_v2", - "Standard_F4s_v2", "Standard_F72s_v2", "Standard_F8s_v2", "Standard_G5", "Standard_GS5", and - "Standard_M128ms". - :paramtype vm_size: str or ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.VMSize - :keyword subnet_id: The Azure resource ID of the master subnet. - :paramtype subnet_id: str - :keyword encryption_at_host: Whether master virtual machines are encrypted at host. Known - values are: "Disabled" and "Enabled". - :paramtype encryption_at_host: str or - ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.EncryptionAtHost - :keyword disk_encryption_set_id: The resource ID of an associated DiskEncryptionSet, if - applicable. - :paramtype disk_encryption_set_id: str - """ - super().__init__(**kwargs) - self.vm_size = vm_size - self.subnet_id = subnet_id - self.encryption_at_host = encryption_at_host - self.disk_encryption_set_id = disk_encryption_set_id - - -class NetworkProfile(_serialization.Model): - """NetworkProfile represents a network profile. - - :ivar software_defined_network: The software defined network (SDN) to use when installing the - cluster. Known values are: "OVNKubernetes" and "OpenShiftSDN". - :vartype software_defined_network: str or - ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.SoftwareDefinedNetwork - :ivar pod_cidr: The CIDR used for OpenShift/Kubernetes Pods. - :vartype pod_cidr: str - :ivar service_cidr: The CIDR used for OpenShift/Kubernetes Services. - :vartype service_cidr: str - """ - - _attribute_map = { - "software_defined_network": {"key": "softwareDefinedNetwork", "type": "str"}, - "pod_cidr": {"key": "podCidr", "type": "str"}, - "service_cidr": {"key": "serviceCidr", "type": "str"}, - } - - def __init__( - self, - *, - software_defined_network: Optional[Union[str, "_models.SoftwareDefinedNetwork"]] = None, - pod_cidr: Optional[str] = None, - service_cidr: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword software_defined_network: The software defined network (SDN) to use when installing - the cluster. Known values are: "OVNKubernetes" and "OpenShiftSDN". - :paramtype software_defined_network: str or - ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.SoftwareDefinedNetwork - :keyword pod_cidr: The CIDR used for OpenShift/Kubernetes Pods. - :paramtype pod_cidr: str - :keyword service_cidr: The CIDR used for OpenShift/Kubernetes Services. - :paramtype service_cidr: str - """ - super().__init__(**kwargs) - self.software_defined_network = software_defined_network - self.pod_cidr = pod_cidr - self.service_cidr = service_cidr - - -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 - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = 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 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}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "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 OpenShiftCluster(TrackedResource): # pylint: disable=too-many-instance-attributes - """OpenShiftCluster represents an Azure Red Hat OpenShift cluster. - - 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 tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.SystemData - :ivar provisioning_state: The cluster provisioning state. Known values are: "AdminUpdating", - "Creating", "Deleting", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.ProvisioningState - :ivar cluster_profile: The cluster profile. - :vartype cluster_profile: ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.ClusterProfile - :ivar console_profile: The console profile. - :vartype console_profile: ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.ConsoleProfile - :ivar service_principal_profile: The cluster service principal profile. - :vartype service_principal_profile: - ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.ServicePrincipalProfile - :ivar network_profile: The cluster network profile. - :vartype network_profile: ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.NetworkProfile - :ivar master_profile: The cluster master profile. - :vartype master_profile: ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.MasterProfile - :ivar worker_profiles: The cluster worker profiles. - :vartype worker_profiles: - list[~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.WorkerProfile] - :ivar apiserver_profile: The cluster API server profile. - :vartype apiserver_profile: - ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.APIServerProfile - :ivar ingress_profiles: The cluster ingress profiles. - :vartype ingress_profiles: - list[~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.IngressProfile] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "cluster_profile": {"key": "properties.clusterProfile", "type": "ClusterProfile"}, - "console_profile": {"key": "properties.consoleProfile", "type": "ConsoleProfile"}, - "service_principal_profile": {"key": "properties.servicePrincipalProfile", "type": "ServicePrincipalProfile"}, - "network_profile": {"key": "properties.networkProfile", "type": "NetworkProfile"}, - "master_profile": {"key": "properties.masterProfile", "type": "MasterProfile"}, - "worker_profiles": {"key": "properties.workerProfiles", "type": "[WorkerProfile]"}, - "apiserver_profile": {"key": "properties.apiserverProfile", "type": "APIServerProfile"}, - "ingress_profiles": {"key": "properties.ingressProfiles", "type": "[IngressProfile]"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, - cluster_profile: Optional["_models.ClusterProfile"] = None, - console_profile: Optional["_models.ConsoleProfile"] = None, - service_principal_profile: Optional["_models.ServicePrincipalProfile"] = None, - network_profile: Optional["_models.NetworkProfile"] = None, - master_profile: Optional["_models.MasterProfile"] = None, - worker_profiles: Optional[List["_models.WorkerProfile"]] = None, - apiserver_profile: Optional["_models.APIServerProfile"] = None, - ingress_profiles: Optional[List["_models.IngressProfile"]] = 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 provisioning_state: The cluster provisioning state. Known values are: "AdminUpdating", - "Creating", "Deleting", "Failed", "Succeeded", and "Updating". - :paramtype provisioning_state: str or - ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.ProvisioningState - :keyword cluster_profile: The cluster profile. - :paramtype cluster_profile: - ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.ClusterProfile - :keyword console_profile: The console profile. - :paramtype console_profile: - ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.ConsoleProfile - :keyword service_principal_profile: The cluster service principal profile. - :paramtype service_principal_profile: - ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.ServicePrincipalProfile - :keyword network_profile: The cluster network profile. - :paramtype network_profile: - ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.NetworkProfile - :keyword master_profile: The cluster master profile. - :paramtype master_profile: ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.MasterProfile - :keyword worker_profiles: The cluster worker profiles. - :paramtype worker_profiles: - list[~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.WorkerProfile] - :keyword apiserver_profile: The cluster API server profile. - :paramtype apiserver_profile: - ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.APIServerProfile - :keyword ingress_profiles: The cluster ingress profiles. - :paramtype ingress_profiles: - list[~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.IngressProfile] - """ - super().__init__(tags=tags, location=location, **kwargs) - self.system_data = None - self.provisioning_state = provisioning_state - self.cluster_profile = cluster_profile - self.console_profile = console_profile - self.service_principal_profile = service_principal_profile - self.network_profile = network_profile - self.master_profile = master_profile - self.worker_profiles = worker_profiles - self.apiserver_profile = apiserver_profile - self.ingress_profiles = ingress_profiles - - -class OpenShiftClusterAdminKubeconfig(_serialization.Model): - """OpenShiftClusterAdminKubeconfig represents an OpenShift cluster's admin kubeconfig. - - :ivar kubeconfig: The base64-encoded kubeconfig file. - :vartype kubeconfig: str - """ - - _attribute_map = { - "kubeconfig": {"key": "kubeconfig", "type": "str"}, - } - - def __init__(self, *, kubeconfig: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword kubeconfig: The base64-encoded kubeconfig file. - :paramtype kubeconfig: str - """ - super().__init__(**kwargs) - self.kubeconfig = kubeconfig - - -class OpenShiftClusterCredentials(_serialization.Model): - """OpenShiftClusterCredentials represents an OpenShift cluster's credentials. - - :ivar kubeadmin_username: The username for the kubeadmin user. - :vartype kubeadmin_username: str - :ivar kubeadmin_password: The password for the kubeadmin user. - :vartype kubeadmin_password: str - """ - - _attribute_map = { - "kubeadmin_username": {"key": "kubeadminUsername", "type": "str"}, - "kubeadmin_password": {"key": "kubeadminPassword", "type": "str"}, - } - - def __init__( - self, *, kubeadmin_username: Optional[str] = None, kubeadmin_password: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword kubeadmin_username: The username for the kubeadmin user. - :paramtype kubeadmin_username: str - :keyword kubeadmin_password: The password for the kubeadmin user. - :paramtype kubeadmin_password: str - """ - super().__init__(**kwargs) - self.kubeadmin_username = kubeadmin_username - self.kubeadmin_password = kubeadmin_password - - -class OpenShiftClusterList(_serialization.Model): - """OpenShiftClusterList represents a list of OpenShift clusters. - - :ivar value: The list of OpenShift clusters. - :vartype value: list[~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftCluster] - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[OpenShiftCluster]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.OpenShiftCluster"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The list of OpenShift clusters. - :paramtype value: list[~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftCluster] - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class OpenShiftClusterUpdate(_serialization.Model): # pylint: disable=too-many-instance-attributes - """OpenShiftCluster represents an Azure Red Hat OpenShift cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar tags: The resource tags. - :vartype tags: dict[str, str] - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.SystemData - :ivar provisioning_state: The cluster provisioning state. Known values are: "AdminUpdating", - "Creating", "Deleting", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.ProvisioningState - :ivar cluster_profile: The cluster profile. - :vartype cluster_profile: ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.ClusterProfile - :ivar console_profile: The console profile. - :vartype console_profile: ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.ConsoleProfile - :ivar service_principal_profile: The cluster service principal profile. - :vartype service_principal_profile: - ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.ServicePrincipalProfile - :ivar network_profile: The cluster network profile. - :vartype network_profile: ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.NetworkProfile - :ivar master_profile: The cluster master profile. - :vartype master_profile: ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.MasterProfile - :ivar worker_profiles: The cluster worker profiles. - :vartype worker_profiles: - list[~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.WorkerProfile] - :ivar apiserver_profile: The cluster API server profile. - :vartype apiserver_profile: - ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.APIServerProfile - :ivar ingress_profiles: The cluster ingress profiles. - :vartype ingress_profiles: - list[~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.IngressProfile] - """ - - _validation = { - "system_data": {"readonly": True}, - } - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "cluster_profile": {"key": "properties.clusterProfile", "type": "ClusterProfile"}, - "console_profile": {"key": "properties.consoleProfile", "type": "ConsoleProfile"}, - "service_principal_profile": {"key": "properties.servicePrincipalProfile", "type": "ServicePrincipalProfile"}, - "network_profile": {"key": "properties.networkProfile", "type": "NetworkProfile"}, - "master_profile": {"key": "properties.masterProfile", "type": "MasterProfile"}, - "worker_profiles": {"key": "properties.workerProfiles", "type": "[WorkerProfile]"}, - "apiserver_profile": {"key": "properties.apiserverProfile", "type": "APIServerProfile"}, - "ingress_profiles": {"key": "properties.ingressProfiles", "type": "[IngressProfile]"}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, - cluster_profile: Optional["_models.ClusterProfile"] = None, - console_profile: Optional["_models.ConsoleProfile"] = None, - service_principal_profile: Optional["_models.ServicePrincipalProfile"] = None, - network_profile: Optional["_models.NetworkProfile"] = None, - master_profile: Optional["_models.MasterProfile"] = None, - worker_profiles: Optional[List["_models.WorkerProfile"]] = None, - apiserver_profile: Optional["_models.APIServerProfile"] = None, - ingress_profiles: Optional[List["_models.IngressProfile"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: The resource tags. - :paramtype tags: dict[str, str] - :keyword provisioning_state: The cluster provisioning state. Known values are: "AdminUpdating", - "Creating", "Deleting", "Failed", "Succeeded", and "Updating". - :paramtype provisioning_state: str or - ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.ProvisioningState - :keyword cluster_profile: The cluster profile. - :paramtype cluster_profile: - ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.ClusterProfile - :keyword console_profile: The console profile. - :paramtype console_profile: - ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.ConsoleProfile - :keyword service_principal_profile: The cluster service principal profile. - :paramtype service_principal_profile: - ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.ServicePrincipalProfile - :keyword network_profile: The cluster network profile. - :paramtype network_profile: - ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.NetworkProfile - :keyword master_profile: The cluster master profile. - :paramtype master_profile: ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.MasterProfile - :keyword worker_profiles: The cluster worker profiles. - :paramtype worker_profiles: - list[~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.WorkerProfile] - :keyword apiserver_profile: The cluster API server profile. - :paramtype apiserver_profile: - ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.APIServerProfile - :keyword ingress_profiles: The cluster ingress profiles. - :paramtype ingress_profiles: - list[~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.IngressProfile] - """ - super().__init__(**kwargs) - self.tags = tags - self.system_data = None - self.provisioning_state = provisioning_state - self.cluster_profile = cluster_profile - self.console_profile = console_profile - self.service_principal_profile = service_principal_profile - self.network_profile = network_profile - self.master_profile = master_profile - self.worker_profiles = worker_profiles - self.apiserver_profile = apiserver_profile - self.ingress_profiles = ingress_profiles - - -class Operation(_serialization.Model): - """Operation represents an RP operation. - - :ivar name: Operation name: {provider}/{resource}/{operation}. - :vartype name: str - :ivar display: The object that describes the operation. - :vartype display: ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.Display - :ivar origin: Sources of requests to this operation. Comma separated list with valid values - user or system, e.g. "user,system". - :vartype origin: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "display": {"key": "display", "type": "Display"}, - "origin": {"key": "origin", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - display: Optional["_models.Display"] = None, - origin: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Operation name: {provider}/{resource}/{operation}. - :paramtype name: str - :keyword display: The object that describes the operation. - :paramtype display: ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.Display - :keyword origin: Sources of requests to this operation. Comma separated list with valid values - user or system, e.g. "user,system". - :paramtype origin: str - """ - super().__init__(**kwargs) - self.name = name - self.display = display - self.origin = origin - - -class OperationList(_serialization.Model): - """OperationList represents an RP operation list. - - :ivar value: List of operations supported by the resource provider. - :vartype value: list[~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.Operation] - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Operation]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: List of operations supported by the resource provider. - :paramtype value: list[~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.Operation] - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServicePrincipalProfile(_serialization.Model): - """ServicePrincipalProfile represents a service principal profile. - - :ivar client_id: The client ID used for the cluster. - :vartype client_id: str - :ivar client_secret: The client secret used for the cluster. - :vartype client_secret: str - """ - - _attribute_map = { - "client_id": {"key": "clientId", "type": "str"}, - "client_secret": {"key": "clientSecret", "type": "str"}, - } - - def __init__(self, *, client_id: Optional[str] = None, client_secret: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword client_id: The client ID used for the cluster. - :paramtype client_id: str - :keyword client_secret: The client secret used for the cluster. - :paramtype client_secret: str - """ - super().__init__(**kwargs) - self.client_id = client_id - self.client_secret = client_secret - - -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.redhatopenshift.v2021_09_01_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.redhatopenshift.v2021_09_01_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.redhatopenshift.v2021_09_01_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.redhatopenshift.v2021_09_01_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 WorkerProfile(_serialization.Model): - """WorkerProfile represents a worker profile. - - :ivar name: The worker profile name. - :vartype name: str - :ivar vm_size: The size of the worker VMs. Known values are: "Standard_D16as_v4", - "Standard_D16s_v3", "Standard_D2s_v3", "Standard_D32as_v4", "Standard_D32s_v3", - "Standard_D4as_v4", "Standard_D4s_v3", "Standard_D8as_v4", "Standard_D8s_v3", - "Standard_E16s_v3", "Standard_E32s_v3", "Standard_E4s_v3", "Standard_E64i_v3", - "Standard_E64is_v3", "Standard_E8s_v3", "Standard_F16s_v2", "Standard_F32s_v2", - "Standard_F4s_v2", "Standard_F72s_v2", "Standard_F8s_v2", "Standard_G5", "Standard_GS5", and - "Standard_M128ms". - :vartype vm_size: str or ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.VMSize - :ivar disk_size_gb: The disk size of the worker VMs. - :vartype disk_size_gb: int - :ivar subnet_id: The Azure resource ID of the worker subnet. - :vartype subnet_id: str - :ivar count: The number of worker VMs. - :vartype count: int - :ivar encryption_at_host: Whether master virtual machines are encrypted at host. Known values - are: "Disabled" and "Enabled". - :vartype encryption_at_host: str or - ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.EncryptionAtHost - :ivar disk_encryption_set_id: The resource ID of an associated DiskEncryptionSet, if - applicable. - :vartype disk_encryption_set_id: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "vm_size": {"key": "vmSize", "type": "str"}, - "disk_size_gb": {"key": "diskSizeGB", "type": "int"}, - "subnet_id": {"key": "subnetId", "type": "str"}, - "count": {"key": "count", "type": "int"}, - "encryption_at_host": {"key": "encryptionAtHost", "type": "str"}, - "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - vm_size: Optional[Union[str, "_models.VMSize"]] = None, - disk_size_gb: Optional[int] = None, - subnet_id: Optional[str] = None, - count: Optional[int] = None, - encryption_at_host: Optional[Union[str, "_models.EncryptionAtHost"]] = None, - disk_encryption_set_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The worker profile name. - :paramtype name: str - :keyword vm_size: The size of the worker VMs. Known values are: "Standard_D16as_v4", - "Standard_D16s_v3", "Standard_D2s_v3", "Standard_D32as_v4", "Standard_D32s_v3", - "Standard_D4as_v4", "Standard_D4s_v3", "Standard_D8as_v4", "Standard_D8s_v3", - "Standard_E16s_v3", "Standard_E32s_v3", "Standard_E4s_v3", "Standard_E64i_v3", - "Standard_E64is_v3", "Standard_E8s_v3", "Standard_F16s_v2", "Standard_F32s_v2", - "Standard_F4s_v2", "Standard_F72s_v2", "Standard_F8s_v2", "Standard_G5", "Standard_GS5", and - "Standard_M128ms". - :paramtype vm_size: str or ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.VMSize - :keyword disk_size_gb: The disk size of the worker VMs. - :paramtype disk_size_gb: int - :keyword subnet_id: The Azure resource ID of the worker subnet. - :paramtype subnet_id: str - :keyword count: The number of worker VMs. - :paramtype count: int - :keyword encryption_at_host: Whether master virtual machines are encrypted at host. Known - values are: "Disabled" and "Enabled". - :paramtype encryption_at_host: str or - ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.EncryptionAtHost - :keyword disk_encryption_set_id: The resource ID of an associated DiskEncryptionSet, if - applicable. - :paramtype disk_encryption_set_id: str - """ - super().__init__(**kwargs) - self.name = name - self.vm_size = vm_size - self.disk_size_gb = disk_size_gb - self.subnet_id = subnet_id - self.count = count - self.encryption_at_host = encryption_at_host - self.disk_encryption_set_id = disk_encryption_set_id diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/operations/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/operations/__init__.py deleted file mode 100644 index 70ea64711791..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_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 ._operations import Operations -from ._open_shift_clusters_operations import OpenShiftClustersOperations - -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", - "OpenShiftClustersOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/operations/_open_shift_clusters_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/operations/_open_shift_clusters_operations.py deleted file mode 100644 index de5fd5c52af3..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/operations/_open_shift_clusters_operations.py +++ /dev/null @@ -1,1191 +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, - 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_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", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.RedHatOpenShift/openShiftClusters" - ) # pylint: disable=line-too-long - 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", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("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, resource_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", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _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, resource_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", "2021-09-01-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.RedHatOpenShift/openShiftClusters/{resourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, resource_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", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, resource_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", "2021-09-01-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.RedHatOpenShift/openShiftClusters/{resourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_admin_credentials_request( - resource_group_name: str, resource_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", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}/listAdminCredentials", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _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) - - -def build_list_credentials_request( - resource_group_name: str, resource_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", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}/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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _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 OpenShiftClustersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2021_09_01_preview.AzureRedHatOpenShiftClient`'s - :attr:`open_shift_clusters` 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.OpenShiftCluster"]: - """Lists OpenShift clusters in the specified subscription. - - The operation returns properties of each OpenShift cluster. - - :return: An iterator like instance of either OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.OpenShiftClusterList] = 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("OpenShiftClusterList", 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) - raise HttpResponseError(response=response, 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.OpenShiftCluster"]: - """Lists OpenShift clusters in the specified subscription and resource group. - - The operation returns properties of each OpenShift cluster. - - :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 OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.OpenShiftClusterList] = 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("OpenShiftClusterList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.OpenShiftCluster: - """Gets a OpenShift cluster with the specified subscription, resource group and resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: OpenShiftCluster or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftCluster - :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 "2021-09-01-preview") - ) - cls: ClsType[_models.OpenShiftCluster] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenShiftCluster", 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, - resource_name: str, - parameters: Union[_models.OpenShiftCluster, IO[bytes]], - **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 "2021-09-01-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, "OpenShiftCluster") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - 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 = 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]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.OpenShiftCluster, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftCluster - :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 OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :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: An instance of LROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - parameters: Union[_models.OpenShiftCluster, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a OpenShiftCluster type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftCluster or - IO[bytes] - :return: An instance of LROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftCluster] - :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 "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OpenShiftCluster] = 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, - resource_name=resource_name, - parameters=parameters, - 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("OpenShiftCluster", 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.OpenShiftCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OpenShiftCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, resource_name: str, **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 "2021-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes a OpenShift cluster with the specified subscription, resource group and resource name. - - The operation returns nothing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: 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 "2021-09-01-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, - resource_name=resource_name, - 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, **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 _update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: Union[_models.OpenShiftClusterUpdate, IO[bytes]], - **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 "2021-09-01-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, "OpenShiftClusterUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - 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 = 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]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.OpenShiftClusterUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftClusterUpdate - :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 OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :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: An instance of LROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - resource_name: str, - parameters: Union[_models.OpenShiftClusterUpdate, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a OpenShiftClusterUpdate type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftClusterUpdate - or IO[bytes] - :return: An instance of LROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftCluster] - :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 "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OpenShiftCluster] = 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, - resource_name=resource_name, - parameters=parameters, - 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("OpenShiftCluster", 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.OpenShiftCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OpenShiftCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_admin_credentials( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.OpenShiftClusterAdminKubeconfig: - """Lists admin kubeconfig of an OpenShift cluster with the specified subscription, resource group - and resource name. - - The operation returns the admin kubeconfig. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: OpenShiftClusterAdminKubeconfig or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftClusterAdminKubeconfig - :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 "2021-09-01-preview") - ) - cls: ClsType[_models.OpenShiftClusterAdminKubeconfig] = kwargs.pop("cls", None) - - _request = build_list_admin_credentials_request( - resource_group_name=resource_group_name, - resource_name=resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenShiftClusterAdminKubeconfig", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_credentials( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.OpenShiftClusterCredentials: - """Lists credentials of an OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns the credentials. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: OpenShiftClusterCredentials or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OpenShiftClusterCredentials - :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 "2021-09-01-preview") - ) - cls: ClsType[_models.OpenShiftClusterCredentials] = kwargs.pop("cls", None) - - _request = build_list_credentials_request( - resource_group_name=resource_group_name, - resource_name=resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenShiftClusterCredentials", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/operations/_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/operations/_operations.py deleted file mode 100644 index 4ab51a96f71a..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/operations/_operations.py +++ /dev/null @@ -1,157 +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", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.RedHatOpenShift/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.redhatopenshift.v2021_09_01_preview.AzureRedHatOpenShiftClient`'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"]: - """Lists all of the available RP operations. - - The operation returns the RP operations. - - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2021_09_01_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 "2021-09-01-preview") - ) - cls: ClsType[_models.OperationList] = 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("OperationList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/operations/_patch.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/py.typed b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2021_09_01_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/__init__.py deleted file mode 100644 index c64163c98d3d..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_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 ._azure_red_hat_open_shift_client import AzureRedHatOpenShiftClient -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__ = [ - "AzureRedHatOpenShiftClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/_azure_red_hat_open_shift_client.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/_azure_red_hat_open_shift_client.py deleted file mode 100644 index 9e0822453dfd..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/_azure_red_hat_open_shift_client.py +++ /dev/null @@ -1,118 +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 AzureRedHatOpenShiftClientConfiguration -from .operations import OpenShiftClustersOperations, Operations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class AzureRedHatOpenShiftClient: # pylint: disable=client-accepts-api-version-keyword - """Rest API for Azure Red Hat OpenShift 4. - - :ivar operations: Operations operations - :vartype operations: azure.mgmt.redhatopenshift.v2022_04_01.operations.Operations - :ivar open_shift_clusters: OpenShiftClustersOperations operations - :vartype open_shift_clusters: - azure.mgmt.redhatopenshift.v2022_04_01.operations.OpenShiftClustersOperations - :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-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 = AzureRedHatOpenShiftClientConfiguration( - 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-04-01") - self.open_shift_clusters = OpenShiftClustersOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/_configuration.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/_configuration.py deleted file mode 100644 index c37d59ee6e70..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_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 AzureRedHatOpenShiftClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for AzureRedHatOpenShiftClient. - - 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-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", "2022-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-redhatopenshift/{}".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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/_metadata.json b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/_metadata.json deleted file mode 100644 index 4b5e72a9d233..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/_metadata.json +++ /dev/null @@ -1,111 +0,0 @@ -{ - "chosen_version": "2022-04-01", - "total_api_version_list": ["2022-04-01"], - "client": { - "name": "AzureRedHatOpenShiftClient", - "filename": "_azure_red_hat_open_shift_client", - "description": "Rest API for Azure Red Hat OpenShift 4.", - "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\": [\"AzureRedHatOpenShiftClientConfiguration\"], \".._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\": [\"AzureRedHatOpenShiftClientConfiguration\"], \"..._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", - "open_shift_clusters": "OpenShiftClustersOperations" - } -} diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/_patch.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/_patch.py deleted file mode 100644 index 17dbc073e01b..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/_patch.py +++ /dev/null @@ -1,32 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/_version.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/_version.py deleted file mode 100644 index b2efd13ce94d..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_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 = "1.5.0" diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/aio/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/aio/__init__.py deleted file mode 100644 index b06f0016da77..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_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 ._azure_red_hat_open_shift_client import AzureRedHatOpenShiftClient - -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__ = [ - "AzureRedHatOpenShiftClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/aio/_azure_red_hat_open_shift_client.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/aio/_azure_red_hat_open_shift_client.py deleted file mode 100644 index 203c97db0fd2..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/aio/_azure_red_hat_open_shift_client.py +++ /dev/null @@ -1,120 +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 AzureRedHatOpenShiftClientConfiguration -from .operations import OpenShiftClustersOperations, Operations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class AzureRedHatOpenShiftClient: # pylint: disable=client-accepts-api-version-keyword - """Rest API for Azure Red Hat OpenShift 4. - - :ivar operations: Operations operations - :vartype operations: azure.mgmt.redhatopenshift.v2022_04_01.aio.operations.Operations - :ivar open_shift_clusters: OpenShiftClustersOperations operations - :vartype open_shift_clusters: - azure.mgmt.redhatopenshift.v2022_04_01.aio.operations.OpenShiftClustersOperations - :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-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 = AzureRedHatOpenShiftClientConfiguration( - 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-04-01") - self.open_shift_clusters = OpenShiftClustersOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/aio/_configuration.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/aio/_configuration.py deleted file mode 100644 index 7c5d20e9ec2f..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_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 AzureRedHatOpenShiftClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for AzureRedHatOpenShiftClient. - - 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-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", "2022-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-redhatopenshift/{}".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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/aio/_patch.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/aio/_patch.py deleted file mode 100644 index 17dbc073e01b..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/aio/_patch.py +++ /dev/null @@ -1,32 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/aio/operations/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/aio/operations/__init__.py deleted file mode 100644 index 70ea64711791..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/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 ._operations import Operations -from ._open_shift_clusters_operations import OpenShiftClustersOperations - -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", - "OpenShiftClustersOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/aio/operations/_open_shift_clusters_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/aio/operations/_open_shift_clusters_operations.py deleted file mode 100644 index 671bcdfc2658..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/aio/operations/_open_shift_clusters_operations.py +++ /dev/null @@ -1,921 +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, - 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._open_shift_clusters_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_admin_credentials_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 OpenShiftClustersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2022_04_01.aio.AzureRedHatOpenShiftClient`'s - :attr:`open_shift_clusters` 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.OpenShiftCluster"]: - """Lists OpenShift clusters in the specified subscription. - - The operation returns properties of each OpenShift cluster. - - :return: An iterator like instance of either OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) 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-04-01")) - cls: ClsType[_models.OpenShiftClusterList] = 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("OpenShiftClusterList", 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) - raise HttpResponseError(response=response, 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.OpenShiftCluster"]: - """Lists OpenShift clusters in the specified subscription and resource group. - - The operation returns properties of each OpenShift cluster. - - :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 OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) 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-04-01")) - cls: ClsType[_models.OpenShiftClusterList] = 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("OpenShiftClusterList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.OpenShiftCluster: - """Gets a OpenShift cluster with the specified subscription, resource group and resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: OpenShiftCluster or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftCluster - :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-04-01")) - cls: ClsType[_models.OpenShiftCluster] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenShiftCluster", 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, - resource_name: str, - parameters: Union[_models.OpenShiftCluster, IO[bytes]], - **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-04-01")) - 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, "OpenShiftCluster") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - 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 = 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]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - 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, - resource_name: str, - parameters: _models.OpenShiftCluster, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftCluster - :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 OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :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: An instance of AsyncLROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - parameters: Union[_models.OpenShiftCluster, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a OpenShiftCluster type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftCluster or IO[bytes] - :return: An instance of AsyncLROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftCluster] - :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-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OpenShiftCluster] = 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, - resource_name=resource_name, - parameters=parameters, - 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("OpenShiftCluster", 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.OpenShiftCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OpenShiftCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, resource_name: str, **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-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - 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, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Deletes a OpenShift cluster with the specified subscription, resource group and resource name. - - The operation returns nothing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: 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-04-01")) - 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, - resource_name=resource_name, - 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, **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 _update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: Union[_models.OpenShiftClusterUpdate, IO[bytes]], - **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-04-01")) - 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, "OpenShiftClusterUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - 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 = 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]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.OpenShiftClusterUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftClusterUpdate - :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 OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :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: An instance of AsyncLROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - resource_name: str, - parameters: Union[_models.OpenShiftClusterUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a OpenShiftClusterUpdate type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftClusterUpdate or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftCluster] - :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-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OpenShiftCluster] = 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, - resource_name=resource_name, - parameters=parameters, - 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("OpenShiftCluster", 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.OpenShiftCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OpenShiftCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace_async - async def list_admin_credentials( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.OpenShiftClusterAdminKubeconfig: - """Lists admin kubeconfig of an OpenShift cluster with the specified subscription, resource group - and resource name. - - The operation returns the admin kubeconfig. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: OpenShiftClusterAdminKubeconfig or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftClusterAdminKubeconfig - :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-04-01")) - cls: ClsType[_models.OpenShiftClusterAdminKubeconfig] = kwargs.pop("cls", None) - - _request = build_list_admin_credentials_request( - resource_group_name=resource_group_name, - resource_name=resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenShiftClusterAdminKubeconfig", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def list_credentials( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.OpenShiftClusterCredentials: - """Lists credentials of an OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns the credentials. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: OpenShiftClusterCredentials or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftClusterCredentials - :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-04-01")) - cls: ClsType[_models.OpenShiftClusterCredentials] = kwargs.pop("cls", None) - - _request = build_list_credentials_request( - resource_group_name=resource_group_name, - resource_name=resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenShiftClusterCredentials", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/aio/operations/_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/aio/operations/_operations.py deleted file mode 100644 index 40cb9c8a9826..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/aio/operations/_operations.py +++ /dev/null @@ -1,133 +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.redhatopenshift.v2022_04_01.aio.AzureRedHatOpenShiftClient`'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"]: - """Lists all of the available RP operations. - - The operation returns the RP operations. - - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2022_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 "2022-04-01")) - cls: ClsType[_models.OperationList] = 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("OperationList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/aio/operations/_patch.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/models/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/models/__init__.py deleted file mode 100644 index 64b94db9e1ff..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/models/__init__.py +++ /dev/null @@ -1,67 +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 APIServerProfile -from ._models_py3 import CloudErrorBody -from ._models_py3 import ClusterProfile -from ._models_py3 import ConsoleProfile -from ._models_py3 import Display -from ._models_py3 import IngressProfile -from ._models_py3 import MasterProfile -from ._models_py3 import NetworkProfile -from ._models_py3 import OpenShiftCluster -from ._models_py3 import OpenShiftClusterAdminKubeconfig -from ._models_py3 import OpenShiftClusterCredentials -from ._models_py3 import OpenShiftClusterList -from ._models_py3 import OpenShiftClusterUpdate -from ._models_py3 import Operation -from ._models_py3 import OperationList -from ._models_py3 import Resource -from ._models_py3 import ServicePrincipalProfile -from ._models_py3 import SystemData -from ._models_py3 import TrackedResource -from ._models_py3 import WorkerProfile - -from ._azure_red_hat_open_shift_client_enums import CreatedByType -from ._azure_red_hat_open_shift_client_enums import EncryptionAtHost -from ._azure_red_hat_open_shift_client_enums import FipsValidatedModules -from ._azure_red_hat_open_shift_client_enums import ProvisioningState -from ._azure_red_hat_open_shift_client_enums import Visibility -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "APIServerProfile", - "CloudErrorBody", - "ClusterProfile", - "ConsoleProfile", - "Display", - "IngressProfile", - "MasterProfile", - "NetworkProfile", - "OpenShiftCluster", - "OpenShiftClusterAdminKubeconfig", - "OpenShiftClusterCredentials", - "OpenShiftClusterList", - "OpenShiftClusterUpdate", - "Operation", - "OperationList", - "Resource", - "ServicePrincipalProfile", - "SystemData", - "TrackedResource", - "WorkerProfile", - "CreatedByType", - "EncryptionAtHost", - "FipsValidatedModules", - "ProvisioningState", - "Visibility", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/models/_azure_red_hat_open_shift_client_enums.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/models/_azure_red_hat_open_shift_client_enums.py deleted file mode 100644 index 7ca1dc70ec55..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/models/_azure_red_hat_open_shift_client_enums.py +++ /dev/null @@ -1,51 +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 EncryptionAtHost(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """EncryptionAtHost represents encryption at host state.""" - - DISABLED = "Disabled" - ENABLED = "Enabled" - - -class FipsValidatedModules(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """FipsValidatedModules determines if FIPS is used.""" - - DISABLED = "Disabled" - ENABLED = "Enabled" - - -class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ProvisioningState represents a provisioning state.""" - - ADMIN_UPDATING = "AdminUpdating" - CREATING = "Creating" - DELETING = "Deleting" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class Visibility(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Visibility represents visibility.""" - - PRIVATE = "Private" - PUBLIC = "Public" diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/models/_models_py3.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/models/_models_py3.py deleted file mode 100644 index 8dde005c1fff..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/models/_models_py3.py +++ /dev/null @@ -1,978 +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 APIServerProfile(_serialization.Model): - """APIServerProfile represents an API server profile. - - :ivar visibility: API server visibility. Known values are: "Private" and "Public". - :vartype visibility: str or ~azure.mgmt.redhatopenshift.v2022_04_01.models.Visibility - :ivar url: The URL to access the cluster API server. - :vartype url: str - :ivar ip: The IP of the cluster API server. - :vartype ip: str - """ - - _attribute_map = { - "visibility": {"key": "visibility", "type": "str"}, - "url": {"key": "url", "type": "str"}, - "ip": {"key": "ip", "type": "str"}, - } - - def __init__( - self, - *, - visibility: Optional[Union[str, "_models.Visibility"]] = None, - url: Optional[str] = None, - ip: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword visibility: API server visibility. Known values are: "Private" and "Public". - :paramtype visibility: str or ~azure.mgmt.redhatopenshift.v2022_04_01.models.Visibility - :keyword url: The URL to access the cluster API server. - :paramtype url: str - :keyword ip: The IP of the cluster API server. - :paramtype ip: str - """ - super().__init__(**kwargs) - self.visibility = visibility - self.url = url - self.ip = ip - - -class CloudErrorBody(_serialization.Model): - """CloudErrorBody represents the body of a cloud error. - - :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :vartype code: str - :ivar message: A message describing the error, intended to be suitable for display in a user - interface. - :vartype message: str - :ivar target: The target of the particular error. For example, the name of the property in - error. - :vartype target: str - :ivar details: A list of additional details about the error. - :vartype details: list[~azure.mgmt.redhatopenshift.v2022_04_01.models.CloudErrorBody] - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[CloudErrorBody]"}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[List["_models.CloudErrorBody"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :paramtype code: str - :keyword message: A message describing the error, intended to be suitable for display in a user - interface. - :paramtype message: str - :keyword target: The target of the particular error. For example, the name of the property in - error. - :paramtype target: str - :keyword details: A list of additional details about the error. - :paramtype details: list[~azure.mgmt.redhatopenshift.v2022_04_01.models.CloudErrorBody] - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - -class ClusterProfile(_serialization.Model): - """ClusterProfile represents a cluster profile. - - :ivar pull_secret: The pull secret for the cluster. - :vartype pull_secret: str - :ivar domain: The domain for the cluster. - :vartype domain: str - :ivar version: The version of the cluster. - :vartype version: str - :ivar resource_group_id: The ID of the cluster resource group. - :vartype resource_group_id: str - :ivar fips_validated_modules: If FIPS validated crypto modules are used. Known values are: - "Disabled" and "Enabled". - :vartype fips_validated_modules: str or - ~azure.mgmt.redhatopenshift.v2022_04_01.models.FipsValidatedModules - """ - - _attribute_map = { - "pull_secret": {"key": "pullSecret", "type": "str"}, - "domain": {"key": "domain", "type": "str"}, - "version": {"key": "version", "type": "str"}, - "resource_group_id": {"key": "resourceGroupId", "type": "str"}, - "fips_validated_modules": {"key": "fipsValidatedModules", "type": "str"}, - } - - def __init__( - self, - *, - pull_secret: Optional[str] = None, - domain: Optional[str] = None, - version: Optional[str] = None, - resource_group_id: Optional[str] = None, - fips_validated_modules: Optional[Union[str, "_models.FipsValidatedModules"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword pull_secret: The pull secret for the cluster. - :paramtype pull_secret: str - :keyword domain: The domain for the cluster. - :paramtype domain: str - :keyword version: The version of the cluster. - :paramtype version: str - :keyword resource_group_id: The ID of the cluster resource group. - :paramtype resource_group_id: str - :keyword fips_validated_modules: If FIPS validated crypto modules are used. Known values are: - "Disabled" and "Enabled". - :paramtype fips_validated_modules: str or - ~azure.mgmt.redhatopenshift.v2022_04_01.models.FipsValidatedModules - """ - super().__init__(**kwargs) - self.pull_secret = pull_secret - self.domain = domain - self.version = version - self.resource_group_id = resource_group_id - self.fips_validated_modules = fips_validated_modules - - -class ConsoleProfile(_serialization.Model): - """ConsoleProfile represents a console profile. - - :ivar url: The URL to access the cluster console. - :vartype url: str - """ - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - } - - def __init__(self, *, url: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword url: The URL to access the cluster console. - :paramtype url: str - """ - super().__init__(**kwargs) - self.url = url - - -class Display(_serialization.Model): - """Display represents the display details of an operation. - - :ivar provider: Friendly name of the resource provider. - :vartype provider: str - :ivar resource: Resource type on which the operation is performed. - :vartype resource: str - :ivar operation: Operation type: read, write, delete, listKeys/action, etc. - :vartype operation: str - :ivar description: Friendly name of the operation. - :vartype description: str - """ - - _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__( - self, - *, - provider: Optional[str] = None, - resource: Optional[str] = None, - operation: Optional[str] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword provider: Friendly name of the resource provider. - :paramtype provider: str - :keyword resource: Resource type on which the operation is performed. - :paramtype resource: str - :keyword operation: Operation type: read, write, delete, listKeys/action, etc. - :paramtype operation: str - :keyword description: Friendly name of the operation. - :paramtype description: str - """ - super().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class IngressProfile(_serialization.Model): - """IngressProfile represents an ingress profile. - - :ivar name: The ingress profile name. - :vartype name: str - :ivar visibility: Ingress visibility. Known values are: "Private" and "Public". - :vartype visibility: str or ~azure.mgmt.redhatopenshift.v2022_04_01.models.Visibility - :ivar ip: The IP of the ingress. - :vartype ip: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "visibility": {"key": "visibility", "type": "str"}, - "ip": {"key": "ip", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - visibility: Optional[Union[str, "_models.Visibility"]] = None, - ip: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The ingress profile name. - :paramtype name: str - :keyword visibility: Ingress visibility. Known values are: "Private" and "Public". - :paramtype visibility: str or ~azure.mgmt.redhatopenshift.v2022_04_01.models.Visibility - :keyword ip: The IP of the ingress. - :paramtype ip: str - """ - super().__init__(**kwargs) - self.name = name - self.visibility = visibility - self.ip = ip - - -class MasterProfile(_serialization.Model): - """MasterProfile represents a master profile. - - :ivar vm_size: The size of the master VMs. - :vartype vm_size: str - :ivar subnet_id: The Azure resource ID of the master subnet. - :vartype subnet_id: str - :ivar encryption_at_host: Whether master virtual machines are encrypted at host. Known values - are: "Disabled" and "Enabled". - :vartype encryption_at_host: str or - ~azure.mgmt.redhatopenshift.v2022_04_01.models.EncryptionAtHost - :ivar disk_encryption_set_id: The resource ID of an associated DiskEncryptionSet, if - applicable. - :vartype disk_encryption_set_id: str - """ - - _attribute_map = { - "vm_size": {"key": "vmSize", "type": "str"}, - "subnet_id": {"key": "subnetId", "type": "str"}, - "encryption_at_host": {"key": "encryptionAtHost", "type": "str"}, - "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, - } - - def __init__( - self, - *, - vm_size: Optional[str] = None, - subnet_id: Optional[str] = None, - encryption_at_host: Optional[Union[str, "_models.EncryptionAtHost"]] = None, - disk_encryption_set_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword vm_size: The size of the master VMs. - :paramtype vm_size: str - :keyword subnet_id: The Azure resource ID of the master subnet. - :paramtype subnet_id: str - :keyword encryption_at_host: Whether master virtual machines are encrypted at host. Known - values are: "Disabled" and "Enabled". - :paramtype encryption_at_host: str or - ~azure.mgmt.redhatopenshift.v2022_04_01.models.EncryptionAtHost - :keyword disk_encryption_set_id: The resource ID of an associated DiskEncryptionSet, if - applicable. - :paramtype disk_encryption_set_id: str - """ - super().__init__(**kwargs) - self.vm_size = vm_size - self.subnet_id = subnet_id - self.encryption_at_host = encryption_at_host - self.disk_encryption_set_id = disk_encryption_set_id - - -class NetworkProfile(_serialization.Model): - """NetworkProfile represents a network profile. - - :ivar pod_cidr: The CIDR used for OpenShift/Kubernetes Pods. - :vartype pod_cidr: str - :ivar service_cidr: The CIDR used for OpenShift/Kubernetes Services. - :vartype service_cidr: str - """ - - _attribute_map = { - "pod_cidr": {"key": "podCidr", "type": "str"}, - "service_cidr": {"key": "serviceCidr", "type": "str"}, - } - - def __init__(self, *, pod_cidr: Optional[str] = None, service_cidr: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword pod_cidr: The CIDR used for OpenShift/Kubernetes Pods. - :paramtype pod_cidr: str - :keyword service_cidr: The CIDR used for OpenShift/Kubernetes Services. - :paramtype service_cidr: str - """ - super().__init__(**kwargs) - self.pod_cidr = pod_cidr - self.service_cidr = service_cidr - - -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 - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = 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 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}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "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 OpenShiftCluster(TrackedResource): # pylint: disable=too-many-instance-attributes - """OpenShiftCluster represents an Azure Red Hat OpenShift cluster. - - 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 tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.redhatopenshift.v2022_04_01.models.SystemData - :ivar provisioning_state: The cluster provisioning state. Known values are: "AdminUpdating", - "Creating", "Deleting", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.redhatopenshift.v2022_04_01.models.ProvisioningState - :ivar cluster_profile: The cluster profile. - :vartype cluster_profile: ~azure.mgmt.redhatopenshift.v2022_04_01.models.ClusterProfile - :ivar console_profile: The console profile. - :vartype console_profile: ~azure.mgmt.redhatopenshift.v2022_04_01.models.ConsoleProfile - :ivar service_principal_profile: The cluster service principal profile. - :vartype service_principal_profile: - ~azure.mgmt.redhatopenshift.v2022_04_01.models.ServicePrincipalProfile - :ivar network_profile: The cluster network profile. - :vartype network_profile: ~azure.mgmt.redhatopenshift.v2022_04_01.models.NetworkProfile - :ivar master_profile: The cluster master profile. - :vartype master_profile: ~azure.mgmt.redhatopenshift.v2022_04_01.models.MasterProfile - :ivar worker_profiles: The cluster worker profiles. - :vartype worker_profiles: list[~azure.mgmt.redhatopenshift.v2022_04_01.models.WorkerProfile] - :ivar apiserver_profile: The cluster API server profile. - :vartype apiserver_profile: ~azure.mgmt.redhatopenshift.v2022_04_01.models.APIServerProfile - :ivar ingress_profiles: The cluster ingress profiles. - :vartype ingress_profiles: list[~azure.mgmt.redhatopenshift.v2022_04_01.models.IngressProfile] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "cluster_profile": {"key": "properties.clusterProfile", "type": "ClusterProfile"}, - "console_profile": {"key": "properties.consoleProfile", "type": "ConsoleProfile"}, - "service_principal_profile": {"key": "properties.servicePrincipalProfile", "type": "ServicePrincipalProfile"}, - "network_profile": {"key": "properties.networkProfile", "type": "NetworkProfile"}, - "master_profile": {"key": "properties.masterProfile", "type": "MasterProfile"}, - "worker_profiles": {"key": "properties.workerProfiles", "type": "[WorkerProfile]"}, - "apiserver_profile": {"key": "properties.apiserverProfile", "type": "APIServerProfile"}, - "ingress_profiles": {"key": "properties.ingressProfiles", "type": "[IngressProfile]"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, - cluster_profile: Optional["_models.ClusterProfile"] = None, - console_profile: Optional["_models.ConsoleProfile"] = None, - service_principal_profile: Optional["_models.ServicePrincipalProfile"] = None, - network_profile: Optional["_models.NetworkProfile"] = None, - master_profile: Optional["_models.MasterProfile"] = None, - worker_profiles: Optional[List["_models.WorkerProfile"]] = None, - apiserver_profile: Optional["_models.APIServerProfile"] = None, - ingress_profiles: Optional[List["_models.IngressProfile"]] = 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 provisioning_state: The cluster provisioning state. Known values are: "AdminUpdating", - "Creating", "Deleting", "Failed", "Succeeded", and "Updating". - :paramtype provisioning_state: str or - ~azure.mgmt.redhatopenshift.v2022_04_01.models.ProvisioningState - :keyword cluster_profile: The cluster profile. - :paramtype cluster_profile: ~azure.mgmt.redhatopenshift.v2022_04_01.models.ClusterProfile - :keyword console_profile: The console profile. - :paramtype console_profile: ~azure.mgmt.redhatopenshift.v2022_04_01.models.ConsoleProfile - :keyword service_principal_profile: The cluster service principal profile. - :paramtype service_principal_profile: - ~azure.mgmt.redhatopenshift.v2022_04_01.models.ServicePrincipalProfile - :keyword network_profile: The cluster network profile. - :paramtype network_profile: ~azure.mgmt.redhatopenshift.v2022_04_01.models.NetworkProfile - :keyword master_profile: The cluster master profile. - :paramtype master_profile: ~azure.mgmt.redhatopenshift.v2022_04_01.models.MasterProfile - :keyword worker_profiles: The cluster worker profiles. - :paramtype worker_profiles: list[~azure.mgmt.redhatopenshift.v2022_04_01.models.WorkerProfile] - :keyword apiserver_profile: The cluster API server profile. - :paramtype apiserver_profile: ~azure.mgmt.redhatopenshift.v2022_04_01.models.APIServerProfile - :keyword ingress_profiles: The cluster ingress profiles. - :paramtype ingress_profiles: - list[~azure.mgmt.redhatopenshift.v2022_04_01.models.IngressProfile] - """ - super().__init__(tags=tags, location=location, **kwargs) - self.system_data = None - self.provisioning_state = provisioning_state - self.cluster_profile = cluster_profile - self.console_profile = console_profile - self.service_principal_profile = service_principal_profile - self.network_profile = network_profile - self.master_profile = master_profile - self.worker_profiles = worker_profiles - self.apiserver_profile = apiserver_profile - self.ingress_profiles = ingress_profiles - - -class OpenShiftClusterAdminKubeconfig(_serialization.Model): - """OpenShiftClusterAdminKubeconfig represents an OpenShift cluster's admin kubeconfig. - - :ivar kubeconfig: The base64-encoded kubeconfig file. - :vartype kubeconfig: str - """ - - _attribute_map = { - "kubeconfig": {"key": "kubeconfig", "type": "str"}, - } - - def __init__(self, *, kubeconfig: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword kubeconfig: The base64-encoded kubeconfig file. - :paramtype kubeconfig: str - """ - super().__init__(**kwargs) - self.kubeconfig = kubeconfig - - -class OpenShiftClusterCredentials(_serialization.Model): - """OpenShiftClusterCredentials represents an OpenShift cluster's credentials. - - :ivar kubeadmin_username: The username for the kubeadmin user. - :vartype kubeadmin_username: str - :ivar kubeadmin_password: The password for the kubeadmin user. - :vartype kubeadmin_password: str - """ - - _attribute_map = { - "kubeadmin_username": {"key": "kubeadminUsername", "type": "str"}, - "kubeadmin_password": {"key": "kubeadminPassword", "type": "str"}, - } - - def __init__( - self, *, kubeadmin_username: Optional[str] = None, kubeadmin_password: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword kubeadmin_username: The username for the kubeadmin user. - :paramtype kubeadmin_username: str - :keyword kubeadmin_password: The password for the kubeadmin user. - :paramtype kubeadmin_password: str - """ - super().__init__(**kwargs) - self.kubeadmin_username = kubeadmin_username - self.kubeadmin_password = kubeadmin_password - - -class OpenShiftClusterList(_serialization.Model): - """OpenShiftClusterList represents a list of OpenShift clusters. - - :ivar value: The list of OpenShift clusters. - :vartype value: list[~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftCluster] - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[OpenShiftCluster]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.OpenShiftCluster"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The list of OpenShift clusters. - :paramtype value: list[~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftCluster] - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class OpenShiftClusterUpdate(_serialization.Model): # pylint: disable=too-many-instance-attributes - """OpenShiftCluster represents an Azure Red Hat OpenShift cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar tags: The resource tags. - :vartype tags: dict[str, str] - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.redhatopenshift.v2022_04_01.models.SystemData - :ivar provisioning_state: The cluster provisioning state. Known values are: "AdminUpdating", - "Creating", "Deleting", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.redhatopenshift.v2022_04_01.models.ProvisioningState - :ivar cluster_profile: The cluster profile. - :vartype cluster_profile: ~azure.mgmt.redhatopenshift.v2022_04_01.models.ClusterProfile - :ivar console_profile: The console profile. - :vartype console_profile: ~azure.mgmt.redhatopenshift.v2022_04_01.models.ConsoleProfile - :ivar service_principal_profile: The cluster service principal profile. - :vartype service_principal_profile: - ~azure.mgmt.redhatopenshift.v2022_04_01.models.ServicePrincipalProfile - :ivar network_profile: The cluster network profile. - :vartype network_profile: ~azure.mgmt.redhatopenshift.v2022_04_01.models.NetworkProfile - :ivar master_profile: The cluster master profile. - :vartype master_profile: ~azure.mgmt.redhatopenshift.v2022_04_01.models.MasterProfile - :ivar worker_profiles: The cluster worker profiles. - :vartype worker_profiles: list[~azure.mgmt.redhatopenshift.v2022_04_01.models.WorkerProfile] - :ivar apiserver_profile: The cluster API server profile. - :vartype apiserver_profile: ~azure.mgmt.redhatopenshift.v2022_04_01.models.APIServerProfile - :ivar ingress_profiles: The cluster ingress profiles. - :vartype ingress_profiles: list[~azure.mgmt.redhatopenshift.v2022_04_01.models.IngressProfile] - """ - - _validation = { - "system_data": {"readonly": True}, - } - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "cluster_profile": {"key": "properties.clusterProfile", "type": "ClusterProfile"}, - "console_profile": {"key": "properties.consoleProfile", "type": "ConsoleProfile"}, - "service_principal_profile": {"key": "properties.servicePrincipalProfile", "type": "ServicePrincipalProfile"}, - "network_profile": {"key": "properties.networkProfile", "type": "NetworkProfile"}, - "master_profile": {"key": "properties.masterProfile", "type": "MasterProfile"}, - "worker_profiles": {"key": "properties.workerProfiles", "type": "[WorkerProfile]"}, - "apiserver_profile": {"key": "properties.apiserverProfile", "type": "APIServerProfile"}, - "ingress_profiles": {"key": "properties.ingressProfiles", "type": "[IngressProfile]"}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, - cluster_profile: Optional["_models.ClusterProfile"] = None, - console_profile: Optional["_models.ConsoleProfile"] = None, - service_principal_profile: Optional["_models.ServicePrincipalProfile"] = None, - network_profile: Optional["_models.NetworkProfile"] = None, - master_profile: Optional["_models.MasterProfile"] = None, - worker_profiles: Optional[List["_models.WorkerProfile"]] = None, - apiserver_profile: Optional["_models.APIServerProfile"] = None, - ingress_profiles: Optional[List["_models.IngressProfile"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: The resource tags. - :paramtype tags: dict[str, str] - :keyword provisioning_state: The cluster provisioning state. Known values are: "AdminUpdating", - "Creating", "Deleting", "Failed", "Succeeded", and "Updating". - :paramtype provisioning_state: str or - ~azure.mgmt.redhatopenshift.v2022_04_01.models.ProvisioningState - :keyword cluster_profile: The cluster profile. - :paramtype cluster_profile: ~azure.mgmt.redhatopenshift.v2022_04_01.models.ClusterProfile - :keyword console_profile: The console profile. - :paramtype console_profile: ~azure.mgmt.redhatopenshift.v2022_04_01.models.ConsoleProfile - :keyword service_principal_profile: The cluster service principal profile. - :paramtype service_principal_profile: - ~azure.mgmt.redhatopenshift.v2022_04_01.models.ServicePrincipalProfile - :keyword network_profile: The cluster network profile. - :paramtype network_profile: ~azure.mgmt.redhatopenshift.v2022_04_01.models.NetworkProfile - :keyword master_profile: The cluster master profile. - :paramtype master_profile: ~azure.mgmt.redhatopenshift.v2022_04_01.models.MasterProfile - :keyword worker_profiles: The cluster worker profiles. - :paramtype worker_profiles: list[~azure.mgmt.redhatopenshift.v2022_04_01.models.WorkerProfile] - :keyword apiserver_profile: The cluster API server profile. - :paramtype apiserver_profile: ~azure.mgmt.redhatopenshift.v2022_04_01.models.APIServerProfile - :keyword ingress_profiles: The cluster ingress profiles. - :paramtype ingress_profiles: - list[~azure.mgmt.redhatopenshift.v2022_04_01.models.IngressProfile] - """ - super().__init__(**kwargs) - self.tags = tags - self.system_data = None - self.provisioning_state = provisioning_state - self.cluster_profile = cluster_profile - self.console_profile = console_profile - self.service_principal_profile = service_principal_profile - self.network_profile = network_profile - self.master_profile = master_profile - self.worker_profiles = worker_profiles - self.apiserver_profile = apiserver_profile - self.ingress_profiles = ingress_profiles - - -class Operation(_serialization.Model): - """Operation represents an RP operation. - - :ivar name: Operation name: {provider}/{resource}/{operation}. - :vartype name: str - :ivar display: The object that describes the operation. - :vartype display: ~azure.mgmt.redhatopenshift.v2022_04_01.models.Display - :ivar origin: Sources of requests to this operation. Comma separated list with valid values - user or system, e.g. "user,system". - :vartype origin: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "display": {"key": "display", "type": "Display"}, - "origin": {"key": "origin", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - display: Optional["_models.Display"] = None, - origin: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Operation name: {provider}/{resource}/{operation}. - :paramtype name: str - :keyword display: The object that describes the operation. - :paramtype display: ~azure.mgmt.redhatopenshift.v2022_04_01.models.Display - :keyword origin: Sources of requests to this operation. Comma separated list with valid values - user or system, e.g. "user,system". - :paramtype origin: str - """ - super().__init__(**kwargs) - self.name = name - self.display = display - self.origin = origin - - -class OperationList(_serialization.Model): - """OperationList represents an RP operation list. - - :ivar value: List of operations supported by the resource provider. - :vartype value: list[~azure.mgmt.redhatopenshift.v2022_04_01.models.Operation] - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Operation]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: List of operations supported by the resource provider. - :paramtype value: list[~azure.mgmt.redhatopenshift.v2022_04_01.models.Operation] - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServicePrincipalProfile(_serialization.Model): - """ServicePrincipalProfile represents a service principal profile. - - :ivar client_id: The client ID used for the cluster. - :vartype client_id: str - :ivar client_secret: The client secret used for the cluster. - :vartype client_secret: str - """ - - _attribute_map = { - "client_id": {"key": "clientId", "type": "str"}, - "client_secret": {"key": "clientSecret", "type": "str"}, - } - - def __init__(self, *, client_id: Optional[str] = None, client_secret: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword client_id: The client ID used for the cluster. - :paramtype client_id: str - :keyword client_secret: The client secret used for the cluster. - :paramtype client_secret: str - """ - super().__init__(**kwargs) - self.client_id = client_id - self.client_secret = client_secret - - -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.redhatopenshift.v2022_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.redhatopenshift.v2022_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.redhatopenshift.v2022_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.redhatopenshift.v2022_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 WorkerProfile(_serialization.Model): - """WorkerProfile represents a worker profile. - - :ivar name: The worker profile name. - :vartype name: str - :ivar vm_size: The size of the worker VMs. - :vartype vm_size: str - :ivar disk_size_gb: The disk size of the worker VMs. - :vartype disk_size_gb: int - :ivar subnet_id: The Azure resource ID of the worker subnet. - :vartype subnet_id: str - :ivar count: The number of worker VMs. - :vartype count: int - :ivar encryption_at_host: Whether master virtual machines are encrypted at host. Known values - are: "Disabled" and "Enabled". - :vartype encryption_at_host: str or - ~azure.mgmt.redhatopenshift.v2022_04_01.models.EncryptionAtHost - :ivar disk_encryption_set_id: The resource ID of an associated DiskEncryptionSet, if - applicable. - :vartype disk_encryption_set_id: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "vm_size": {"key": "vmSize", "type": "str"}, - "disk_size_gb": {"key": "diskSizeGB", "type": "int"}, - "subnet_id": {"key": "subnetId", "type": "str"}, - "count": {"key": "count", "type": "int"}, - "encryption_at_host": {"key": "encryptionAtHost", "type": "str"}, - "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - vm_size: Optional[str] = None, - disk_size_gb: Optional[int] = None, - subnet_id: Optional[str] = None, - count: Optional[int] = None, - encryption_at_host: Optional[Union[str, "_models.EncryptionAtHost"]] = None, - disk_encryption_set_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The worker profile name. - :paramtype name: str - :keyword vm_size: The size of the worker VMs. - :paramtype vm_size: str - :keyword disk_size_gb: The disk size of the worker VMs. - :paramtype disk_size_gb: int - :keyword subnet_id: The Azure resource ID of the worker subnet. - :paramtype subnet_id: str - :keyword count: The number of worker VMs. - :paramtype count: int - :keyword encryption_at_host: Whether master virtual machines are encrypted at host. Known - values are: "Disabled" and "Enabled". - :paramtype encryption_at_host: str or - ~azure.mgmt.redhatopenshift.v2022_04_01.models.EncryptionAtHost - :keyword disk_encryption_set_id: The resource ID of an associated DiskEncryptionSet, if - applicable. - :paramtype disk_encryption_set_id: str - """ - super().__init__(**kwargs) - self.name = name - self.vm_size = vm_size - self.disk_size_gb = disk_size_gb - self.subnet_id = subnet_id - self.count = count - self.encryption_at_host = encryption_at_host - self.disk_encryption_set_id = disk_encryption_set_id diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/models/_patch.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/operations/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/operations/__init__.py deleted file mode 100644 index 70ea64711791..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/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 ._operations import Operations -from ._open_shift_clusters_operations import OpenShiftClustersOperations - -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", - "OpenShiftClustersOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/operations/_open_shift_clusters_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/operations/_open_shift_clusters_operations.py deleted file mode 100644 index d0ec3de0f496..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/operations/_open_shift_clusters_operations.py +++ /dev/null @@ -1,1168 +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, - 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_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-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.RedHatOpenShift/openShiftClusters" - ) # pylint: disable=line-too-long - 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-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("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, resource_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-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _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, resource_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-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.RedHatOpenShift/openShiftClusters/{resourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, resource_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-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, resource_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-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.RedHatOpenShift/openShiftClusters/{resourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_admin_credentials_request( - resource_group_name: str, resource_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-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}/listAdminCredentials", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _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) - - -def build_list_credentials_request( - resource_group_name: str, resource_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-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}/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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _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 OpenShiftClustersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2022_04_01.AzureRedHatOpenShiftClient`'s - :attr:`open_shift_clusters` 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.OpenShiftCluster"]: - """Lists OpenShift clusters in the specified subscription. - - The operation returns properties of each OpenShift cluster. - - :return: An iterator like instance of either OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) 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-04-01")) - cls: ClsType[_models.OpenShiftClusterList] = 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("OpenShiftClusterList", 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) - raise HttpResponseError(response=response, 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.OpenShiftCluster"]: - """Lists OpenShift clusters in the specified subscription and resource group. - - The operation returns properties of each OpenShift cluster. - - :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 OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) 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-04-01")) - cls: ClsType[_models.OpenShiftClusterList] = 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("OpenShiftClusterList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.OpenShiftCluster: - """Gets a OpenShift cluster with the specified subscription, resource group and resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: OpenShiftCluster or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftCluster - :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-04-01")) - cls: ClsType[_models.OpenShiftCluster] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenShiftCluster", 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, - resource_name: str, - parameters: Union[_models.OpenShiftCluster, IO[bytes]], - **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-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(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "OpenShiftCluster") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - 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 = 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]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.OpenShiftCluster, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftCluster - :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 OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :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: An instance of LROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - parameters: Union[_models.OpenShiftCluster, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a OpenShiftCluster type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftCluster or IO[bytes] - :return: An instance of LROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftCluster] - :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-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OpenShiftCluster] = 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, - resource_name=resource_name, - parameters=parameters, - 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("OpenShiftCluster", 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.OpenShiftCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OpenShiftCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, resource_name: str, **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-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes a OpenShift cluster with the specified subscription, resource group and resource name. - - The operation returns nothing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: 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-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, - resource_name=resource_name, - 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, **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 _update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: Union[_models.OpenShiftClusterUpdate, IO[bytes]], - **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-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(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "OpenShiftClusterUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - 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 = 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]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.OpenShiftClusterUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftClusterUpdate - :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 OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :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: An instance of LROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - resource_name: str, - parameters: Union[_models.OpenShiftClusterUpdate, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a OpenShiftClusterUpdate type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftClusterUpdate or - IO[bytes] - :return: An instance of LROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftCluster] - :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-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OpenShiftCluster] = 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, - resource_name=resource_name, - parameters=parameters, - 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("OpenShiftCluster", 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.OpenShiftCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OpenShiftCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_admin_credentials( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.OpenShiftClusterAdminKubeconfig: - """Lists admin kubeconfig of an OpenShift cluster with the specified subscription, resource group - and resource name. - - The operation returns the admin kubeconfig. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: OpenShiftClusterAdminKubeconfig or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftClusterAdminKubeconfig - :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-04-01")) - cls: ClsType[_models.OpenShiftClusterAdminKubeconfig] = kwargs.pop("cls", None) - - _request = build_list_admin_credentials_request( - resource_group_name=resource_group_name, - resource_name=resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenShiftClusterAdminKubeconfig", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_credentials( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.OpenShiftClusterCredentials: - """Lists credentials of an OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns the credentials. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: OpenShiftClusterCredentials or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_04_01.models.OpenShiftClusterCredentials - :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-04-01")) - cls: ClsType[_models.OpenShiftClusterCredentials] = kwargs.pop("cls", None) - - _request = build_list_credentials_request( - resource_group_name=resource_group_name, - resource_name=resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenShiftClusterCredentials", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/operations/_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/operations/_operations.py deleted file mode 100644 index ff44876b6eae..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_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", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.RedHatOpenShift/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.redhatopenshift.v2022_04_01.AzureRedHatOpenShiftClient`'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"]: - """Lists all of the available RP operations. - - The operation returns the RP operations. - - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2022_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 "2022-04-01")) - cls: ClsType[_models.OperationList] = 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("OperationList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/operations/_patch.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/py.typed b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_04_01/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/__init__.py deleted file mode 100644 index c64163c98d3d..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/__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 ._azure_red_hat_open_shift_client import AzureRedHatOpenShiftClient -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__ = [ - "AzureRedHatOpenShiftClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/_azure_red_hat_open_shift_client.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/_azure_red_hat_open_shift_client.py deleted file mode 100644 index 9dd6195847d1..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/_azure_red_hat_open_shift_client.py +++ /dev/null @@ -1,152 +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 AzureRedHatOpenShiftClientConfiguration -from .operations import ( - MachinePoolsOperations, - OpenShiftClustersOperations, - OpenShiftVersionsOperations, - Operations, - SecretsOperations, - SyncIdentityProvidersOperations, - SyncSetsOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class AzureRedHatOpenShiftClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """Rest API for Azure Red Hat OpenShift 4. - - :ivar operations: Operations operations - :vartype operations: azure.mgmt.redhatopenshift.v2022_09_04.operations.Operations - :ivar open_shift_versions: OpenShiftVersionsOperations operations - :vartype open_shift_versions: - azure.mgmt.redhatopenshift.v2022_09_04.operations.OpenShiftVersionsOperations - :ivar open_shift_clusters: OpenShiftClustersOperations operations - :vartype open_shift_clusters: - azure.mgmt.redhatopenshift.v2022_09_04.operations.OpenShiftClustersOperations - :ivar machine_pools: MachinePoolsOperations operations - :vartype machine_pools: - azure.mgmt.redhatopenshift.v2022_09_04.operations.MachinePoolsOperations - :ivar secrets: SecretsOperations operations - :vartype secrets: azure.mgmt.redhatopenshift.v2022_09_04.operations.SecretsOperations - :ivar sync_identity_providers: SyncIdentityProvidersOperations operations - :vartype sync_identity_providers: - azure.mgmt.redhatopenshift.v2022_09_04.operations.SyncIdentityProvidersOperations - :ivar sync_sets: SyncSetsOperations operations - :vartype sync_sets: azure.mgmt.redhatopenshift.v2022_09_04.operations.SyncSetsOperations - :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-04". 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 = AzureRedHatOpenShiftClientConfiguration( - 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-04") - self.open_shift_versions = OpenShiftVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-04" - ) - self.open_shift_clusters = OpenShiftClustersOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-04" - ) - self.machine_pools = MachinePoolsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-04" - ) - self.secrets = SecretsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-09-04") - self.sync_identity_providers = SyncIdentityProvidersOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-04" - ) - self.sync_sets = SyncSetsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-04" - ) - - 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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/_configuration.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/_configuration.py deleted file mode 100644 index 5f0bb23f26ee..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/_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 AzureRedHatOpenShiftClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for AzureRedHatOpenShiftClient. - - 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-04". 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-04") - - 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-redhatopenshift/{}".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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/_metadata.json b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/_metadata.json deleted file mode 100644 index 7760cf858870..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/_metadata.json +++ /dev/null @@ -1,116 +0,0 @@ -{ - "chosen_version": "2022-09-04", - "total_api_version_list": ["2022-09-04"], - "client": { - "name": "AzureRedHatOpenShiftClient", - "filename": "_azure_red_hat_open_shift_client", - "description": "Rest API for Azure Red Hat OpenShift 4.", - "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\": [\"AzureRedHatOpenShiftClientConfiguration\"], \".._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\": [\"AzureRedHatOpenShiftClientConfiguration\"], \"..._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", - "open_shift_versions": "OpenShiftVersionsOperations", - "open_shift_clusters": "OpenShiftClustersOperations", - "machine_pools": "MachinePoolsOperations", - "secrets": "SecretsOperations", - "sync_identity_providers": "SyncIdentityProvidersOperations", - "sync_sets": "SyncSetsOperations" - } -} diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/_patch.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/_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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/_version.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/_version.py deleted file mode 100644 index b2efd13ce94d..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/_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 = "1.5.0" diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/__init__.py deleted file mode 100644 index b06f0016da77..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/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 ._azure_red_hat_open_shift_client import AzureRedHatOpenShiftClient - -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__ = [ - "AzureRedHatOpenShiftClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/_azure_red_hat_open_shift_client.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/_azure_red_hat_open_shift_client.py deleted file mode 100644 index 4e843b6379ba..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/_azure_red_hat_open_shift_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 AzureRedHatOpenShiftClientConfiguration -from .operations import ( - MachinePoolsOperations, - OpenShiftClustersOperations, - OpenShiftVersionsOperations, - Operations, - SecretsOperations, - SyncIdentityProvidersOperations, - SyncSetsOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class AzureRedHatOpenShiftClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """Rest API for Azure Red Hat OpenShift 4. - - :ivar operations: Operations operations - :vartype operations: azure.mgmt.redhatopenshift.v2022_09_04.aio.operations.Operations - :ivar open_shift_versions: OpenShiftVersionsOperations operations - :vartype open_shift_versions: - azure.mgmt.redhatopenshift.v2022_09_04.aio.operations.OpenShiftVersionsOperations - :ivar open_shift_clusters: OpenShiftClustersOperations operations - :vartype open_shift_clusters: - azure.mgmt.redhatopenshift.v2022_09_04.aio.operations.OpenShiftClustersOperations - :ivar machine_pools: MachinePoolsOperations operations - :vartype machine_pools: - azure.mgmt.redhatopenshift.v2022_09_04.aio.operations.MachinePoolsOperations - :ivar secrets: SecretsOperations operations - :vartype secrets: azure.mgmt.redhatopenshift.v2022_09_04.aio.operations.SecretsOperations - :ivar sync_identity_providers: SyncIdentityProvidersOperations operations - :vartype sync_identity_providers: - azure.mgmt.redhatopenshift.v2022_09_04.aio.operations.SyncIdentityProvidersOperations - :ivar sync_sets: SyncSetsOperations operations - :vartype sync_sets: azure.mgmt.redhatopenshift.v2022_09_04.aio.operations.SyncSetsOperations - :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-04". 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 = AzureRedHatOpenShiftClientConfiguration( - 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-04") - self.open_shift_versions = OpenShiftVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-04" - ) - self.open_shift_clusters = OpenShiftClustersOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-04" - ) - self.machine_pools = MachinePoolsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-04" - ) - self.secrets = SecretsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-09-04") - self.sync_identity_providers = SyncIdentityProvidersOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-04" - ) - self.sync_sets = SyncSetsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-04" - ) - - 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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/_configuration.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/_configuration.py deleted file mode 100644 index a969268adc6f..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/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 AzureRedHatOpenShiftClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for AzureRedHatOpenShiftClient. - - 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-04". 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-04") - - 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-redhatopenshift/{}".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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/_patch.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_machine_pools_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_machine_pools_operations.py deleted file mode 100644 index 703504f35336..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_machine_pools_operations.py +++ /dev/null @@ -1,568 +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, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload -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.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._machine_pools_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_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 MachinePoolsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2022_09_04.aio.AzureRedHatOpenShiftClient`'s - :attr:`machine_pools` 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, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.MachinePool"]: - """Lists MachinePools that belong to that Azure Red Hat OpenShift Cluster. - - The operation returns properties of each MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: An iterator like instance of either MachinePool or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) 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-04")) - cls: ClsType[_models.MachinePoolList] = 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( - resource_group_name=resource_group_name, - resource_name=resource_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("MachinePoolList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> _models.MachinePool: - """Gets a MachinePool with the specified subscription, resource group and resource name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool - :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-04")) - cls: ClsType[_models.MachinePool] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MachinePool", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.MachinePool, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MachinePool: - """Creates or updates a MachinePool with the specified subscription, resource group and resource - name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :param parameters: The MachinePool resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MachinePool: - """Creates or updates a MachinePool with the specified subscription, resource group and resource - name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :param parameters: The MachinePool resource. Required. - :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: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.MachinePool, IO[bytes]], - **kwargs: Any - ) -> _models.MachinePool: - """Creates or updates a MachinePool with the specified subscription, resource group and resource - name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :param parameters: The MachinePool resource. Is either a MachinePool type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool or IO[bytes] - :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool - :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-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MachinePool] = 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, "MachinePool") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("MachinePool", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("MachinePool", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> None: - """Deletes a MachinePool with the specified subscription, resource group and resource name. - - The operation returns nothing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :return: None or the result of cls(response) - :rtype: None - :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-04")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.MachinePoolUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MachinePool: - """Updates a MachinePool with the specified subscription, resource group and resource name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :param parameters: The MachinePool resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePoolUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MachinePool: - """Updates a MachinePool with the specified subscription, resource group and resource name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :param parameters: The MachinePool resource. Required. - :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: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.MachinePoolUpdate, IO[bytes]], - **kwargs: Any - ) -> _models.MachinePool: - """Updates a MachinePool with the specified subscription, resource group and resource name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :param parameters: The MachinePool resource. Is either a MachinePoolUpdate type or a IO[bytes] - type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePoolUpdate or IO[bytes] - :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool - :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-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MachinePool] = 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, "MachinePoolUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MachinePool", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_open_shift_clusters_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_open_shift_clusters_operations.py deleted file mode 100644 index 65c83689064e..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_open_shift_clusters_operations.py +++ /dev/null @@ -1,921 +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, - 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._open_shift_clusters_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_admin_credentials_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 OpenShiftClustersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2022_09_04.aio.AzureRedHatOpenShiftClient`'s - :attr:`open_shift_clusters` 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.OpenShiftCluster"]: - """Lists OpenShift clusters in the specified subscription. - - The operation returns properties of each OpenShift cluster. - - :return: An iterator like instance of either OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) 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-04")) - cls: ClsType[_models.OpenShiftClusterList] = 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("OpenShiftClusterList", 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) - raise HttpResponseError(response=response, 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.OpenShiftCluster"]: - """Lists OpenShift clusters in the specified subscription and resource group. - - The operation returns properties of each OpenShift cluster. - - :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 OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) 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-04")) - cls: ClsType[_models.OpenShiftClusterList] = 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("OpenShiftClusterList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.OpenShiftCluster: - """Gets a OpenShift cluster with the specified subscription, resource group and resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: OpenShiftCluster or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster - :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-04")) - cls: ClsType[_models.OpenShiftCluster] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenShiftCluster", 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, - resource_name: str, - parameters: Union[_models.OpenShiftCluster, IO[bytes]], - **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-04")) - 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, "OpenShiftCluster") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - 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 = 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]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - 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, - resource_name: str, - parameters: _models.OpenShiftCluster, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster - :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 OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :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: An instance of AsyncLROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - parameters: Union[_models.OpenShiftCluster, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a OpenShiftCluster type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster or IO[bytes] - :return: An instance of AsyncLROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] - :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-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OpenShiftCluster] = 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, - resource_name=resource_name, - parameters=parameters, - 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("OpenShiftCluster", 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.OpenShiftCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OpenShiftCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, resource_name: str, **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-04")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - 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, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Deletes a OpenShift cluster with the specified subscription, resource group and resource name. - - The operation returns nothing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: 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-04")) - 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, - resource_name=resource_name, - 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, **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 _update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: Union[_models.OpenShiftClusterUpdate, IO[bytes]], - **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-04")) - 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, "OpenShiftClusterUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - 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 = 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]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.OpenShiftClusterUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftClusterUpdate - :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 OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :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: An instance of AsyncLROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - resource_name: str, - parameters: Union[_models.OpenShiftClusterUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a OpenShiftClusterUpdate type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftClusterUpdate or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] - :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-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OpenShiftCluster] = 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, - resource_name=resource_name, - parameters=parameters, - 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("OpenShiftCluster", 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.OpenShiftCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OpenShiftCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace_async - async def list_admin_credentials( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.OpenShiftClusterAdminKubeconfig: - """Lists admin kubeconfig of an OpenShift cluster with the specified subscription, resource group - and resource name. - - The operation returns the admin kubeconfig. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: OpenShiftClusterAdminKubeconfig or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftClusterAdminKubeconfig - :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-04")) - cls: ClsType[_models.OpenShiftClusterAdminKubeconfig] = kwargs.pop("cls", None) - - _request = build_list_admin_credentials_request( - resource_group_name=resource_group_name, - resource_name=resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenShiftClusterAdminKubeconfig", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def list_credentials( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.OpenShiftClusterCredentials: - """Lists credentials of an OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns the credentials. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: OpenShiftClusterCredentials or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftClusterCredentials - :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-04")) - cls: ClsType[_models.OpenShiftClusterCredentials] = kwargs.pop("cls", None) - - _request = build_list_credentials_request( - resource_group_name=resource_group_name, - resource_name=resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenShiftClusterCredentials", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_open_shift_versions_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_open_shift_versions_operations.py deleted file mode 100644 index c92ac2e53403..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_open_shift_versions_operations.py +++ /dev/null @@ -1,137 +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._open_shift_versions_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 OpenShiftVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2022_09_04.aio.AzureRedHatOpenShiftClient`'s - :attr:`open_shift_versions` 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, location: str, **kwargs: Any) -> AsyncIterable["_models.OpenShiftVersion"]: - """Lists all OpenShift versions available to install in the specified location. - - The operation returns the installable OpenShift versions as strings. - - :param location: The name of Azure region. Required. - :type location: str - :return: An iterator like instance of either OpenShiftVersion or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) 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-04")) - cls: ClsType[_models.OpenShiftVersionList] = 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( - location=location, - 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("OpenShiftVersionList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_operations.py deleted file mode 100644 index 9538bc2d1f8f..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_operations.py +++ /dev/null @@ -1,133 +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.redhatopenshift.v2022_09_04.aio.AzureRedHatOpenShiftClient`'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"]: - """Lists all of the available RP operations. - - The operation returns the RP operations. - - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.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-04")) - cls: ClsType[_models.OperationList] = 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("OperationList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_patch.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_secrets_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_secrets_operations.py deleted file mode 100644 index 93bc29dcebf7..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_secrets_operations.py +++ /dev/null @@ -1,564 +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, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload -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.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._secrets_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_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 SecretsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2022_09_04.aio.AzureRedHatOpenShiftClient`'s - :attr:`secrets` 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, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.Secret"]: - """Lists Secrets that belong to that Azure Red Hat OpenShift Cluster. - - The operation returns properties of each Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: An iterator like instance of either Secret or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) 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-04")) - cls: ClsType[_models.SecretList] = 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( - resource_group_name=resource_group_name, - resource_name=resource_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("SecretList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> _models.Secret: - """Gets a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret - :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-04")) - cls: ClsType[_models.Secret] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Secret", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.Secret, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Secret: - """Creates or updates a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :param parameters: The Secret resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Secret: - """Creates or updates a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :param parameters: The Secret resource. Required. - :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: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.Secret, IO[bytes]], - **kwargs: Any - ) -> _models.Secret: - """Creates or updates a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :param parameters: The Secret resource. Is either a Secret type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret or IO[bytes] - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret - :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-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Secret] = 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, "Secret") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("Secret", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Secret", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> None: - """Deletes a Secret with the specified subscription, resource group and resource name. - - The operation returns nothing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :return: None or the result of cls(response) - :rtype: None - :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-04")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.SecretUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Secret: - """Updates a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :param parameters: The Secret resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SecretUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Secret: - """Updates a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :param parameters: The Secret resource. Required. - :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: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.SecretUpdate, IO[bytes]], - **kwargs: Any - ) -> _models.Secret: - """Updates a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :param parameters: The Secret resource. Is either a SecretUpdate type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SecretUpdate or IO[bytes] - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret - :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-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Secret] = 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, "SecretUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Secret", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_sync_identity_providers_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_sync_identity_providers_operations.py deleted file mode 100644 index 1cc0ac3e7dab..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/aio/operations/_sync_identity_providers_operations.py +++ /dev/null @@ -1,577 +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, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload -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.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._sync_identity_providers_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_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 SyncIdentityProvidersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2022_09_04.aio.AzureRedHatOpenShiftClient`'s - :attr:`sync_identity_providers` 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, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SyncIdentityProvider"]: - """Lists SyncIdentityProviders that belong to that Azure Red Hat OpenShift Cluster. - - The operation returns properties of each SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: An iterator like instance of either SyncIdentityProvider or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) 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-04")) - cls: ClsType[_models.SyncIdentityProviderList] = 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( - resource_group_name=resource_group_name, - resource_name=resource_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("SyncIdentityProviderList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Gets a SyncIdentityProvider with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider - :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-04")) - cls: ClsType[_models.SyncIdentityProvider] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SyncIdentityProvider", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.SyncIdentityProvider, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Creates or updates a SyncIdentityProvider with the specified subscription, resource group and - resource name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Creates or updates a SyncIdentityProvider with the specified subscription, resource group and - resource name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Required. - :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: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.SyncIdentityProvider, IO[bytes]], - **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Creates or updates a SyncIdentityProvider with the specified subscription, resource group and - resource name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Is either a SyncIdentityProvider type or - a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider or - IO[bytes] - :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider - :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-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SyncIdentityProvider] = 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, "SyncIdentityProvider") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("SyncIdentityProvider", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SyncIdentityProvider", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> None: - """Deletes a SyncIdentityProvider with the specified subscription, resource group and resource - name. - - The operation returns nothing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :return: None or the result of cls(response) - :rtype: None - :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-04")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.SyncIdentityProviderUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Updates a SyncIdentityProvider with the specified subscription, resource group and resource - name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProviderUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Updates a SyncIdentityProvider with the specified subscription, resource group and resource - name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Required. - :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: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.SyncIdentityProviderUpdate, IO[bytes]], - **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Updates a SyncIdentityProvider with the specified subscription, resource group and resource - name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Is either a SyncIdentityProviderUpdate - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProviderUpdate or - IO[bytes] - :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider - :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-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SyncIdentityProvider] = 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, "SyncIdentityProviderUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SyncIdentityProvider", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/models/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/models/__init__.py deleted file mode 100644 index 60aa421e93a2..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/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 APIServerProfile -from ._models_py3 import CloudErrorBody -from ._models_py3 import ClusterProfile -from ._models_py3 import ConsoleProfile -from ._models_py3 import Display -from ._models_py3 import IngressProfile -from ._models_py3 import MachinePool -from ._models_py3 import MachinePoolList -from ._models_py3 import MachinePoolUpdate -from ._models_py3 import MasterProfile -from ._models_py3 import NetworkProfile -from ._models_py3 import OpenShiftCluster -from ._models_py3 import OpenShiftClusterAdminKubeconfig -from ._models_py3 import OpenShiftClusterCredentials -from ._models_py3 import OpenShiftClusterList -from ._models_py3 import OpenShiftClusterUpdate -from ._models_py3 import OpenShiftVersion -from ._models_py3 import OpenShiftVersionList -from ._models_py3 import Operation -from ._models_py3 import OperationList -from ._models_py3 import ProxyResource -from ._models_py3 import Resource -from ._models_py3 import Secret -from ._models_py3 import SecretList -from ._models_py3 import SecretUpdate -from ._models_py3 import ServicePrincipalProfile -from ._models_py3 import SyncIdentityProvider -from ._models_py3 import SyncIdentityProviderList -from ._models_py3 import SyncIdentityProviderUpdate -from ._models_py3 import SyncSet -from ._models_py3 import SyncSetList -from ._models_py3 import SyncSetUpdate -from ._models_py3 import SystemData -from ._models_py3 import TrackedResource -from ._models_py3 import WorkerProfile - -from ._azure_red_hat_open_shift_client_enums import CreatedByType -from ._azure_red_hat_open_shift_client_enums import EncryptionAtHost -from ._azure_red_hat_open_shift_client_enums import FipsValidatedModules -from ._azure_red_hat_open_shift_client_enums import ProvisioningState -from ._azure_red_hat_open_shift_client_enums import Visibility -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "APIServerProfile", - "CloudErrorBody", - "ClusterProfile", - "ConsoleProfile", - "Display", - "IngressProfile", - "MachinePool", - "MachinePoolList", - "MachinePoolUpdate", - "MasterProfile", - "NetworkProfile", - "OpenShiftCluster", - "OpenShiftClusterAdminKubeconfig", - "OpenShiftClusterCredentials", - "OpenShiftClusterList", - "OpenShiftClusterUpdate", - "OpenShiftVersion", - "OpenShiftVersionList", - "Operation", - "OperationList", - "ProxyResource", - "Resource", - "Secret", - "SecretList", - "SecretUpdate", - "ServicePrincipalProfile", - "SyncIdentityProvider", - "SyncIdentityProviderList", - "SyncIdentityProviderUpdate", - "SyncSet", - "SyncSetList", - "SyncSetUpdate", - "SystemData", - "TrackedResource", - "WorkerProfile", - "CreatedByType", - "EncryptionAtHost", - "FipsValidatedModules", - "ProvisioningState", - "Visibility", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/models/_azure_red_hat_open_shift_client_enums.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/models/_azure_red_hat_open_shift_client_enums.py deleted file mode 100644 index 7ca1dc70ec55..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/models/_azure_red_hat_open_shift_client_enums.py +++ /dev/null @@ -1,51 +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 EncryptionAtHost(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """EncryptionAtHost represents encryption at host state.""" - - DISABLED = "Disabled" - ENABLED = "Enabled" - - -class FipsValidatedModules(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """FipsValidatedModules determines if FIPS is used.""" - - DISABLED = "Disabled" - ENABLED = "Enabled" - - -class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ProvisioningState represents a provisioning state.""" - - ADMIN_UPDATING = "AdminUpdating" - CREATING = "Creating" - DELETING = "Deleting" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class Visibility(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Visibility represents visibility.""" - - PRIVATE = "Private" - PUBLIC = "Public" diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/models/_models_py3.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/models/_models_py3.py deleted file mode 100644 index b0b8f3e12a1a..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/models/_models_py3.py +++ /dev/null @@ -1,1497 +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 APIServerProfile(_serialization.Model): - """APIServerProfile represents an API server profile. - - :ivar visibility: API server visibility. Known values are: "Private" and "Public". - :vartype visibility: str or ~azure.mgmt.redhatopenshift.v2022_09_04.models.Visibility - :ivar url: The URL to access the cluster API server. - :vartype url: str - :ivar ip: The IP of the cluster API server. - :vartype ip: str - """ - - _attribute_map = { - "visibility": {"key": "visibility", "type": "str"}, - "url": {"key": "url", "type": "str"}, - "ip": {"key": "ip", "type": "str"}, - } - - def __init__( - self, - *, - visibility: Optional[Union[str, "_models.Visibility"]] = None, - url: Optional[str] = None, - ip: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword visibility: API server visibility. Known values are: "Private" and "Public". - :paramtype visibility: str or ~azure.mgmt.redhatopenshift.v2022_09_04.models.Visibility - :keyword url: The URL to access the cluster API server. - :paramtype url: str - :keyword ip: The IP of the cluster API server. - :paramtype ip: str - """ - super().__init__(**kwargs) - self.visibility = visibility - self.url = url - self.ip = ip - - -class CloudErrorBody(_serialization.Model): - """CloudErrorBody represents the body of a cloud error. - - :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :vartype code: str - :ivar message: A message describing the error, intended to be suitable for display in a user - interface. - :vartype message: str - :ivar target: The target of the particular error. For example, the name of the property in - error. - :vartype target: str - :ivar details: A list of additional details about the error. - :vartype details: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.CloudErrorBody] - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[CloudErrorBody]"}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[List["_models.CloudErrorBody"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :paramtype code: str - :keyword message: A message describing the error, intended to be suitable for display in a user - interface. - :paramtype message: str - :keyword target: The target of the particular error. For example, the name of the property in - error. - :paramtype target: str - :keyword details: A list of additional details about the error. - :paramtype details: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.CloudErrorBody] - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - -class ClusterProfile(_serialization.Model): - """ClusterProfile represents a cluster profile. - - :ivar pull_secret: The pull secret for the cluster. - :vartype pull_secret: str - :ivar domain: The domain for the cluster. - :vartype domain: str - :ivar version: The version of the cluster. - :vartype version: str - :ivar resource_group_id: The ID of the cluster resource group. - :vartype resource_group_id: str - :ivar fips_validated_modules: If FIPS validated crypto modules are used. Known values are: - "Disabled" and "Enabled". - :vartype fips_validated_modules: str or - ~azure.mgmt.redhatopenshift.v2022_09_04.models.FipsValidatedModules - """ - - _attribute_map = { - "pull_secret": {"key": "pullSecret", "type": "str"}, - "domain": {"key": "domain", "type": "str"}, - "version": {"key": "version", "type": "str"}, - "resource_group_id": {"key": "resourceGroupId", "type": "str"}, - "fips_validated_modules": {"key": "fipsValidatedModules", "type": "str"}, - } - - def __init__( - self, - *, - pull_secret: Optional[str] = None, - domain: Optional[str] = None, - version: Optional[str] = None, - resource_group_id: Optional[str] = None, - fips_validated_modules: Optional[Union[str, "_models.FipsValidatedModules"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword pull_secret: The pull secret for the cluster. - :paramtype pull_secret: str - :keyword domain: The domain for the cluster. - :paramtype domain: str - :keyword version: The version of the cluster. - :paramtype version: str - :keyword resource_group_id: The ID of the cluster resource group. - :paramtype resource_group_id: str - :keyword fips_validated_modules: If FIPS validated crypto modules are used. Known values are: - "Disabled" and "Enabled". - :paramtype fips_validated_modules: str or - ~azure.mgmt.redhatopenshift.v2022_09_04.models.FipsValidatedModules - """ - super().__init__(**kwargs) - self.pull_secret = pull_secret - self.domain = domain - self.version = version - self.resource_group_id = resource_group_id - self.fips_validated_modules = fips_validated_modules - - -class ConsoleProfile(_serialization.Model): - """ConsoleProfile represents a console profile. - - :ivar url: The URL to access the cluster console. - :vartype url: str - """ - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - } - - def __init__(self, *, url: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword url: The URL to access the cluster console. - :paramtype url: str - """ - super().__init__(**kwargs) - self.url = url - - -class Display(_serialization.Model): - """Display represents the display details of an operation. - - :ivar provider: Friendly name of the resource provider. - :vartype provider: str - :ivar resource: Resource type on which the operation is performed. - :vartype resource: str - :ivar operation: Operation type: read, write, delete, listKeys/action, etc. - :vartype operation: str - :ivar description: Friendly name of the operation. - :vartype description: str - """ - - _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__( - self, - *, - provider: Optional[str] = None, - resource: Optional[str] = None, - operation: Optional[str] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword provider: Friendly name of the resource provider. - :paramtype provider: str - :keyword resource: Resource type on which the operation is performed. - :paramtype resource: str - :keyword operation: Operation type: read, write, delete, listKeys/action, etc. - :paramtype operation: str - :keyword description: Friendly name of the operation. - :paramtype description: str - """ - super().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class IngressProfile(_serialization.Model): - """IngressProfile represents an ingress profile. - - :ivar name: The ingress profile name. - :vartype name: str - :ivar visibility: Ingress visibility. Known values are: "Private" and "Public". - :vartype visibility: str or ~azure.mgmt.redhatopenshift.v2022_09_04.models.Visibility - :ivar ip: The IP of the ingress. - :vartype ip: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "visibility": {"key": "visibility", "type": "str"}, - "ip": {"key": "ip", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - visibility: Optional[Union[str, "_models.Visibility"]] = None, - ip: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The ingress profile name. - :paramtype name: str - :keyword visibility: Ingress visibility. Known values are: "Private" and "Public". - :paramtype visibility: str or ~azure.mgmt.redhatopenshift.v2022_09_04.models.Visibility - :keyword ip: The IP of the ingress. - :paramtype ip: str - """ - super().__init__(**kwargs) - self.name = name - self.visibility = visibility - self.ip = ip - - -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.redhatopenshift.v2022_09_04.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have - tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SystemData - """ - - -class MachinePool(ProxyResource): - """MachinePool represents a MachinePool. - - 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.redhatopenshift.v2022_09_04.models.SystemData - :ivar resources: - :vartype resources: str - """ - - _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"}, - "resources": {"key": "properties.resources", "type": "str"}, - } - - def __init__(self, *, resources: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword resources: - :paramtype resources: str - """ - super().__init__(**kwargs) - self.resources = resources - - -class MachinePoolList(_serialization.Model): - """MachinePoolList represents a list of MachinePools. - - :ivar value: The list of Machine Pools. - :vartype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool] - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[MachinePool]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.MachinePool"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of Machine Pools. - :paramtype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool] - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class MachinePoolUpdate(_serialization.Model): - """MachinePool represents a MachinePool. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SystemData - :ivar resources: - :vartype resources: str - """ - - _validation = { - "system_data": {"readonly": True}, - } - - _attribute_map = { - "system_data": {"key": "systemData", "type": "SystemData"}, - "resources": {"key": "properties.resources", "type": "str"}, - } - - def __init__(self, *, resources: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword resources: - :paramtype resources: str - """ - super().__init__(**kwargs) - self.system_data = None - self.resources = resources - - -class MasterProfile(_serialization.Model): - """MasterProfile represents a master profile. - - :ivar vm_size: The size of the master VMs. - :vartype vm_size: str - :ivar subnet_id: The Azure resource ID of the master subnet. - :vartype subnet_id: str - :ivar encryption_at_host: Whether master virtual machines are encrypted at host. Known values - are: "Disabled" and "Enabled". - :vartype encryption_at_host: str or - ~azure.mgmt.redhatopenshift.v2022_09_04.models.EncryptionAtHost - :ivar disk_encryption_set_id: The resource ID of an associated DiskEncryptionSet, if - applicable. - :vartype disk_encryption_set_id: str - """ - - _attribute_map = { - "vm_size": {"key": "vmSize", "type": "str"}, - "subnet_id": {"key": "subnetId", "type": "str"}, - "encryption_at_host": {"key": "encryptionAtHost", "type": "str"}, - "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, - } - - def __init__( - self, - *, - vm_size: Optional[str] = None, - subnet_id: Optional[str] = None, - encryption_at_host: Optional[Union[str, "_models.EncryptionAtHost"]] = None, - disk_encryption_set_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword vm_size: The size of the master VMs. - :paramtype vm_size: str - :keyword subnet_id: The Azure resource ID of the master subnet. - :paramtype subnet_id: str - :keyword encryption_at_host: Whether master virtual machines are encrypted at host. Known - values are: "Disabled" and "Enabled". - :paramtype encryption_at_host: str or - ~azure.mgmt.redhatopenshift.v2022_09_04.models.EncryptionAtHost - :keyword disk_encryption_set_id: The resource ID of an associated DiskEncryptionSet, if - applicable. - :paramtype disk_encryption_set_id: str - """ - super().__init__(**kwargs) - self.vm_size = vm_size - self.subnet_id = subnet_id - self.encryption_at_host = encryption_at_host - self.disk_encryption_set_id = disk_encryption_set_id - - -class NetworkProfile(_serialization.Model): - """NetworkProfile represents a network profile. - - :ivar pod_cidr: The CIDR used for OpenShift/Kubernetes Pods. - :vartype pod_cidr: str - :ivar service_cidr: The CIDR used for OpenShift/Kubernetes Services. - :vartype service_cidr: str - """ - - _attribute_map = { - "pod_cidr": {"key": "podCidr", "type": "str"}, - "service_cidr": {"key": "serviceCidr", "type": "str"}, - } - - def __init__(self, *, pod_cidr: Optional[str] = None, service_cidr: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword pod_cidr: The CIDR used for OpenShift/Kubernetes Pods. - :paramtype pod_cidr: str - :keyword service_cidr: The CIDR used for OpenShift/Kubernetes Services. - :paramtype service_cidr: str - """ - super().__init__(**kwargs) - self.pod_cidr = pod_cidr - self.service_cidr = service_cidr - - -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.redhatopenshift.v2022_09_04.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 OpenShiftCluster(TrackedResource): # pylint: disable=too-many-instance-attributes - """OpenShiftCluster represents an Azure Red Hat OpenShift cluster. - - 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.redhatopenshift.v2022_09_04.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 provisioning_state: The cluster provisioning state. Known values are: "AdminUpdating", - "Creating", "Deleting", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.redhatopenshift.v2022_09_04.models.ProvisioningState - :ivar cluster_profile: The cluster profile. - :vartype cluster_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.ClusterProfile - :ivar console_profile: The console profile. - :vartype console_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.ConsoleProfile - :ivar service_principal_profile: The cluster service principal profile. - :vartype service_principal_profile: - ~azure.mgmt.redhatopenshift.v2022_09_04.models.ServicePrincipalProfile - :ivar network_profile: The cluster network profile. - :vartype network_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.NetworkProfile - :ivar master_profile: The cluster master profile. - :vartype master_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MasterProfile - :ivar worker_profiles: The cluster worker profiles. - :vartype worker_profiles: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.WorkerProfile] - :ivar apiserver_profile: The cluster API server profile. - :vartype apiserver_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.APIServerProfile - :ivar ingress_profiles: The cluster ingress profiles. - :vartype ingress_profiles: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.IngressProfile] - """ - - _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"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "cluster_profile": {"key": "properties.clusterProfile", "type": "ClusterProfile"}, - "console_profile": {"key": "properties.consoleProfile", "type": "ConsoleProfile"}, - "service_principal_profile": {"key": "properties.servicePrincipalProfile", "type": "ServicePrincipalProfile"}, - "network_profile": {"key": "properties.networkProfile", "type": "NetworkProfile"}, - "master_profile": {"key": "properties.masterProfile", "type": "MasterProfile"}, - "worker_profiles": {"key": "properties.workerProfiles", "type": "[WorkerProfile]"}, - "apiserver_profile": {"key": "properties.apiserverProfile", "type": "APIServerProfile"}, - "ingress_profiles": {"key": "properties.ingressProfiles", "type": "[IngressProfile]"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, - cluster_profile: Optional["_models.ClusterProfile"] = None, - console_profile: Optional["_models.ConsoleProfile"] = None, - service_principal_profile: Optional["_models.ServicePrincipalProfile"] = None, - network_profile: Optional["_models.NetworkProfile"] = None, - master_profile: Optional["_models.MasterProfile"] = None, - worker_profiles: Optional[List["_models.WorkerProfile"]] = None, - apiserver_profile: Optional["_models.APIServerProfile"] = None, - ingress_profiles: Optional[List["_models.IngressProfile"]] = 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 provisioning_state: The cluster provisioning state. Known values are: "AdminUpdating", - "Creating", "Deleting", "Failed", "Succeeded", and "Updating". - :paramtype provisioning_state: str or - ~azure.mgmt.redhatopenshift.v2022_09_04.models.ProvisioningState - :keyword cluster_profile: The cluster profile. - :paramtype cluster_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.ClusterProfile - :keyword console_profile: The console profile. - :paramtype console_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.ConsoleProfile - :keyword service_principal_profile: The cluster service principal profile. - :paramtype service_principal_profile: - ~azure.mgmt.redhatopenshift.v2022_09_04.models.ServicePrincipalProfile - :keyword network_profile: The cluster network profile. - :paramtype network_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.NetworkProfile - :keyword master_profile: The cluster master profile. - :paramtype master_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MasterProfile - :keyword worker_profiles: The cluster worker profiles. - :paramtype worker_profiles: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.WorkerProfile] - :keyword apiserver_profile: The cluster API server profile. - :paramtype apiserver_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.APIServerProfile - :keyword ingress_profiles: The cluster ingress profiles. - :paramtype ingress_profiles: - list[~azure.mgmt.redhatopenshift.v2022_09_04.models.IngressProfile] - """ - super().__init__(tags=tags, location=location, **kwargs) - self.provisioning_state = provisioning_state - self.cluster_profile = cluster_profile - self.console_profile = console_profile - self.service_principal_profile = service_principal_profile - self.network_profile = network_profile - self.master_profile = master_profile - self.worker_profiles = worker_profiles - self.apiserver_profile = apiserver_profile - self.ingress_profiles = ingress_profiles - - -class OpenShiftClusterAdminKubeconfig(_serialization.Model): - """OpenShiftClusterAdminKubeconfig represents an OpenShift cluster's admin kubeconfig. - - :ivar kubeconfig: The base64-encoded kubeconfig file. - :vartype kubeconfig: str - """ - - _attribute_map = { - "kubeconfig": {"key": "kubeconfig", "type": "str"}, - } - - def __init__(self, *, kubeconfig: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword kubeconfig: The base64-encoded kubeconfig file. - :paramtype kubeconfig: str - """ - super().__init__(**kwargs) - self.kubeconfig = kubeconfig - - -class OpenShiftClusterCredentials(_serialization.Model): - """OpenShiftClusterCredentials represents an OpenShift cluster's credentials. - - :ivar kubeadmin_username: The username for the kubeadmin user. - :vartype kubeadmin_username: str - :ivar kubeadmin_password: The password for the kubeadmin user. - :vartype kubeadmin_password: str - """ - - _attribute_map = { - "kubeadmin_username": {"key": "kubeadminUsername", "type": "str"}, - "kubeadmin_password": {"key": "kubeadminPassword", "type": "str"}, - } - - def __init__( - self, *, kubeadmin_username: Optional[str] = None, kubeadmin_password: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword kubeadmin_username: The username for the kubeadmin user. - :paramtype kubeadmin_username: str - :keyword kubeadmin_password: The password for the kubeadmin user. - :paramtype kubeadmin_password: str - """ - super().__init__(**kwargs) - self.kubeadmin_username = kubeadmin_username - self.kubeadmin_password = kubeadmin_password - - -class OpenShiftClusterList(_serialization.Model): - """OpenShiftClusterList represents a list of OpenShift clusters. - - :ivar value: The list of OpenShift clusters. - :vartype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[OpenShiftCluster]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.OpenShiftCluster"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The list of OpenShift clusters. - :paramtype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class OpenShiftClusterUpdate(_serialization.Model): # pylint: disable=too-many-instance-attributes - """OpenShiftCluster represents an Azure Red Hat OpenShift cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar tags: The resource tags. - :vartype tags: dict[str, str] - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SystemData - :ivar provisioning_state: The cluster provisioning state. Known values are: "AdminUpdating", - "Creating", "Deleting", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.redhatopenshift.v2022_09_04.models.ProvisioningState - :ivar cluster_profile: The cluster profile. - :vartype cluster_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.ClusterProfile - :ivar console_profile: The console profile. - :vartype console_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.ConsoleProfile - :ivar service_principal_profile: The cluster service principal profile. - :vartype service_principal_profile: - ~azure.mgmt.redhatopenshift.v2022_09_04.models.ServicePrincipalProfile - :ivar network_profile: The cluster network profile. - :vartype network_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.NetworkProfile - :ivar master_profile: The cluster master profile. - :vartype master_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MasterProfile - :ivar worker_profiles: The cluster worker profiles. - :vartype worker_profiles: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.WorkerProfile] - :ivar apiserver_profile: The cluster API server profile. - :vartype apiserver_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.APIServerProfile - :ivar ingress_profiles: The cluster ingress profiles. - :vartype ingress_profiles: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.IngressProfile] - """ - - _validation = { - "system_data": {"readonly": True}, - } - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "cluster_profile": {"key": "properties.clusterProfile", "type": "ClusterProfile"}, - "console_profile": {"key": "properties.consoleProfile", "type": "ConsoleProfile"}, - "service_principal_profile": {"key": "properties.servicePrincipalProfile", "type": "ServicePrincipalProfile"}, - "network_profile": {"key": "properties.networkProfile", "type": "NetworkProfile"}, - "master_profile": {"key": "properties.masterProfile", "type": "MasterProfile"}, - "worker_profiles": {"key": "properties.workerProfiles", "type": "[WorkerProfile]"}, - "apiserver_profile": {"key": "properties.apiserverProfile", "type": "APIServerProfile"}, - "ingress_profiles": {"key": "properties.ingressProfiles", "type": "[IngressProfile]"}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, - cluster_profile: Optional["_models.ClusterProfile"] = None, - console_profile: Optional["_models.ConsoleProfile"] = None, - service_principal_profile: Optional["_models.ServicePrincipalProfile"] = None, - network_profile: Optional["_models.NetworkProfile"] = None, - master_profile: Optional["_models.MasterProfile"] = None, - worker_profiles: Optional[List["_models.WorkerProfile"]] = None, - apiserver_profile: Optional["_models.APIServerProfile"] = None, - ingress_profiles: Optional[List["_models.IngressProfile"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: The resource tags. - :paramtype tags: dict[str, str] - :keyword provisioning_state: The cluster provisioning state. Known values are: "AdminUpdating", - "Creating", "Deleting", "Failed", "Succeeded", and "Updating". - :paramtype provisioning_state: str or - ~azure.mgmt.redhatopenshift.v2022_09_04.models.ProvisioningState - :keyword cluster_profile: The cluster profile. - :paramtype cluster_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.ClusterProfile - :keyword console_profile: The console profile. - :paramtype console_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.ConsoleProfile - :keyword service_principal_profile: The cluster service principal profile. - :paramtype service_principal_profile: - ~azure.mgmt.redhatopenshift.v2022_09_04.models.ServicePrincipalProfile - :keyword network_profile: The cluster network profile. - :paramtype network_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.NetworkProfile - :keyword master_profile: The cluster master profile. - :paramtype master_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MasterProfile - :keyword worker_profiles: The cluster worker profiles. - :paramtype worker_profiles: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.WorkerProfile] - :keyword apiserver_profile: The cluster API server profile. - :paramtype apiserver_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.APIServerProfile - :keyword ingress_profiles: The cluster ingress profiles. - :paramtype ingress_profiles: - list[~azure.mgmt.redhatopenshift.v2022_09_04.models.IngressProfile] - """ - super().__init__(**kwargs) - self.tags = tags - self.system_data = None - self.provisioning_state = provisioning_state - self.cluster_profile = cluster_profile - self.console_profile = console_profile - self.service_principal_profile = service_principal_profile - self.network_profile = network_profile - self.master_profile = master_profile - self.worker_profiles = worker_profiles - self.apiserver_profile = apiserver_profile - self.ingress_profiles = ingress_profiles - - -class OpenShiftVersion(ProxyResource): - """OpenShiftVersion represents an OpenShift version that can be installed. - - 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.redhatopenshift.v2022_09_04.models.SystemData - :ivar version: Version represents the version to create the cluster at. - :vartype version: str - """ - - _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"}, - "version": {"key": "properties.version", "type": "str"}, - } - - def __init__(self, *, version: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword version: Version represents the version to create the cluster at. - :paramtype version: str - """ - super().__init__(**kwargs) - self.version = version - - -class OpenShiftVersionList(_serialization.Model): - """OpenShiftVersionList represents a List of available versions. - - :ivar value: The List of available versions. - :vartype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftVersion] - :ivar next_link: Next Link to next operation. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[OpenShiftVersion]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.OpenShiftVersion"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The List of available versions. - :paramtype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftVersion] - :keyword next_link: Next Link to next operation. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class Operation(_serialization.Model): - """Operation represents an RP operation. - - :ivar name: Operation name: {provider}/{resource}/{operation}. - :vartype name: str - :ivar display: The object that describes the operation. - :vartype display: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Display - :ivar origin: Sources of requests to this operation. Comma separated list with valid values - user or system, e.g. "user,system". - :vartype origin: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "display": {"key": "display", "type": "Display"}, - "origin": {"key": "origin", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - display: Optional["_models.Display"] = None, - origin: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Operation name: {provider}/{resource}/{operation}. - :paramtype name: str - :keyword display: The object that describes the operation. - :paramtype display: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Display - :keyword origin: Sources of requests to this operation. Comma separated list with valid values - user or system, e.g. "user,system". - :paramtype origin: str - """ - super().__init__(**kwargs) - self.name = name - self.display = display - self.origin = origin - - -class OperationList(_serialization.Model): - """OperationList represents an RP operation list. - - :ivar value: List of operations supported by the resource provider. - :vartype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.Operation] - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Operation]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: List of operations supported by the resource provider. - :paramtype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.Operation] - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class Secret(ProxyResource): - """Secret represents a secret. - - 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.redhatopenshift.v2022_09_04.models.SystemData - :ivar secret_resources: The Secrets Resources. - :vartype secret_resources: str - """ - - _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"}, - "secret_resources": {"key": "properties.secretResources", "type": "str"}, - } - - def __init__(self, *, secret_resources: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword secret_resources: The Secrets Resources. - :paramtype secret_resources: str - """ - super().__init__(**kwargs) - self.secret_resources = secret_resources - - -class SecretList(_serialization.Model): - """SecretList represents a list of Secrets. - - :ivar value: The list of secrets. - :vartype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret] - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Secret]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.Secret"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of secrets. - :paramtype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret] - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SecretUpdate(_serialization.Model): - """Secret represents a secret. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SystemData - :ivar secret_resources: The Secrets Resources. - :vartype secret_resources: str - """ - - _validation = { - "system_data": {"readonly": True}, - } - - _attribute_map = { - "system_data": {"key": "systemData", "type": "SystemData"}, - "secret_resources": {"key": "properties.secretResources", "type": "str"}, - } - - def __init__(self, *, secret_resources: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword secret_resources: The Secrets Resources. - :paramtype secret_resources: str - """ - super().__init__(**kwargs) - self.system_data = None - self.secret_resources = secret_resources - - -class ServicePrincipalProfile(_serialization.Model): - """ServicePrincipalProfile represents a service principal profile. - - :ivar client_id: The client ID used for the cluster. - :vartype client_id: str - :ivar client_secret: The client secret used for the cluster. - :vartype client_secret: str - """ - - _attribute_map = { - "client_id": {"key": "clientId", "type": "str"}, - "client_secret": {"key": "clientSecret", "type": "str"}, - } - - def __init__(self, *, client_id: Optional[str] = None, client_secret: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword client_id: The client ID used for the cluster. - :paramtype client_id: str - :keyword client_secret: The client secret used for the cluster. - :paramtype client_secret: str - """ - super().__init__(**kwargs) - self.client_id = client_id - self.client_secret = client_secret - - -class SyncIdentityProvider(ProxyResource): - """SyncIdentityProvider represents a SyncIdentityProvider. - - 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.redhatopenshift.v2022_09_04.models.SystemData - :ivar resources: - :vartype resources: str - """ - - _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"}, - "resources": {"key": "properties.resources", "type": "str"}, - } - - def __init__(self, *, resources: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword resources: - :paramtype resources: str - """ - super().__init__(**kwargs) - self.resources = resources - - -class SyncIdentityProviderList(_serialization.Model): - """SyncSetList represents a list of SyncSets. - - :ivar value: The list of sync identity providers. - :vartype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider] - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[SyncIdentityProvider]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.SyncIdentityProvider"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The list of sync identity providers. - :paramtype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider] - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SyncIdentityProviderUpdate(_serialization.Model): - """SyncIdentityProvider represents a SyncIdentityProvider. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SystemData - :ivar resources: - :vartype resources: str - """ - - _validation = { - "system_data": {"readonly": True}, - } - - _attribute_map = { - "system_data": {"key": "systemData", "type": "SystemData"}, - "resources": {"key": "properties.resources", "type": "str"}, - } - - def __init__(self, *, resources: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword resources: - :paramtype resources: str - """ - super().__init__(**kwargs) - self.system_data = None - self.resources = resources - - -class SyncSet(ProxyResource): - """SyncSet represents a SyncSet for an Azure Red Hat OpenShift Cluster. - - 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.redhatopenshift.v2022_09_04.models.SystemData - :ivar resources: Resources represents the SyncSets configuration. - :vartype resources: str - """ - - _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"}, - "resources": {"key": "properties.resources", "type": "str"}, - } - - def __init__(self, *, resources: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword resources: Resources represents the SyncSets configuration. - :paramtype resources: str - """ - super().__init__(**kwargs) - self.resources = resources - - -class SyncSetList(_serialization.Model): - """SyncSetList represents a list of SyncSets. - - :ivar value: The list of syncsets. - :vartype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet] - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[SyncSet]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.SyncSet"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of syncsets. - :paramtype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet] - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SyncSetUpdate(_serialization.Model): - """SyncSet represents a SyncSet for an Azure Red Hat OpenShift Cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SystemData - :ivar resources: Resources represents the SyncSets configuration. - :vartype resources: str - """ - - _validation = { - "system_data": {"readonly": True}, - } - - _attribute_map = { - "system_data": {"key": "systemData", "type": "SystemData"}, - "resources": {"key": "properties.resources", "type": "str"}, - } - - def __init__(self, *, resources: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword resources: Resources represents the SyncSets configuration. - :paramtype resources: str - """ - super().__init__(**kwargs) - self.system_data = None - self.resources = resources - - -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.redhatopenshift.v2022_09_04.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.redhatopenshift.v2022_09_04.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.redhatopenshift.v2022_09_04.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.redhatopenshift.v2022_09_04.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 WorkerProfile(_serialization.Model): - """WorkerProfile represents a worker profile. - - :ivar name: The worker profile name. - :vartype name: str - :ivar vm_size: The size of the worker VMs. - :vartype vm_size: str - :ivar disk_size_gb: The disk size of the worker VMs. - :vartype disk_size_gb: int - :ivar subnet_id: The Azure resource ID of the worker subnet. - :vartype subnet_id: str - :ivar count: The number of worker VMs. - :vartype count: int - :ivar encryption_at_host: Whether master virtual machines are encrypted at host. Known values - are: "Disabled" and "Enabled". - :vartype encryption_at_host: str or - ~azure.mgmt.redhatopenshift.v2022_09_04.models.EncryptionAtHost - :ivar disk_encryption_set_id: The resource ID of an associated DiskEncryptionSet, if - applicable. - :vartype disk_encryption_set_id: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "vm_size": {"key": "vmSize", "type": "str"}, - "disk_size_gb": {"key": "diskSizeGB", "type": "int"}, - "subnet_id": {"key": "subnetId", "type": "str"}, - "count": {"key": "count", "type": "int"}, - "encryption_at_host": {"key": "encryptionAtHost", "type": "str"}, - "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - vm_size: Optional[str] = None, - disk_size_gb: Optional[int] = None, - subnet_id: Optional[str] = None, - count: Optional[int] = None, - encryption_at_host: Optional[Union[str, "_models.EncryptionAtHost"]] = None, - disk_encryption_set_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The worker profile name. - :paramtype name: str - :keyword vm_size: The size of the worker VMs. - :paramtype vm_size: str - :keyword disk_size_gb: The disk size of the worker VMs. - :paramtype disk_size_gb: int - :keyword subnet_id: The Azure resource ID of the worker subnet. - :paramtype subnet_id: str - :keyword count: The number of worker VMs. - :paramtype count: int - :keyword encryption_at_host: Whether master virtual machines are encrypted at host. Known - values are: "Disabled" and "Enabled". - :paramtype encryption_at_host: str or - ~azure.mgmt.redhatopenshift.v2022_09_04.models.EncryptionAtHost - :keyword disk_encryption_set_id: The resource ID of an associated DiskEncryptionSet, if - applicable. - :paramtype disk_encryption_set_id: str - """ - super().__init__(**kwargs) - self.name = name - self.vm_size = vm_size - self.disk_size_gb = disk_size_gb - self.subnet_id = subnet_id - self.count = count - self.encryption_at_host = encryption_at_host - self.disk_encryption_set_id = disk_encryption_set_id diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/models/_patch.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_machine_pools_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_machine_pools_operations.py deleted file mode 100644 index ae5a6cf5ad85..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_machine_pools_operations.py +++ /dev/null @@ -1,802 +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, Optional, Type, TypeVar, Union, overload -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( - resource_group_name: str, resource_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-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/machinePools", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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, resource_name: str, child_resource_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-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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, resource_name: str, child_resource_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-04")) - 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.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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 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, resource_name: str, child_resource_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-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, resource_name: str, child_resource_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-04")) - 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.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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 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) - - -class MachinePoolsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2022_09_04.AzureRedHatOpenShiftClient`'s - :attr:`machine_pools` 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, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.MachinePool"]: - """Lists MachinePools that belong to that Azure Red Hat OpenShift Cluster. - - The operation returns properties of each MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: An iterator like instance of either MachinePool or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) 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-04")) - cls: ClsType[_models.MachinePoolList] = 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( - resource_group_name=resource_group_name, - resource_name=resource_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("MachinePoolList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> _models.MachinePool: - """Gets a MachinePool with the specified subscription, resource group and resource name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool - :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-04")) - cls: ClsType[_models.MachinePool] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MachinePool", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.MachinePool, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MachinePool: - """Creates or updates a MachinePool with the specified subscription, resource group and resource - name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :param parameters: The MachinePool resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MachinePool: - """Creates or updates a MachinePool with the specified subscription, resource group and resource - name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :param parameters: The MachinePool resource. Required. - :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: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.MachinePool, IO[bytes]], - **kwargs: Any - ) -> _models.MachinePool: - """Creates or updates a MachinePool with the specified subscription, resource group and resource - name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :param parameters: The MachinePool resource. Is either a MachinePool type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool or IO[bytes] - :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool - :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-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MachinePool] = 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, "MachinePool") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("MachinePool", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("MachinePool", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> None: - """Deletes a MachinePool with the specified subscription, resource group and resource name. - - The operation returns nothing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :return: None or the result of cls(response) - :rtype: None - :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-04")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.MachinePoolUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MachinePool: - """Updates a MachinePool with the specified subscription, resource group and resource name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :param parameters: The MachinePool resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePoolUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MachinePool: - """Updates a MachinePool with the specified subscription, resource group and resource name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :param parameters: The MachinePool resource. Required. - :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: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.MachinePoolUpdate, IO[bytes]], - **kwargs: Any - ) -> _models.MachinePool: - """Updates a MachinePool with the specified subscription, resource group and resource name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :param parameters: The MachinePool resource. Is either a MachinePoolUpdate type or a IO[bytes] - type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePoolUpdate or IO[bytes] - :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool - :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-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MachinePool] = 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, "MachinePoolUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MachinePool", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_open_shift_clusters_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_open_shift_clusters_operations.py deleted file mode 100644 index 7066f8f5610c..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_open_shift_clusters_operations.py +++ /dev/null @@ -1,1168 +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, - 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_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-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.RedHatOpenShift/openShiftClusters" - ) # pylint: disable=line-too-long - 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-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("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, resource_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-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _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, resource_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-04")) - 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.RedHatOpenShift/openShiftClusters/{resourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, resource_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-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, resource_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-04")) - 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.RedHatOpenShift/openShiftClusters/{resourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_admin_credentials_request( - resource_group_name: str, resource_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-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}/listAdminCredentials", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _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) - - -def build_list_credentials_request( - resource_group_name: str, resource_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-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}/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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _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 OpenShiftClustersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2022_09_04.AzureRedHatOpenShiftClient`'s - :attr:`open_shift_clusters` 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.OpenShiftCluster"]: - """Lists OpenShift clusters in the specified subscription. - - The operation returns properties of each OpenShift cluster. - - :return: An iterator like instance of either OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) 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-04")) - cls: ClsType[_models.OpenShiftClusterList] = 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("OpenShiftClusterList", 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) - raise HttpResponseError(response=response, 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.OpenShiftCluster"]: - """Lists OpenShift clusters in the specified subscription and resource group. - - The operation returns properties of each OpenShift cluster. - - :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 OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) 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-04")) - cls: ClsType[_models.OpenShiftClusterList] = 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("OpenShiftClusterList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.OpenShiftCluster: - """Gets a OpenShift cluster with the specified subscription, resource group and resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: OpenShiftCluster or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster - :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-04")) - cls: ClsType[_models.OpenShiftCluster] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenShiftCluster", 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, - resource_name: str, - parameters: Union[_models.OpenShiftCluster, IO[bytes]], - **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-04")) - 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, "OpenShiftCluster") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - 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 = 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]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.OpenShiftCluster, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster - :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 OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :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: An instance of LROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - parameters: Union[_models.OpenShiftCluster, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a OpenShiftCluster type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster or IO[bytes] - :return: An instance of LROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] - :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-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OpenShiftCluster] = 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, - resource_name=resource_name, - parameters=parameters, - 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("OpenShiftCluster", 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.OpenShiftCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OpenShiftCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, resource_name: str, **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-04")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes a OpenShift cluster with the specified subscription, resource group and resource name. - - The operation returns nothing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: 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-04")) - 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, - resource_name=resource_name, - 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, **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 _update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: Union[_models.OpenShiftClusterUpdate, IO[bytes]], - **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-04")) - 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, "OpenShiftClusterUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - 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 = 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]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.OpenShiftClusterUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftClusterUpdate - :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 OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :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: An instance of LROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - resource_name: str, - parameters: Union[_models.OpenShiftClusterUpdate, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a OpenShiftClusterUpdate type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftClusterUpdate or - IO[bytes] - :return: An instance of LROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] - :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-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OpenShiftCluster] = 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, - resource_name=resource_name, - parameters=parameters, - 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("OpenShiftCluster", 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.OpenShiftCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OpenShiftCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_admin_credentials( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.OpenShiftClusterAdminKubeconfig: - """Lists admin kubeconfig of an OpenShift cluster with the specified subscription, resource group - and resource name. - - The operation returns the admin kubeconfig. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: OpenShiftClusterAdminKubeconfig or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftClusterAdminKubeconfig - :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-04")) - cls: ClsType[_models.OpenShiftClusterAdminKubeconfig] = kwargs.pop("cls", None) - - _request = build_list_admin_credentials_request( - resource_group_name=resource_group_name, - resource_name=resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenShiftClusterAdminKubeconfig", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_credentials( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.OpenShiftClusterCredentials: - """Lists credentials of an OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns the credentials. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: OpenShiftClusterCredentials or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftClusterCredentials - :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-04")) - cls: ClsType[_models.OpenShiftClusterCredentials] = kwargs.pop("cls", None) - - _request = build_list_credentials_request( - resource_group_name=resource_group_name, - resource_name=resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenShiftClusterCredentials", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_open_shift_versions_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_open_shift_versions_operations.py deleted file mode 100644 index 3f5a46ae1e76..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_open_shift_versions_operations.py +++ /dev/null @@ -1,168 +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(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.RedHatOpenShift/locations/{location}/openshiftversions", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "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) - - -class OpenShiftVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2022_09_04.AzureRedHatOpenShiftClient`'s - :attr:`open_shift_versions` 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, location: str, **kwargs: Any) -> Iterable["_models.OpenShiftVersion"]: - """Lists all OpenShift versions available to install in the specified location. - - The operation returns the installable OpenShift versions as strings. - - :param location: The name of Azure region. Required. - :type location: str - :return: An iterator like instance of either OpenShiftVersion or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) 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-04")) - cls: ClsType[_models.OpenShiftVersionList] = 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( - location=location, - 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("OpenShiftVersionList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_operations.py deleted file mode 100644 index a65fa679f589..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/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", "2022-09-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.RedHatOpenShift/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.redhatopenshift.v2022_09_04.AzureRedHatOpenShiftClient`'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"]: - """Lists all of the available RP operations. - - The operation returns the RP operations. - - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.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-04")) - cls: ClsType[_models.OperationList] = 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("OperationList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_patch.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_secrets_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_secrets_operations.py deleted file mode 100644 index 32d835480a95..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_secrets_operations.py +++ /dev/null @@ -1,797 +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, Optional, Type, TypeVar, Union, overload -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( - resource_group_name: str, resource_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-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/secrets", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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, resource_name: str, child_resource_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-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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, resource_name: str, child_resource_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-04")) - 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.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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 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, resource_name: str, child_resource_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-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, resource_name: str, child_resource_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-04")) - 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.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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 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) - - -class SecretsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2022_09_04.AzureRedHatOpenShiftClient`'s - :attr:`secrets` 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, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.Secret"]: - """Lists Secrets that belong to that Azure Red Hat OpenShift Cluster. - - The operation returns properties of each Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: An iterator like instance of either Secret or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) 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-04")) - cls: ClsType[_models.SecretList] = 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( - resource_group_name=resource_group_name, - resource_name=resource_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("SecretList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> _models.Secret: - """Gets a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret - :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-04")) - cls: ClsType[_models.Secret] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Secret", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.Secret, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Secret: - """Creates or updates a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :param parameters: The Secret resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Secret: - """Creates or updates a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :param parameters: The Secret resource. Required. - :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: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.Secret, IO[bytes]], - **kwargs: Any - ) -> _models.Secret: - """Creates or updates a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :param parameters: The Secret resource. Is either a Secret type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret or IO[bytes] - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret - :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-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Secret] = 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, "Secret") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("Secret", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Secret", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> None: - """Deletes a Secret with the specified subscription, resource group and resource name. - - The operation returns nothing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :return: None or the result of cls(response) - :rtype: None - :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-04")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.SecretUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Secret: - """Updates a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :param parameters: The Secret resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SecretUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Secret: - """Updates a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :param parameters: The Secret resource. Required. - :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: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.SecretUpdate, IO[bytes]], - **kwargs: Any - ) -> _models.Secret: - """Updates a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :param parameters: The Secret resource. Is either a SecretUpdate type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SecretUpdate or IO[bytes] - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret - :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-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Secret] = 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, "SecretUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Secret", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_sync_identity_providers_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_sync_identity_providers_operations.py deleted file mode 100644 index a3f49f7fea35..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_sync_identity_providers_operations.py +++ /dev/null @@ -1,811 +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, Optional, Type, TypeVar, Union, overload -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( - resource_group_name: str, resource_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-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/syncIdentityProviders", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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, resource_name: str, child_resource_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-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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, resource_name: str, child_resource_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-04")) - 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.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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 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, resource_name: str, child_resource_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-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, resource_name: str, child_resource_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-04")) - 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.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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 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) - - -class SyncIdentityProvidersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2022_09_04.AzureRedHatOpenShiftClient`'s - :attr:`sync_identity_providers` 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, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.SyncIdentityProvider"]: - """Lists SyncIdentityProviders that belong to that Azure Red Hat OpenShift Cluster. - - The operation returns properties of each SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: An iterator like instance of either SyncIdentityProvider or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) 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-04")) - cls: ClsType[_models.SyncIdentityProviderList] = 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( - resource_group_name=resource_group_name, - resource_name=resource_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("SyncIdentityProviderList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Gets a SyncIdentityProvider with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider - :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-04")) - cls: ClsType[_models.SyncIdentityProvider] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SyncIdentityProvider", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.SyncIdentityProvider, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Creates or updates a SyncIdentityProvider with the specified subscription, resource group and - resource name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Creates or updates a SyncIdentityProvider with the specified subscription, resource group and - resource name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Required. - :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: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.SyncIdentityProvider, IO[bytes]], - **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Creates or updates a SyncIdentityProvider with the specified subscription, resource group and - resource name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Is either a SyncIdentityProvider type or - a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider or - IO[bytes] - :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider - :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-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SyncIdentityProvider] = 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, "SyncIdentityProvider") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("SyncIdentityProvider", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SyncIdentityProvider", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> None: - """Deletes a SyncIdentityProvider with the specified subscription, resource group and resource - name. - - The operation returns nothing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :return: None or the result of cls(response) - :rtype: None - :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-04")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.SyncIdentityProviderUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Updates a SyncIdentityProvider with the specified subscription, resource group and resource - name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProviderUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Updates a SyncIdentityProvider with the specified subscription, resource group and resource - name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Required. - :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: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.SyncIdentityProviderUpdate, IO[bytes]], - **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Updates a SyncIdentityProvider with the specified subscription, resource group and resource - name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Is either a SyncIdentityProviderUpdate - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProviderUpdate or - IO[bytes] - :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider - :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-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SyncIdentityProvider] = 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, "SyncIdentityProviderUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SyncIdentityProvider", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_sync_sets_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_sync_sets_operations.py deleted file mode 100644 index 00800e0fba44..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/operations/_sync_sets_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, Optional, Type, TypeVar, Union, overload -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( - resource_group_name: str, resource_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-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/syncSets", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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, resource_name: str, child_resource_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-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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, resource_name: str, child_resource_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-04")) - 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.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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 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, resource_name: str, child_resource_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-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, resource_name: str, child_resource_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-04")) - 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.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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 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) - - -class SyncSetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2022_09_04.AzureRedHatOpenShiftClient`'s - :attr:`sync_sets` 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, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.SyncSet"]: - """Lists SyncSets that belong to that Azure Red Hat OpenShift Cluster. - - The operation returns properties of each SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: An iterator like instance of either SyncSet or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) 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-04")) - cls: ClsType[_models.SyncSetList] = 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( - resource_group_name=resource_group_name, - resource_name=resource_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("SyncSetList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> _models.SyncSet: - """Gets a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet - :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-04")) - cls: ClsType[_models.SyncSet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SyncSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.SyncSet, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncSet: - """Creates or updates a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :param parameters: The SyncSet resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncSet: - """Creates or updates a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :param parameters: The SyncSet resource. Required. - :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: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.SyncSet, IO[bytes]], - **kwargs: Any - ) -> _models.SyncSet: - """Creates or updates a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :param parameters: The SyncSet resource. Is either a SyncSet type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet or IO[bytes] - :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet - :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-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SyncSet] = 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, "SyncSet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("SyncSet", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SyncSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> None: - """Deletes a SyncSet with the specified subscription, resource group and resource name. - - The operation returns nothing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :return: None or the result of cls(response) - :rtype: None - :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-04")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.SyncSetUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncSet: - """Updates a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :param parameters: The SyncSet resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSetUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncSet: - """Updates a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :param parameters: The SyncSet resource. Required. - :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: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.SyncSetUpdate, IO[bytes]], - **kwargs: Any - ) -> _models.SyncSet: - """Updates a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :param parameters: The SyncSet resource. Is either a SyncSetUpdate type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSetUpdate or IO[bytes] - :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet - :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-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SyncSet] = 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, "SyncSetUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SyncSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/py.typed b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2022_09_04/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/__init__.py deleted file mode 100644 index c64163c98d3d..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_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 ._azure_red_hat_open_shift_client import AzureRedHatOpenShiftClient -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__ = [ - "AzureRedHatOpenShiftClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/_azure_red_hat_open_shift_client.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/_azure_red_hat_open_shift_client.py deleted file mode 100644 index da4457aa13e7..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/_azure_red_hat_open_shift_client.py +++ /dev/null @@ -1,152 +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 AzureRedHatOpenShiftClientConfiguration -from .operations import ( - MachinePoolsOperations, - OpenShiftClustersOperations, - OpenShiftVersionsOperations, - Operations, - SecretsOperations, - SyncIdentityProvidersOperations, - SyncSetsOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class AzureRedHatOpenShiftClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """Rest API for Azure Red Hat OpenShift 4. - - :ivar operations: Operations operations - :vartype operations: azure.mgmt.redhatopenshift.v2022_09_04.operations.Operations - :ivar open_shift_versions: OpenShiftVersionsOperations operations - :vartype open_shift_versions: - azure.mgmt.redhatopenshift.v2022_09_04.operations.OpenShiftVersionsOperations - :ivar open_shift_clusters: OpenShiftClustersOperations operations - :vartype open_shift_clusters: - azure.mgmt.redhatopenshift.v2022_09_04.operations.OpenShiftClustersOperations - :ivar machine_pools: MachinePoolsOperations operations - :vartype machine_pools: - azure.mgmt.redhatopenshift.v2022_09_04.operations.MachinePoolsOperations - :ivar secrets: SecretsOperations operations - :vartype secrets: azure.mgmt.redhatopenshift.v2022_09_04.operations.SecretsOperations - :ivar sync_identity_providers: SyncIdentityProvidersOperations operations - :vartype sync_identity_providers: - azure.mgmt.redhatopenshift.v2022_09_04.operations.SyncIdentityProvidersOperations - :ivar sync_sets: SyncSetsOperations operations - :vartype sync_sets: azure.mgmt.redhatopenshift.v2022_09_04.operations.SyncSetsOperations - :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-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 = AzureRedHatOpenShiftClientConfiguration( - 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-04-01") - self.open_shift_versions = OpenShiftVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-04-01" - ) - self.open_shift_clusters = OpenShiftClustersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-04-01" - ) - self.machine_pools = MachinePoolsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-04-01" - ) - self.secrets = SecretsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-04-01") - self.sync_identity_providers = SyncIdentityProvidersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-04-01" - ) - self.sync_sets = SyncSetsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/_configuration.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/_configuration.py deleted file mode 100644 index f26641f176c2..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_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 AzureRedHatOpenShiftClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for AzureRedHatOpenShiftClient. - - 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-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", "2023-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-redhatopenshift/{}".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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/_metadata.json b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/_metadata.json deleted file mode 100644 index c122d7a1eaf1..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/_metadata.json +++ /dev/null @@ -1,116 +0,0 @@ -{ - "chosen_version": "2023-04-01", - "total_api_version_list": ["2023-04-01"], - "client": { - "name": "AzureRedHatOpenShiftClient", - "filename": "_azure_red_hat_open_shift_client", - "description": "Rest API for Azure Red Hat OpenShift 4.", - "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\": [\"AzureRedHatOpenShiftClientConfiguration\"], \".._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\": [\"AzureRedHatOpenShiftClientConfiguration\"], \"..._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", - "open_shift_versions": "OpenShiftVersionsOperations", - "open_shift_clusters": "OpenShiftClustersOperations", - "machine_pools": "MachinePoolsOperations", - "secrets": "SecretsOperations", - "sync_identity_providers": "SyncIdentityProvidersOperations", - "sync_sets": "SyncSetsOperations" - } -} diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/_patch.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/_version.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/_version.py deleted file mode 100644 index b2efd13ce94d..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_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 = "1.5.0" diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/aio/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/aio/__init__.py deleted file mode 100644 index b06f0016da77..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_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 ._azure_red_hat_open_shift_client import AzureRedHatOpenShiftClient - -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__ = [ - "AzureRedHatOpenShiftClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/aio/_azure_red_hat_open_shift_client.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/aio/_azure_red_hat_open_shift_client.py deleted file mode 100644 index f0eece5680e6..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/aio/_azure_red_hat_open_shift_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 AzureRedHatOpenShiftClientConfiguration -from .operations import ( - MachinePoolsOperations, - OpenShiftClustersOperations, - OpenShiftVersionsOperations, - Operations, - SecretsOperations, - SyncIdentityProvidersOperations, - SyncSetsOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class AzureRedHatOpenShiftClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """Rest API for Azure Red Hat OpenShift 4. - - :ivar operations: Operations operations - :vartype operations: azure.mgmt.redhatopenshift.v2022_09_04.aio.operations.Operations - :ivar open_shift_versions: OpenShiftVersionsOperations operations - :vartype open_shift_versions: - azure.mgmt.redhatopenshift.v2022_09_04.aio.operations.OpenShiftVersionsOperations - :ivar open_shift_clusters: OpenShiftClustersOperations operations - :vartype open_shift_clusters: - azure.mgmt.redhatopenshift.v2022_09_04.aio.operations.OpenShiftClustersOperations - :ivar machine_pools: MachinePoolsOperations operations - :vartype machine_pools: - azure.mgmt.redhatopenshift.v2022_09_04.aio.operations.MachinePoolsOperations - :ivar secrets: SecretsOperations operations - :vartype secrets: azure.mgmt.redhatopenshift.v2022_09_04.aio.operations.SecretsOperations - :ivar sync_identity_providers: SyncIdentityProvidersOperations operations - :vartype sync_identity_providers: - azure.mgmt.redhatopenshift.v2022_09_04.aio.operations.SyncIdentityProvidersOperations - :ivar sync_sets: SyncSetsOperations operations - :vartype sync_sets: azure.mgmt.redhatopenshift.v2022_09_04.aio.operations.SyncSetsOperations - :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-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 = AzureRedHatOpenShiftClientConfiguration( - 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-04-01") - self.open_shift_versions = OpenShiftVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-04-01" - ) - self.open_shift_clusters = OpenShiftClustersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-04-01" - ) - self.machine_pools = MachinePoolsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-04-01" - ) - self.secrets = SecretsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-04-01") - self.sync_identity_providers = SyncIdentityProvidersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-04-01" - ) - self.sync_sets = SyncSetsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/aio/_configuration.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/aio/_configuration.py deleted file mode 100644 index a20f30eb4deb..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_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 AzureRedHatOpenShiftClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for AzureRedHatOpenShiftClient. - - 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-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", "2023-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-redhatopenshift/{}".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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/aio/_patch.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/aio/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/aio/operations/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/aio/operations/__init__.py deleted file mode 100644 index f03257fe6903..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/aio/operations/__init__.py +++ /dev/null @@ -1,31 +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 ._open_shift_versions_operations import OpenShiftVersionsOperations -from ._open_shift_clusters_operations import OpenShiftClustersOperations -from ._machine_pools_operations import MachinePoolsOperations -from ._secrets_operations import SecretsOperations -from ._sync_identity_providers_operations import SyncIdentityProvidersOperations -from ._sync_sets_operations import SyncSetsOperations - -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", - "OpenShiftVersionsOperations", - "OpenShiftClustersOperations", - "MachinePoolsOperations", - "SecretsOperations", - "SyncIdentityProvidersOperations", - "SyncSetsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/aio/operations/_machine_pools_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/aio/operations/_machine_pools_operations.py deleted file mode 100644 index d0ce4d0b923f..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/aio/operations/_machine_pools_operations.py +++ /dev/null @@ -1,568 +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, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload -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.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._machine_pools_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_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 MachinePoolsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2022_09_04.aio.AzureRedHatOpenShiftClient`'s - :attr:`machine_pools` 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, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.MachinePool"]: - """Lists MachinePools that belong to that Azure Red Hat OpenShift Cluster. - - The operation returns properties of each MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: An iterator like instance of either MachinePool or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-04-01")) - cls: ClsType[_models.MachinePoolList] = 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( - resource_group_name=resource_group_name, - resource_name=resource_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("MachinePoolList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> _models.MachinePool: - """Gets a MachinePool with the specified subscription, resource group and resource name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool - :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-04-01")) - cls: ClsType[_models.MachinePool] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MachinePool", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.MachinePool, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MachinePool: - """Creates or updates a MachinePool with the specified subscription, resource group and resource - name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :param parameters: The MachinePool resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MachinePool: - """Creates or updates a MachinePool with the specified subscription, resource group and resource - name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :param parameters: The MachinePool resource. Required. - :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: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.MachinePool, IO[bytes]], - **kwargs: Any - ) -> _models.MachinePool: - """Creates or updates a MachinePool with the specified subscription, resource group and resource - name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :param parameters: The MachinePool resource. Is either a MachinePool type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool or IO[bytes] - :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool - :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-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MachinePool] = 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, "MachinePool") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("MachinePool", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("MachinePool", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> None: - """Deletes a MachinePool with the specified subscription, resource group and resource name. - - The operation returns nothing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :return: None or the result of cls(response) - :rtype: None - :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-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.MachinePoolUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MachinePool: - """Updates a MachinePool with the specified subscription, resource group and resource name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :param parameters: The MachinePool resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePoolUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MachinePool: - """Updates a MachinePool with the specified subscription, resource group and resource name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :param parameters: The MachinePool resource. Required. - :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: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.MachinePoolUpdate, IO[bytes]], - **kwargs: Any - ) -> _models.MachinePool: - """Updates a MachinePool with the specified subscription, resource group and resource name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :param parameters: The MachinePool resource. Is either a MachinePoolUpdate type or a IO[bytes] - type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePoolUpdate or IO[bytes] - :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool - :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-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MachinePool] = 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, "MachinePoolUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MachinePool", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/aio/operations/_open_shift_clusters_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/aio/operations/_open_shift_clusters_operations.py deleted file mode 100644 index 46bd36cd67b9..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/aio/operations/_open_shift_clusters_operations.py +++ /dev/null @@ -1,921 +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, - 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._open_shift_clusters_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_admin_credentials_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 OpenShiftClustersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2022_09_04.aio.AzureRedHatOpenShiftClient`'s - :attr:`open_shift_clusters` 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.OpenShiftCluster"]: - """Lists OpenShift clusters in the specified subscription. - - The operation returns properties of each OpenShift cluster. - - :return: An iterator like instance of either OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-04-01")) - cls: ClsType[_models.OpenShiftClusterList] = 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("OpenShiftClusterList", 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) - raise HttpResponseError(response=response, 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.OpenShiftCluster"]: - """Lists OpenShift clusters in the specified subscription and resource group. - - The operation returns properties of each OpenShift cluster. - - :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 OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-04-01")) - cls: ClsType[_models.OpenShiftClusterList] = 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("OpenShiftClusterList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.OpenShiftCluster: - """Gets a OpenShift cluster with the specified subscription, resource group and resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: OpenShiftCluster or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster - :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-04-01")) - cls: ClsType[_models.OpenShiftCluster] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenShiftCluster", 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, - resource_name: str, - parameters: Union[_models.OpenShiftCluster, IO[bytes]], - **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-04-01")) - 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, "OpenShiftCluster") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - 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 = 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]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - 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, - resource_name: str, - parameters: _models.OpenShiftCluster, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster - :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 OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :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: An instance of AsyncLROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - parameters: Union[_models.OpenShiftCluster, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a OpenShiftCluster type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster or IO[bytes] - :return: An instance of AsyncLROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] - :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-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OpenShiftCluster] = 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, - resource_name=resource_name, - parameters=parameters, - 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("OpenShiftCluster", 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.OpenShiftCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OpenShiftCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, resource_name: str, **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-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - 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, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Deletes a OpenShift cluster with the specified subscription, resource group and resource name. - - The operation returns nothing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: 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-04-01")) - 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, - resource_name=resource_name, - 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, **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 _update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: Union[_models.OpenShiftClusterUpdate, IO[bytes]], - **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-04-01")) - 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, "OpenShiftClusterUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - 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 = 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]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.OpenShiftClusterUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftClusterUpdate - :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 OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :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: An instance of AsyncLROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - resource_name: str, - parameters: Union[_models.OpenShiftClusterUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a OpenShiftClusterUpdate type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftClusterUpdate or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] - :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-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OpenShiftCluster] = 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, - resource_name=resource_name, - parameters=parameters, - 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("OpenShiftCluster", 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.OpenShiftCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OpenShiftCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace_async - async def list_admin_credentials( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.OpenShiftClusterAdminKubeconfig: - """Lists admin kubeconfig of an OpenShift cluster with the specified subscription, resource group - and resource name. - - The operation returns the admin kubeconfig. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: OpenShiftClusterAdminKubeconfig or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftClusterAdminKubeconfig - :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-04-01")) - cls: ClsType[_models.OpenShiftClusterAdminKubeconfig] = kwargs.pop("cls", None) - - _request = build_list_admin_credentials_request( - resource_group_name=resource_group_name, - resource_name=resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenShiftClusterAdminKubeconfig", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def list_credentials( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.OpenShiftClusterCredentials: - """Lists credentials of an OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns the credentials. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: OpenShiftClusterCredentials or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftClusterCredentials - :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-04-01")) - cls: ClsType[_models.OpenShiftClusterCredentials] = kwargs.pop("cls", None) - - _request = build_list_credentials_request( - resource_group_name=resource_group_name, - resource_name=resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenShiftClusterCredentials", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/aio/operations/_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/aio/operations/_operations.py deleted file mode 100644 index 723cecdf5408..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/aio/operations/_operations.py +++ /dev/null @@ -1,133 +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.redhatopenshift.v2022_09_04.aio.AzureRedHatOpenShiftClient`'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"]: - """Lists all of the available RP operations. - - The operation returns the RP operations. - - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.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-04-01")) - cls: ClsType[_models.OperationList] = 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("OperationList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/aio/operations/_patch.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/aio/operations/_secrets_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/aio/operations/_secrets_operations.py deleted file mode 100644 index f8c9abc459fc..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/aio/operations/_secrets_operations.py +++ /dev/null @@ -1,564 +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, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload -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.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._secrets_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_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 SecretsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2022_09_04.aio.AzureRedHatOpenShiftClient`'s - :attr:`secrets` 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, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.Secret"]: - """Lists Secrets that belong to that Azure Red Hat OpenShift Cluster. - - The operation returns properties of each Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: An iterator like instance of either Secret or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-04-01")) - cls: ClsType[_models.SecretList] = 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( - resource_group_name=resource_group_name, - resource_name=resource_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("SecretList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> _models.Secret: - """Gets a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret - :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-04-01")) - cls: ClsType[_models.Secret] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Secret", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.Secret, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Secret: - """Creates or updates a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :param parameters: The Secret resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Secret: - """Creates or updates a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :param parameters: The Secret resource. Required. - :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: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.Secret, IO[bytes]], - **kwargs: Any - ) -> _models.Secret: - """Creates or updates a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :param parameters: The Secret resource. Is either a Secret type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret or IO[bytes] - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret - :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-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Secret] = 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, "Secret") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("Secret", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Secret", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> None: - """Deletes a Secret with the specified subscription, resource group and resource name. - - The operation returns nothing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :return: None or the result of cls(response) - :rtype: None - :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-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.SecretUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Secret: - """Updates a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :param parameters: The Secret resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SecretUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Secret: - """Updates a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :param parameters: The Secret resource. Required. - :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: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.SecretUpdate, IO[bytes]], - **kwargs: Any - ) -> _models.Secret: - """Updates a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :param parameters: The Secret resource. Is either a SecretUpdate type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SecretUpdate or IO[bytes] - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret - :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-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Secret] = 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, "SecretUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Secret", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/aio/operations/_sync_sets_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/aio/operations/_sync_sets_operations.py deleted file mode 100644 index fab7f172392f..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/aio/operations/_sync_sets_operations.py +++ /dev/null @@ -1,565 +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, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload -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.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._sync_sets_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_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 SyncSetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2022_09_04.aio.AzureRedHatOpenShiftClient`'s - :attr:`sync_sets` 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, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.SyncSet"]: - """Lists SyncSets that belong to that Azure Red Hat OpenShift Cluster. - - The operation returns properties of each SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: An iterator like instance of either SyncSet or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-04-01")) - cls: ClsType[_models.SyncSetList] = 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( - resource_group_name=resource_group_name, - resource_name=resource_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("SyncSetList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> _models.SyncSet: - """Gets a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet - :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-04-01")) - cls: ClsType[_models.SyncSet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SyncSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.SyncSet, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncSet: - """Creates or updates a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :param parameters: The SyncSet resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncSet: - """Creates or updates a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :param parameters: The SyncSet resource. Required. - :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: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.SyncSet, IO[bytes]], - **kwargs: Any - ) -> _models.SyncSet: - """Creates or updates a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :param parameters: The SyncSet resource. Is either a SyncSet type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet or IO[bytes] - :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet - :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-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SyncSet] = 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, "SyncSet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("SyncSet", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SyncSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> None: - """Deletes a SyncSet with the specified subscription, resource group and resource name. - - The operation returns nothing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :return: None or the result of cls(response) - :rtype: None - :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-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.SyncSetUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncSet: - """Updates a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :param parameters: The SyncSet resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSetUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncSet: - """Updates a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :param parameters: The SyncSet resource. Required. - :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: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.SyncSetUpdate, IO[bytes]], - **kwargs: Any - ) -> _models.SyncSet: - """Updates a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :param parameters: The SyncSet resource. Is either a SyncSetUpdate type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSetUpdate or IO[bytes] - :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet - :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-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SyncSet] = 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, "SyncSetUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SyncSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/models/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/models/__init__.py deleted file mode 100644 index a97e4b71f86e..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/models/__init__.py +++ /dev/null @@ -1,99 +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 APIServerProfile -from ._models_py3 import CloudErrorBody -from ._models_py3 import ClusterProfile -from ._models_py3 import ConsoleProfile -from ._models_py3 import Display -from ._models_py3 import IngressProfile -from ._models_py3 import MachinePool -from ._models_py3 import MachinePoolList -from ._models_py3 import MachinePoolUpdate -from ._models_py3 import MasterProfile -from ._models_py3 import NetworkProfile -from ._models_py3 import OpenShiftCluster -from ._models_py3 import OpenShiftClusterAdminKubeconfig -from ._models_py3 import OpenShiftClusterCredentials -from ._models_py3 import OpenShiftClusterList -from ._models_py3 import OpenShiftClusterUpdate -from ._models_py3 import OpenShiftVersion -from ._models_py3 import OpenShiftVersionList -from ._models_py3 import Operation -from ._models_py3 import OperationList -from ._models_py3 import ProxyResource -from ._models_py3 import Resource -from ._models_py3 import Secret -from ._models_py3 import SecretList -from ._models_py3 import SecretUpdate -from ._models_py3 import ServicePrincipalProfile -from ._models_py3 import SyncIdentityProvider -from ._models_py3 import SyncIdentityProviderList -from ._models_py3 import SyncIdentityProviderUpdate -from ._models_py3 import SyncSet -from ._models_py3 import SyncSetList -from ._models_py3 import SyncSetUpdate -from ._models_py3 import SystemData -from ._models_py3 import TrackedResource -from ._models_py3 import WorkerProfile - -from ._azure_red_hat_open_shift_client_enums import CreatedByType -from ._azure_red_hat_open_shift_client_enums import EncryptionAtHost -from ._azure_red_hat_open_shift_client_enums import FipsValidatedModules -from ._azure_red_hat_open_shift_client_enums import OutboundType -from ._azure_red_hat_open_shift_client_enums import ProvisioningState -from ._azure_red_hat_open_shift_client_enums import Visibility -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "APIServerProfile", - "CloudErrorBody", - "ClusterProfile", - "ConsoleProfile", - "Display", - "IngressProfile", - "MachinePool", - "MachinePoolList", - "MachinePoolUpdate", - "MasterProfile", - "NetworkProfile", - "OpenShiftCluster", - "OpenShiftClusterAdminKubeconfig", - "OpenShiftClusterCredentials", - "OpenShiftClusterList", - "OpenShiftClusterUpdate", - "OpenShiftVersion", - "OpenShiftVersionList", - "Operation", - "OperationList", - "ProxyResource", - "Resource", - "Secret", - "SecretList", - "SecretUpdate", - "ServicePrincipalProfile", - "SyncIdentityProvider", - "SyncIdentityProviderList", - "SyncIdentityProviderUpdate", - "SyncSet", - "SyncSetList", - "SyncSetUpdate", - "SystemData", - "TrackedResource", - "WorkerProfile", - "CreatedByType", - "EncryptionAtHost", - "FipsValidatedModules", - "OutboundType", - "ProvisioningState", - "Visibility", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/models/_azure_red_hat_open_shift_client_enums.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/models/_azure_red_hat_open_shift_client_enums.py deleted file mode 100644 index 701a80e0e58e..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/models/_azure_red_hat_open_shift_client_enums.py +++ /dev/null @@ -1,58 +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 EncryptionAtHost(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """EncryptionAtHost represents encryption at host state.""" - - DISABLED = "Disabled" - ENABLED = "Enabled" - - -class FipsValidatedModules(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """FipsValidatedModules determines if FIPS is used.""" - - DISABLED = "Disabled" - ENABLED = "Enabled" - - -class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The outbound routing strategy used to provide your cluster egress to the internet.""" - - LOADBALANCER = "Loadbalancer" - USER_DEFINED_ROUTING = "UserDefinedRouting" - - -class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ProvisioningState represents a provisioning state.""" - - ADMIN_UPDATING = "AdminUpdating" - CREATING = "Creating" - DELETING = "Deleting" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class Visibility(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Visibility represents visibility.""" - - PRIVATE = "Private" - PUBLIC = "Public" diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/models/_models_py3.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/models/_models_py3.py deleted file mode 100644 index a0a32cb9fbad..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/models/_models_py3.py +++ /dev/null @@ -1,1512 +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 APIServerProfile(_serialization.Model): - """APIServerProfile represents an API server profile. - - :ivar visibility: API server visibility. Known values are: "Private" and "Public". - :vartype visibility: str or ~azure.mgmt.redhatopenshift.v2022_09_04.models.Visibility - :ivar url: The URL to access the cluster API server. - :vartype url: str - :ivar ip: The IP of the cluster API server. - :vartype ip: str - """ - - _attribute_map = { - "visibility": {"key": "visibility", "type": "str"}, - "url": {"key": "url", "type": "str"}, - "ip": {"key": "ip", "type": "str"}, - } - - def __init__( - self, - *, - visibility: Optional[Union[str, "_models.Visibility"]] = None, - url: Optional[str] = None, - ip: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword visibility: API server visibility. Known values are: "Private" and "Public". - :paramtype visibility: str or ~azure.mgmt.redhatopenshift.v2022_09_04.models.Visibility - :keyword url: The URL to access the cluster API server. - :paramtype url: str - :keyword ip: The IP of the cluster API server. - :paramtype ip: str - """ - super().__init__(**kwargs) - self.visibility = visibility - self.url = url - self.ip = ip - - -class CloudErrorBody(_serialization.Model): - """CloudErrorBody represents the body of a cloud error. - - :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :vartype code: str - :ivar message: A message describing the error, intended to be suitable for display in a user - interface. - :vartype message: str - :ivar target: The target of the particular error. For example, the name of the property in - error. - :vartype target: str - :ivar details: A list of additional details about the error. - :vartype details: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.CloudErrorBody] - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[CloudErrorBody]"}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[List["_models.CloudErrorBody"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :paramtype code: str - :keyword message: A message describing the error, intended to be suitable for display in a user - interface. - :paramtype message: str - :keyword target: The target of the particular error. For example, the name of the property in - error. - :paramtype target: str - :keyword details: A list of additional details about the error. - :paramtype details: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.CloudErrorBody] - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - -class ClusterProfile(_serialization.Model): - """ClusterProfile represents a cluster profile. - - :ivar pull_secret: The pull secret for the cluster. - :vartype pull_secret: str - :ivar domain: The domain for the cluster. - :vartype domain: str - :ivar version: The version of the cluster. - :vartype version: str - :ivar resource_group_id: The ID of the cluster resource group. - :vartype resource_group_id: str - :ivar fips_validated_modules: If FIPS validated crypto modules are used. Known values are: - "Disabled" and "Enabled". - :vartype fips_validated_modules: str or - ~azure.mgmt.redhatopenshift.v2022_09_04.models.FipsValidatedModules - """ - - _attribute_map = { - "pull_secret": {"key": "pullSecret", "type": "str"}, - "domain": {"key": "domain", "type": "str"}, - "version": {"key": "version", "type": "str"}, - "resource_group_id": {"key": "resourceGroupId", "type": "str"}, - "fips_validated_modules": {"key": "fipsValidatedModules", "type": "str"}, - } - - def __init__( - self, - *, - pull_secret: Optional[str] = None, - domain: Optional[str] = None, - version: Optional[str] = None, - resource_group_id: Optional[str] = None, - fips_validated_modules: Optional[Union[str, "_models.FipsValidatedModules"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword pull_secret: The pull secret for the cluster. - :paramtype pull_secret: str - :keyword domain: The domain for the cluster. - :paramtype domain: str - :keyword version: The version of the cluster. - :paramtype version: str - :keyword resource_group_id: The ID of the cluster resource group. - :paramtype resource_group_id: str - :keyword fips_validated_modules: If FIPS validated crypto modules are used. Known values are: - "Disabled" and "Enabled". - :paramtype fips_validated_modules: str or - ~azure.mgmt.redhatopenshift.v2022_09_04.models.FipsValidatedModules - """ - super().__init__(**kwargs) - self.pull_secret = pull_secret - self.domain = domain - self.version = version - self.resource_group_id = resource_group_id - self.fips_validated_modules = fips_validated_modules - - -class ConsoleProfile(_serialization.Model): - """ConsoleProfile represents a console profile. - - :ivar url: The URL to access the cluster console. - :vartype url: str - """ - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - } - - def __init__(self, *, url: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword url: The URL to access the cluster console. - :paramtype url: str - """ - super().__init__(**kwargs) - self.url = url - - -class Display(_serialization.Model): - """Display represents the display details of an operation. - - :ivar provider: Friendly name of the resource provider. - :vartype provider: str - :ivar resource: Resource type on which the operation is performed. - :vartype resource: str - :ivar operation: Operation type: read, write, delete, listKeys/action, etc. - :vartype operation: str - :ivar description: Friendly name of the operation. - :vartype description: str - """ - - _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__( - self, - *, - provider: Optional[str] = None, - resource: Optional[str] = None, - operation: Optional[str] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword provider: Friendly name of the resource provider. - :paramtype provider: str - :keyword resource: Resource type on which the operation is performed. - :paramtype resource: str - :keyword operation: Operation type: read, write, delete, listKeys/action, etc. - :paramtype operation: str - :keyword description: Friendly name of the operation. - :paramtype description: str - """ - super().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class IngressProfile(_serialization.Model): - """IngressProfile represents an ingress profile. - - :ivar name: The ingress profile name. - :vartype name: str - :ivar visibility: Ingress visibility. Known values are: "Private" and "Public". - :vartype visibility: str or ~azure.mgmt.redhatopenshift.v2022_09_04.models.Visibility - :ivar ip: The IP of the ingress. - :vartype ip: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "visibility": {"key": "visibility", "type": "str"}, - "ip": {"key": "ip", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - visibility: Optional[Union[str, "_models.Visibility"]] = None, - ip: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The ingress profile name. - :paramtype name: str - :keyword visibility: Ingress visibility. Known values are: "Private" and "Public". - :paramtype visibility: str or ~azure.mgmt.redhatopenshift.v2022_09_04.models.Visibility - :keyword ip: The IP of the ingress. - :paramtype ip: str - """ - super().__init__(**kwargs) - self.name = name - self.visibility = visibility - self.ip = ip - - -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.redhatopenshift.v2022_09_04.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have - tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SystemData - """ - - -class MachinePool(ProxyResource): - """MachinePool represents a MachinePool. - - 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.redhatopenshift.v2022_09_04.models.SystemData - :ivar resources: - :vartype resources: str - """ - - _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"}, - "resources": {"key": "properties.resources", "type": "str"}, - } - - def __init__(self, *, resources: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword resources: - :paramtype resources: str - """ - super().__init__(**kwargs) - self.resources = resources - - -class MachinePoolList(_serialization.Model): - """MachinePoolList represents a list of MachinePools. - - :ivar value: The list of Machine Pools. - :vartype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool] - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[MachinePool]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.MachinePool"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of Machine Pools. - :paramtype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool] - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class MachinePoolUpdate(_serialization.Model): - """MachinePool represents a MachinePool. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SystemData - :ivar resources: - :vartype resources: str - """ - - _validation = { - "system_data": {"readonly": True}, - } - - _attribute_map = { - "system_data": {"key": "systemData", "type": "SystemData"}, - "resources": {"key": "properties.resources", "type": "str"}, - } - - def __init__(self, *, resources: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword resources: - :paramtype resources: str - """ - super().__init__(**kwargs) - self.system_data = None - self.resources = resources - - -class MasterProfile(_serialization.Model): - """MasterProfile represents a master profile. - - :ivar vm_size: The size of the master VMs. - :vartype vm_size: str - :ivar subnet_id: The Azure resource ID of the master subnet. - :vartype subnet_id: str - :ivar encryption_at_host: Whether master virtual machines are encrypted at host. Known values - are: "Disabled" and "Enabled". - :vartype encryption_at_host: str or - ~azure.mgmt.redhatopenshift.v2022_09_04.models.EncryptionAtHost - :ivar disk_encryption_set_id: The resource ID of an associated DiskEncryptionSet, if - applicable. - :vartype disk_encryption_set_id: str - """ - - _attribute_map = { - "vm_size": {"key": "vmSize", "type": "str"}, - "subnet_id": {"key": "subnetId", "type": "str"}, - "encryption_at_host": {"key": "encryptionAtHost", "type": "str"}, - "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, - } - - def __init__( - self, - *, - vm_size: Optional[str] = None, - subnet_id: Optional[str] = None, - encryption_at_host: Optional[Union[str, "_models.EncryptionAtHost"]] = None, - disk_encryption_set_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword vm_size: The size of the master VMs. - :paramtype vm_size: str - :keyword subnet_id: The Azure resource ID of the master subnet. - :paramtype subnet_id: str - :keyword encryption_at_host: Whether master virtual machines are encrypted at host. Known - values are: "Disabled" and "Enabled". - :paramtype encryption_at_host: str or - ~azure.mgmt.redhatopenshift.v2022_09_04.models.EncryptionAtHost - :keyword disk_encryption_set_id: The resource ID of an associated DiskEncryptionSet, if - applicable. - :paramtype disk_encryption_set_id: str - """ - super().__init__(**kwargs) - self.vm_size = vm_size - self.subnet_id = subnet_id - self.encryption_at_host = encryption_at_host - self.disk_encryption_set_id = disk_encryption_set_id - - -class NetworkProfile(_serialization.Model): - """NetworkProfile represents a network profile. - - :ivar pod_cidr: The CIDR used for OpenShift/Kubernetes Pods. - :vartype pod_cidr: str - :ivar service_cidr: The CIDR used for OpenShift/Kubernetes Services. - :vartype service_cidr: str - :ivar outbound_type: The OutboundType used for egress traffic. Known values are: "Loadbalancer" - and "UserDefinedRouting". - :vartype outbound_type: str or ~azure.mgmt.redhatopenshift.v2022_09_04.models.OutboundType - """ - - _attribute_map = { - "pod_cidr": {"key": "podCidr", "type": "str"}, - "service_cidr": {"key": "serviceCidr", "type": "str"}, - "outbound_type": {"key": "outboundType", "type": "str"}, - } - - def __init__( - self, - *, - pod_cidr: Optional[str] = None, - service_cidr: Optional[str] = None, - outbound_type: Optional[Union[str, "_models.OutboundType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword pod_cidr: The CIDR used for OpenShift/Kubernetes Pods. - :paramtype pod_cidr: str - :keyword service_cidr: The CIDR used for OpenShift/Kubernetes Services. - :paramtype service_cidr: str - :keyword outbound_type: The OutboundType used for egress traffic. Known values are: - "Loadbalancer" and "UserDefinedRouting". - :paramtype outbound_type: str or ~azure.mgmt.redhatopenshift.v2022_09_04.models.OutboundType - """ - super().__init__(**kwargs) - self.pod_cidr = pod_cidr - self.service_cidr = service_cidr - self.outbound_type = outbound_type - - -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.redhatopenshift.v2022_09_04.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 OpenShiftCluster(TrackedResource): # pylint: disable=too-many-instance-attributes - """OpenShiftCluster represents an Azure Red Hat OpenShift cluster. - - 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.redhatopenshift.v2022_09_04.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 provisioning_state: The cluster provisioning state. Known values are: "AdminUpdating", - "Creating", "Deleting", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.redhatopenshift.v2022_09_04.models.ProvisioningState - :ivar cluster_profile: The cluster profile. - :vartype cluster_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.ClusterProfile - :ivar console_profile: The console profile. - :vartype console_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.ConsoleProfile - :ivar service_principal_profile: The cluster service principal profile. - :vartype service_principal_profile: - ~azure.mgmt.redhatopenshift.v2022_09_04.models.ServicePrincipalProfile - :ivar network_profile: The cluster network profile. - :vartype network_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.NetworkProfile - :ivar master_profile: The cluster master profile. - :vartype master_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MasterProfile - :ivar worker_profiles: The cluster worker profiles. - :vartype worker_profiles: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.WorkerProfile] - :ivar apiserver_profile: The cluster API server profile. - :vartype apiserver_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.APIServerProfile - :ivar ingress_profiles: The cluster ingress profiles. - :vartype ingress_profiles: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.IngressProfile] - """ - - _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"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "cluster_profile": {"key": "properties.clusterProfile", "type": "ClusterProfile"}, - "console_profile": {"key": "properties.consoleProfile", "type": "ConsoleProfile"}, - "service_principal_profile": {"key": "properties.servicePrincipalProfile", "type": "ServicePrincipalProfile"}, - "network_profile": {"key": "properties.networkProfile", "type": "NetworkProfile"}, - "master_profile": {"key": "properties.masterProfile", "type": "MasterProfile"}, - "worker_profiles": {"key": "properties.workerProfiles", "type": "[WorkerProfile]"}, - "apiserver_profile": {"key": "properties.apiserverProfile", "type": "APIServerProfile"}, - "ingress_profiles": {"key": "properties.ingressProfiles", "type": "[IngressProfile]"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, - cluster_profile: Optional["_models.ClusterProfile"] = None, - console_profile: Optional["_models.ConsoleProfile"] = None, - service_principal_profile: Optional["_models.ServicePrincipalProfile"] = None, - network_profile: Optional["_models.NetworkProfile"] = None, - master_profile: Optional["_models.MasterProfile"] = None, - worker_profiles: Optional[List["_models.WorkerProfile"]] = None, - apiserver_profile: Optional["_models.APIServerProfile"] = None, - ingress_profiles: Optional[List["_models.IngressProfile"]] = 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 provisioning_state: The cluster provisioning state. Known values are: "AdminUpdating", - "Creating", "Deleting", "Failed", "Succeeded", and "Updating". - :paramtype provisioning_state: str or - ~azure.mgmt.redhatopenshift.v2022_09_04.models.ProvisioningState - :keyword cluster_profile: The cluster profile. - :paramtype cluster_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.ClusterProfile - :keyword console_profile: The console profile. - :paramtype console_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.ConsoleProfile - :keyword service_principal_profile: The cluster service principal profile. - :paramtype service_principal_profile: - ~azure.mgmt.redhatopenshift.v2022_09_04.models.ServicePrincipalProfile - :keyword network_profile: The cluster network profile. - :paramtype network_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.NetworkProfile - :keyword master_profile: The cluster master profile. - :paramtype master_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MasterProfile - :keyword worker_profiles: The cluster worker profiles. - :paramtype worker_profiles: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.WorkerProfile] - :keyword apiserver_profile: The cluster API server profile. - :paramtype apiserver_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.APIServerProfile - :keyword ingress_profiles: The cluster ingress profiles. - :paramtype ingress_profiles: - list[~azure.mgmt.redhatopenshift.v2022_09_04.models.IngressProfile] - """ - super().__init__(tags=tags, location=location, **kwargs) - self.provisioning_state = provisioning_state - self.cluster_profile = cluster_profile - self.console_profile = console_profile - self.service_principal_profile = service_principal_profile - self.network_profile = network_profile - self.master_profile = master_profile - self.worker_profiles = worker_profiles - self.apiserver_profile = apiserver_profile - self.ingress_profiles = ingress_profiles - - -class OpenShiftClusterAdminKubeconfig(_serialization.Model): - """OpenShiftClusterAdminKubeconfig represents an OpenShift cluster's admin kubeconfig. - - :ivar kubeconfig: The base64-encoded kubeconfig file. - :vartype kubeconfig: str - """ - - _attribute_map = { - "kubeconfig": {"key": "kubeconfig", "type": "str"}, - } - - def __init__(self, *, kubeconfig: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword kubeconfig: The base64-encoded kubeconfig file. - :paramtype kubeconfig: str - """ - super().__init__(**kwargs) - self.kubeconfig = kubeconfig - - -class OpenShiftClusterCredentials(_serialization.Model): - """OpenShiftClusterCredentials represents an OpenShift cluster's credentials. - - :ivar kubeadmin_username: The username for the kubeadmin user. - :vartype kubeadmin_username: str - :ivar kubeadmin_password: The password for the kubeadmin user. - :vartype kubeadmin_password: str - """ - - _attribute_map = { - "kubeadmin_username": {"key": "kubeadminUsername", "type": "str"}, - "kubeadmin_password": {"key": "kubeadminPassword", "type": "str"}, - } - - def __init__( - self, *, kubeadmin_username: Optional[str] = None, kubeadmin_password: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword kubeadmin_username: The username for the kubeadmin user. - :paramtype kubeadmin_username: str - :keyword kubeadmin_password: The password for the kubeadmin user. - :paramtype kubeadmin_password: str - """ - super().__init__(**kwargs) - self.kubeadmin_username = kubeadmin_username - self.kubeadmin_password = kubeadmin_password - - -class OpenShiftClusterList(_serialization.Model): - """OpenShiftClusterList represents a list of OpenShift clusters. - - :ivar value: The list of OpenShift clusters. - :vartype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[OpenShiftCluster]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.OpenShiftCluster"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The list of OpenShift clusters. - :paramtype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class OpenShiftClusterUpdate(_serialization.Model): # pylint: disable=too-many-instance-attributes - """OpenShiftCluster represents an Azure Red Hat OpenShift cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar tags: The resource tags. - :vartype tags: dict[str, str] - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SystemData - :ivar provisioning_state: The cluster provisioning state. Known values are: "AdminUpdating", - "Creating", "Deleting", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.redhatopenshift.v2022_09_04.models.ProvisioningState - :ivar cluster_profile: The cluster profile. - :vartype cluster_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.ClusterProfile - :ivar console_profile: The console profile. - :vartype console_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.ConsoleProfile - :ivar service_principal_profile: The cluster service principal profile. - :vartype service_principal_profile: - ~azure.mgmt.redhatopenshift.v2022_09_04.models.ServicePrincipalProfile - :ivar network_profile: The cluster network profile. - :vartype network_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.NetworkProfile - :ivar master_profile: The cluster master profile. - :vartype master_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MasterProfile - :ivar worker_profiles: The cluster worker profiles. - :vartype worker_profiles: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.WorkerProfile] - :ivar apiserver_profile: The cluster API server profile. - :vartype apiserver_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.APIServerProfile - :ivar ingress_profiles: The cluster ingress profiles. - :vartype ingress_profiles: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.IngressProfile] - """ - - _validation = { - "system_data": {"readonly": True}, - } - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "cluster_profile": {"key": "properties.clusterProfile", "type": "ClusterProfile"}, - "console_profile": {"key": "properties.consoleProfile", "type": "ConsoleProfile"}, - "service_principal_profile": {"key": "properties.servicePrincipalProfile", "type": "ServicePrincipalProfile"}, - "network_profile": {"key": "properties.networkProfile", "type": "NetworkProfile"}, - "master_profile": {"key": "properties.masterProfile", "type": "MasterProfile"}, - "worker_profiles": {"key": "properties.workerProfiles", "type": "[WorkerProfile]"}, - "apiserver_profile": {"key": "properties.apiserverProfile", "type": "APIServerProfile"}, - "ingress_profiles": {"key": "properties.ingressProfiles", "type": "[IngressProfile]"}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, - cluster_profile: Optional["_models.ClusterProfile"] = None, - console_profile: Optional["_models.ConsoleProfile"] = None, - service_principal_profile: Optional["_models.ServicePrincipalProfile"] = None, - network_profile: Optional["_models.NetworkProfile"] = None, - master_profile: Optional["_models.MasterProfile"] = None, - worker_profiles: Optional[List["_models.WorkerProfile"]] = None, - apiserver_profile: Optional["_models.APIServerProfile"] = None, - ingress_profiles: Optional[List["_models.IngressProfile"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: The resource tags. - :paramtype tags: dict[str, str] - :keyword provisioning_state: The cluster provisioning state. Known values are: "AdminUpdating", - "Creating", "Deleting", "Failed", "Succeeded", and "Updating". - :paramtype provisioning_state: str or - ~azure.mgmt.redhatopenshift.v2022_09_04.models.ProvisioningState - :keyword cluster_profile: The cluster profile. - :paramtype cluster_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.ClusterProfile - :keyword console_profile: The console profile. - :paramtype console_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.ConsoleProfile - :keyword service_principal_profile: The cluster service principal profile. - :paramtype service_principal_profile: - ~azure.mgmt.redhatopenshift.v2022_09_04.models.ServicePrincipalProfile - :keyword network_profile: The cluster network profile. - :paramtype network_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.NetworkProfile - :keyword master_profile: The cluster master profile. - :paramtype master_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MasterProfile - :keyword worker_profiles: The cluster worker profiles. - :paramtype worker_profiles: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.WorkerProfile] - :keyword apiserver_profile: The cluster API server profile. - :paramtype apiserver_profile: ~azure.mgmt.redhatopenshift.v2022_09_04.models.APIServerProfile - :keyword ingress_profiles: The cluster ingress profiles. - :paramtype ingress_profiles: - list[~azure.mgmt.redhatopenshift.v2022_09_04.models.IngressProfile] - """ - super().__init__(**kwargs) - self.tags = tags - self.system_data = None - self.provisioning_state = provisioning_state - self.cluster_profile = cluster_profile - self.console_profile = console_profile - self.service_principal_profile = service_principal_profile - self.network_profile = network_profile - self.master_profile = master_profile - self.worker_profiles = worker_profiles - self.apiserver_profile = apiserver_profile - self.ingress_profiles = ingress_profiles - - -class OpenShiftVersion(ProxyResource): - """OpenShiftVersion represents an OpenShift version that can be installed. - - 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.redhatopenshift.v2022_09_04.models.SystemData - :ivar version: Version represents the version to create the cluster at. - :vartype version: str - """ - - _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"}, - "version": {"key": "properties.version", "type": "str"}, - } - - def __init__(self, *, version: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword version: Version represents the version to create the cluster at. - :paramtype version: str - """ - super().__init__(**kwargs) - self.version = version - - -class OpenShiftVersionList(_serialization.Model): - """OpenShiftVersionList represents a List of available versions. - - :ivar value: The List of available versions. - :vartype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftVersion] - :ivar next_link: Next Link to next operation. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[OpenShiftVersion]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.OpenShiftVersion"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The List of available versions. - :paramtype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftVersion] - :keyword next_link: Next Link to next operation. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class Operation(_serialization.Model): - """Operation represents an RP operation. - - :ivar name: Operation name: {provider}/{resource}/{operation}. - :vartype name: str - :ivar display: The object that describes the operation. - :vartype display: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Display - :ivar origin: Sources of requests to this operation. Comma separated list with valid values - user or system, e.g. "user,system". - :vartype origin: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "display": {"key": "display", "type": "Display"}, - "origin": {"key": "origin", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - display: Optional["_models.Display"] = None, - origin: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Operation name: {provider}/{resource}/{operation}. - :paramtype name: str - :keyword display: The object that describes the operation. - :paramtype display: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Display - :keyword origin: Sources of requests to this operation. Comma separated list with valid values - user or system, e.g. "user,system". - :paramtype origin: str - """ - super().__init__(**kwargs) - self.name = name - self.display = display - self.origin = origin - - -class OperationList(_serialization.Model): - """OperationList represents an RP operation list. - - :ivar value: List of operations supported by the resource provider. - :vartype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.Operation] - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Operation]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: List of operations supported by the resource provider. - :paramtype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.Operation] - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class Secret(ProxyResource): - """Secret represents a secret. - - 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.redhatopenshift.v2022_09_04.models.SystemData - :ivar secret_resources: The Secrets Resources. - :vartype secret_resources: str - """ - - _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"}, - "secret_resources": {"key": "properties.secretResources", "type": "str"}, - } - - def __init__(self, *, secret_resources: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword secret_resources: The Secrets Resources. - :paramtype secret_resources: str - """ - super().__init__(**kwargs) - self.secret_resources = secret_resources - - -class SecretList(_serialization.Model): - """SecretList represents a list of Secrets. - - :ivar value: The list of secrets. - :vartype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret] - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Secret]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.Secret"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of secrets. - :paramtype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret] - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SecretUpdate(_serialization.Model): - """Secret represents a secret. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SystemData - :ivar secret_resources: The Secrets Resources. - :vartype secret_resources: str - """ - - _validation = { - "system_data": {"readonly": True}, - } - - _attribute_map = { - "system_data": {"key": "systemData", "type": "SystemData"}, - "secret_resources": {"key": "properties.secretResources", "type": "str"}, - } - - def __init__(self, *, secret_resources: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword secret_resources: The Secrets Resources. - :paramtype secret_resources: str - """ - super().__init__(**kwargs) - self.system_data = None - self.secret_resources = secret_resources - - -class ServicePrincipalProfile(_serialization.Model): - """ServicePrincipalProfile represents a service principal profile. - - :ivar client_id: The client ID used for the cluster. - :vartype client_id: str - :ivar client_secret: The client secret used for the cluster. - :vartype client_secret: str - """ - - _attribute_map = { - "client_id": {"key": "clientId", "type": "str"}, - "client_secret": {"key": "clientSecret", "type": "str"}, - } - - def __init__(self, *, client_id: Optional[str] = None, client_secret: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword client_id: The client ID used for the cluster. - :paramtype client_id: str - :keyword client_secret: The client secret used for the cluster. - :paramtype client_secret: str - """ - super().__init__(**kwargs) - self.client_id = client_id - self.client_secret = client_secret - - -class SyncIdentityProvider(ProxyResource): - """SyncIdentityProvider represents a SyncIdentityProvider. - - 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.redhatopenshift.v2022_09_04.models.SystemData - :ivar resources: - :vartype resources: str - """ - - _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"}, - "resources": {"key": "properties.resources", "type": "str"}, - } - - def __init__(self, *, resources: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword resources: - :paramtype resources: str - """ - super().__init__(**kwargs) - self.resources = resources - - -class SyncIdentityProviderList(_serialization.Model): - """SyncSetList represents a list of SyncSets. - - :ivar value: The list of sync identity providers. - :vartype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider] - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[SyncIdentityProvider]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.SyncIdentityProvider"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The list of sync identity providers. - :paramtype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider] - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SyncIdentityProviderUpdate(_serialization.Model): - """SyncIdentityProvider represents a SyncIdentityProvider. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SystemData - :ivar resources: - :vartype resources: str - """ - - _validation = { - "system_data": {"readonly": True}, - } - - _attribute_map = { - "system_data": {"key": "systemData", "type": "SystemData"}, - "resources": {"key": "properties.resources", "type": "str"}, - } - - def __init__(self, *, resources: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword resources: - :paramtype resources: str - """ - super().__init__(**kwargs) - self.system_data = None - self.resources = resources - - -class SyncSet(ProxyResource): - """SyncSet represents a SyncSet for an Azure Red Hat OpenShift Cluster. - - 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.redhatopenshift.v2022_09_04.models.SystemData - :ivar resources: Resources represents the SyncSets configuration. - :vartype resources: str - """ - - _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"}, - "resources": {"key": "properties.resources", "type": "str"}, - } - - def __init__(self, *, resources: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword resources: Resources represents the SyncSets configuration. - :paramtype resources: str - """ - super().__init__(**kwargs) - self.resources = resources - - -class SyncSetList(_serialization.Model): - """SyncSetList represents a list of SyncSets. - - :ivar value: The list of syncsets. - :vartype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet] - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[SyncSet]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.SyncSet"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of syncsets. - :paramtype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet] - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SyncSetUpdate(_serialization.Model): - """SyncSet represents a SyncSet for an Azure Red Hat OpenShift Cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SystemData - :ivar resources: Resources represents the SyncSets configuration. - :vartype resources: str - """ - - _validation = { - "system_data": {"readonly": True}, - } - - _attribute_map = { - "system_data": {"key": "systemData", "type": "SystemData"}, - "resources": {"key": "properties.resources", "type": "str"}, - } - - def __init__(self, *, resources: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword resources: Resources represents the SyncSets configuration. - :paramtype resources: str - """ - super().__init__(**kwargs) - self.system_data = None - self.resources = resources - - -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.redhatopenshift.v2022_09_04.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.redhatopenshift.v2022_09_04.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.redhatopenshift.v2022_09_04.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.redhatopenshift.v2022_09_04.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 WorkerProfile(_serialization.Model): - """WorkerProfile represents a worker profile. - - :ivar name: The worker profile name. - :vartype name: str - :ivar vm_size: The size of the worker VMs. - :vartype vm_size: str - :ivar disk_size_gb: The disk size of the worker VMs. - :vartype disk_size_gb: int - :ivar subnet_id: The Azure resource ID of the worker subnet. - :vartype subnet_id: str - :ivar count: The number of worker VMs. - :vartype count: int - :ivar encryption_at_host: Whether master virtual machines are encrypted at host. Known values - are: "Disabled" and "Enabled". - :vartype encryption_at_host: str or - ~azure.mgmt.redhatopenshift.v2022_09_04.models.EncryptionAtHost - :ivar disk_encryption_set_id: The resource ID of an associated DiskEncryptionSet, if - applicable. - :vartype disk_encryption_set_id: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "vm_size": {"key": "vmSize", "type": "str"}, - "disk_size_gb": {"key": "diskSizeGB", "type": "int"}, - "subnet_id": {"key": "subnetId", "type": "str"}, - "count": {"key": "count", "type": "int"}, - "encryption_at_host": {"key": "encryptionAtHost", "type": "str"}, - "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - vm_size: Optional[str] = None, - disk_size_gb: Optional[int] = None, - subnet_id: Optional[str] = None, - count: Optional[int] = None, - encryption_at_host: Optional[Union[str, "_models.EncryptionAtHost"]] = None, - disk_encryption_set_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The worker profile name. - :paramtype name: str - :keyword vm_size: The size of the worker VMs. - :paramtype vm_size: str - :keyword disk_size_gb: The disk size of the worker VMs. - :paramtype disk_size_gb: int - :keyword subnet_id: The Azure resource ID of the worker subnet. - :paramtype subnet_id: str - :keyword count: The number of worker VMs. - :paramtype count: int - :keyword encryption_at_host: Whether master virtual machines are encrypted at host. Known - values are: "Disabled" and "Enabled". - :paramtype encryption_at_host: str or - ~azure.mgmt.redhatopenshift.v2022_09_04.models.EncryptionAtHost - :keyword disk_encryption_set_id: The resource ID of an associated DiskEncryptionSet, if - applicable. - :paramtype disk_encryption_set_id: str - """ - super().__init__(**kwargs) - self.name = name - self.vm_size = vm_size - self.disk_size_gb = disk_size_gb - self.subnet_id = subnet_id - self.count = count - self.encryption_at_host = encryption_at_host - self.disk_encryption_set_id = disk_encryption_set_id diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/models/_patch.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/operations/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/operations/__init__.py deleted file mode 100644 index f03257fe6903..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/operations/__init__.py +++ /dev/null @@ -1,31 +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 ._open_shift_versions_operations import OpenShiftVersionsOperations -from ._open_shift_clusters_operations import OpenShiftClustersOperations -from ._machine_pools_operations import MachinePoolsOperations -from ._secrets_operations import SecretsOperations -from ._sync_identity_providers_operations import SyncIdentityProvidersOperations -from ._sync_sets_operations import SyncSetsOperations - -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", - "OpenShiftVersionsOperations", - "OpenShiftClustersOperations", - "MachinePoolsOperations", - "SecretsOperations", - "SyncIdentityProvidersOperations", - "SyncSetsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/operations/_machine_pools_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/operations/_machine_pools_operations.py deleted file mode 100644 index 5a47044ea29d..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/operations/_machine_pools_operations.py +++ /dev/null @@ -1,802 +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, Optional, Type, TypeVar, Union, overload -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( - resource_group_name: str, resource_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-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/machinePools", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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, resource_name: str, child_resource_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-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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, resource_name: str, child_resource_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-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.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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 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, resource_name: str, child_resource_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-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, resource_name: str, child_resource_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-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.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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 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) - - -class MachinePoolsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2022_09_04.AzureRedHatOpenShiftClient`'s - :attr:`machine_pools` 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, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.MachinePool"]: - """Lists MachinePools that belong to that Azure Red Hat OpenShift Cluster. - - The operation returns properties of each MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: An iterator like instance of either MachinePool or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-04-01")) - cls: ClsType[_models.MachinePoolList] = 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( - resource_group_name=resource_group_name, - resource_name=resource_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("MachinePoolList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> _models.MachinePool: - """Gets a MachinePool with the specified subscription, resource group and resource name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool - :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-04-01")) - cls: ClsType[_models.MachinePool] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MachinePool", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.MachinePool, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MachinePool: - """Creates or updates a MachinePool with the specified subscription, resource group and resource - name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :param parameters: The MachinePool resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MachinePool: - """Creates or updates a MachinePool with the specified subscription, resource group and resource - name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :param parameters: The MachinePool resource. Required. - :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: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.MachinePool, IO[bytes]], - **kwargs: Any - ) -> _models.MachinePool: - """Creates or updates a MachinePool with the specified subscription, resource group and resource - name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :param parameters: The MachinePool resource. Is either a MachinePool type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool or IO[bytes] - :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool - :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-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MachinePool] = 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, "MachinePool") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("MachinePool", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("MachinePool", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> None: - """Deletes a MachinePool with the specified subscription, resource group and resource name. - - The operation returns nothing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :return: None or the result of cls(response) - :rtype: None - :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-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.MachinePoolUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MachinePool: - """Updates a MachinePool with the specified subscription, resource group and resource name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :param parameters: The MachinePool resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePoolUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MachinePool: - """Updates a MachinePool with the specified subscription, resource group and resource name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :param parameters: The MachinePool resource. Required. - :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: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.MachinePoolUpdate, IO[bytes]], - **kwargs: Any - ) -> _models.MachinePool: - """Updates a MachinePool with the specified subscription, resource group and resource name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :param parameters: The MachinePool resource. Is either a MachinePoolUpdate type or a IO[bytes] - type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePoolUpdate or IO[bytes] - :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool - :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-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MachinePool] = 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, "MachinePoolUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MachinePool", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/operations/_open_shift_clusters_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/operations/_open_shift_clusters_operations.py deleted file mode 100644 index 7308a8eee7ab..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/operations/_open_shift_clusters_operations.py +++ /dev/null @@ -1,1168 +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, - 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_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-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.RedHatOpenShift/openShiftClusters" - ) # pylint: disable=line-too-long - 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-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("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, resource_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-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _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, resource_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-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.RedHatOpenShift/openShiftClusters/{resourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, resource_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-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, resource_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-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.RedHatOpenShift/openShiftClusters/{resourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_admin_credentials_request( - resource_group_name: str, resource_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-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}/listAdminCredentials", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _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) - - -def build_list_credentials_request( - resource_group_name: str, resource_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-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}/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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _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 OpenShiftClustersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2022_09_04.AzureRedHatOpenShiftClient`'s - :attr:`open_shift_clusters` 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.OpenShiftCluster"]: - """Lists OpenShift clusters in the specified subscription. - - The operation returns properties of each OpenShift cluster. - - :return: An iterator like instance of either OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-04-01")) - cls: ClsType[_models.OpenShiftClusterList] = 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("OpenShiftClusterList", 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) - raise HttpResponseError(response=response, 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.OpenShiftCluster"]: - """Lists OpenShift clusters in the specified subscription and resource group. - - The operation returns properties of each OpenShift cluster. - - :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 OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-04-01")) - cls: ClsType[_models.OpenShiftClusterList] = 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("OpenShiftClusterList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.OpenShiftCluster: - """Gets a OpenShift cluster with the specified subscription, resource group and resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: OpenShiftCluster or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster - :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-04-01")) - cls: ClsType[_models.OpenShiftCluster] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenShiftCluster", 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, - resource_name: str, - parameters: Union[_models.OpenShiftCluster, IO[bytes]], - **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-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(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "OpenShiftCluster") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - 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 = 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]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.OpenShiftCluster, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster - :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 OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :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: An instance of LROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - parameters: Union[_models.OpenShiftCluster, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a OpenShiftCluster type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster or IO[bytes] - :return: An instance of LROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] - :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-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OpenShiftCluster] = 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, - resource_name=resource_name, - parameters=parameters, - 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("OpenShiftCluster", 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.OpenShiftCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OpenShiftCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, resource_name: str, **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-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes a OpenShift cluster with the specified subscription, resource group and resource name. - - The operation returns nothing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: 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-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, - resource_name=resource_name, - 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, **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 _update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: Union[_models.OpenShiftClusterUpdate, IO[bytes]], - **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-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(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "OpenShiftClusterUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - 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 = 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]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.OpenShiftClusterUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftClusterUpdate - :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 OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :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: An instance of LROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - resource_name: str, - parameters: Union[_models.OpenShiftClusterUpdate, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a OpenShiftClusterUpdate type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftClusterUpdate or - IO[bytes] - :return: An instance of LROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftCluster] - :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-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OpenShiftCluster] = 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, - resource_name=resource_name, - parameters=parameters, - 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("OpenShiftCluster", 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.OpenShiftCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OpenShiftCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_admin_credentials( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.OpenShiftClusterAdminKubeconfig: - """Lists admin kubeconfig of an OpenShift cluster with the specified subscription, resource group - and resource name. - - The operation returns the admin kubeconfig. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: OpenShiftClusterAdminKubeconfig or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftClusterAdminKubeconfig - :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-04-01")) - cls: ClsType[_models.OpenShiftClusterAdminKubeconfig] = kwargs.pop("cls", None) - - _request = build_list_admin_credentials_request( - resource_group_name=resource_group_name, - resource_name=resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenShiftClusterAdminKubeconfig", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_credentials( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.OpenShiftClusterCredentials: - """Lists credentials of an OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns the credentials. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: OpenShiftClusterCredentials or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftClusterCredentials - :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-04-01")) - cls: ClsType[_models.OpenShiftClusterCredentials] = kwargs.pop("cls", None) - - _request = build_list_credentials_request( - resource_group_name=resource_group_name, - resource_name=resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenShiftClusterCredentials", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/operations/_open_shift_versions_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/operations/_open_shift_versions_operations.py deleted file mode 100644 index 498c6eea76e1..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/operations/_open_shift_versions_operations.py +++ /dev/null @@ -1,168 +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(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.RedHatOpenShift/locations/{location}/openshiftversions", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "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) - - -class OpenShiftVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2022_09_04.AzureRedHatOpenShiftClient`'s - :attr:`open_shift_versions` 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, location: str, **kwargs: Any) -> Iterable["_models.OpenShiftVersion"]: - """Lists all OpenShift versions available to install in the specified location. - - The operation returns the installable OpenShift versions as strings. - - :param location: The name of Azure region. Required. - :type location: str - :return: An iterator like instance of either OpenShiftVersion or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-04-01")) - cls: ClsType[_models.OpenShiftVersionList] = 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( - location=location, - 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("OpenShiftVersionList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/operations/_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/operations/_operations.py deleted file mode 100644 index ebc0f27f2497..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_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", "2023-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.RedHatOpenShift/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.redhatopenshift.v2022_09_04.AzureRedHatOpenShiftClient`'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"]: - """Lists all of the available RP operations. - - The operation returns the RP operations. - - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.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-04-01")) - cls: ClsType[_models.OperationList] = 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("OperationList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/operations/_patch.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/operations/_secrets_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/operations/_secrets_operations.py deleted file mode 100644 index 593a79274e5e..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/operations/_secrets_operations.py +++ /dev/null @@ -1,797 +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, Optional, Type, TypeVar, Union, overload -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( - resource_group_name: str, resource_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-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/secrets", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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, resource_name: str, child_resource_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-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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, resource_name: str, child_resource_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-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.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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 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, resource_name: str, child_resource_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-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, resource_name: str, child_resource_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-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.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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 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) - - -class SecretsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2022_09_04.AzureRedHatOpenShiftClient`'s - :attr:`secrets` 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, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.Secret"]: - """Lists Secrets that belong to that Azure Red Hat OpenShift Cluster. - - The operation returns properties of each Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: An iterator like instance of either Secret or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-04-01")) - cls: ClsType[_models.SecretList] = 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( - resource_group_name=resource_group_name, - resource_name=resource_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("SecretList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> _models.Secret: - """Gets a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret - :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-04-01")) - cls: ClsType[_models.Secret] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Secret", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.Secret, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Secret: - """Creates or updates a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :param parameters: The Secret resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Secret: - """Creates or updates a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :param parameters: The Secret resource. Required. - :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: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.Secret, IO[bytes]], - **kwargs: Any - ) -> _models.Secret: - """Creates or updates a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :param parameters: The Secret resource. Is either a Secret type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret or IO[bytes] - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret - :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-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Secret] = 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, "Secret") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("Secret", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Secret", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> None: - """Deletes a Secret with the specified subscription, resource group and resource name. - - The operation returns nothing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :return: None or the result of cls(response) - :rtype: None - :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-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.SecretUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Secret: - """Updates a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :param parameters: The Secret resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SecretUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Secret: - """Updates a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :param parameters: The Secret resource. Required. - :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: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.SecretUpdate, IO[bytes]], - **kwargs: Any - ) -> _models.Secret: - """Updates a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :param parameters: The Secret resource. Is either a SecretUpdate type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SecretUpdate or IO[bytes] - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret - :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-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Secret] = 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, "SecretUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Secret", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/operations/_sync_identity_providers_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/operations/_sync_identity_providers_operations.py deleted file mode 100644 index 9262351aea34..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/operations/_sync_identity_providers_operations.py +++ /dev/null @@ -1,811 +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, Optional, Type, TypeVar, Union, overload -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( - resource_group_name: str, resource_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-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/syncIdentityProviders", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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, resource_name: str, child_resource_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-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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, resource_name: str, child_resource_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-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.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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 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, resource_name: str, child_resource_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-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, resource_name: str, child_resource_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-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.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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 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) - - -class SyncIdentityProvidersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2022_09_04.AzureRedHatOpenShiftClient`'s - :attr:`sync_identity_providers` 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, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.SyncIdentityProvider"]: - """Lists SyncIdentityProviders that belong to that Azure Red Hat OpenShift Cluster. - - The operation returns properties of each SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: An iterator like instance of either SyncIdentityProvider or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-04-01")) - cls: ClsType[_models.SyncIdentityProviderList] = 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( - resource_group_name=resource_group_name, - resource_name=resource_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("SyncIdentityProviderList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Gets a SyncIdentityProvider with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider - :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-04-01")) - cls: ClsType[_models.SyncIdentityProvider] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SyncIdentityProvider", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.SyncIdentityProvider, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Creates or updates a SyncIdentityProvider with the specified subscription, resource group and - resource name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Creates or updates a SyncIdentityProvider with the specified subscription, resource group and - resource name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Required. - :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: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.SyncIdentityProvider, IO[bytes]], - **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Creates or updates a SyncIdentityProvider with the specified subscription, resource group and - resource name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Is either a SyncIdentityProvider type or - a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider or - IO[bytes] - :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider - :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-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SyncIdentityProvider] = 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, "SyncIdentityProvider") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("SyncIdentityProvider", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SyncIdentityProvider", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> None: - """Deletes a SyncIdentityProvider with the specified subscription, resource group and resource - name. - - The operation returns nothing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :return: None or the result of cls(response) - :rtype: None - :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-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.SyncIdentityProviderUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Updates a SyncIdentityProvider with the specified subscription, resource group and resource - name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProviderUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Updates a SyncIdentityProvider with the specified subscription, resource group and resource - name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Required. - :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: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.SyncIdentityProviderUpdate, IO[bytes]], - **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Updates a SyncIdentityProvider with the specified subscription, resource group and resource - name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Is either a SyncIdentityProviderUpdate - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProviderUpdate or - IO[bytes] - :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider - :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-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SyncIdentityProvider] = 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, "SyncIdentityProviderUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SyncIdentityProvider", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/operations/_sync_sets_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/operations/_sync_sets_operations.py deleted file mode 100644 index a9cd5307e364..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/operations/_sync_sets_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, Optional, Type, TypeVar, Union, overload -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( - resource_group_name: str, resource_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-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/syncSets", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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, resource_name: str, child_resource_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-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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, resource_name: str, child_resource_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-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.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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 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, resource_name: str, child_resource_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-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, resource_name: str, child_resource_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-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.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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 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) - - -class SyncSetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2022_09_04.AzureRedHatOpenShiftClient`'s - :attr:`sync_sets` 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, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.SyncSet"]: - """Lists SyncSets that belong to that Azure Red Hat OpenShift Cluster. - - The operation returns properties of each SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: An iterator like instance of either SyncSet or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-04-01")) - cls: ClsType[_models.SyncSetList] = 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( - resource_group_name=resource_group_name, - resource_name=resource_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("SyncSetList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> _models.SyncSet: - """Gets a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet - :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-04-01")) - cls: ClsType[_models.SyncSet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SyncSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.SyncSet, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncSet: - """Creates or updates a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :param parameters: The SyncSet resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncSet: - """Creates or updates a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :param parameters: The SyncSet resource. Required. - :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: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.SyncSet, IO[bytes]], - **kwargs: Any - ) -> _models.SyncSet: - """Creates or updates a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :param parameters: The SyncSet resource. Is either a SyncSet type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet or IO[bytes] - :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet - :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-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SyncSet] = 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, "SyncSet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("SyncSet", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SyncSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> None: - """Deletes a SyncSet with the specified subscription, resource group and resource name. - - The operation returns nothing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :return: None or the result of cls(response) - :rtype: None - :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-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.SyncSetUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncSet: - """Updates a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :param parameters: The SyncSet resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSetUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncSet: - """Updates a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :param parameters: The SyncSet resource. Required. - :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: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.SyncSetUpdate, IO[bytes]], - **kwargs: Any - ) -> _models.SyncSet: - """Updates a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :param parameters: The SyncSet resource. Is either a SyncSetUpdate type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSetUpdate or IO[bytes] - :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet - :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-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SyncSet] = 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, "SyncSetUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SyncSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/py.typed b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_04_01/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/__init__.py deleted file mode 100644 index c64163c98d3d..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/__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 ._azure_red_hat_open_shift_client import AzureRedHatOpenShiftClient -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__ = [ - "AzureRedHatOpenShiftClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/_azure_red_hat_open_shift_client.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/_azure_red_hat_open_shift_client.py deleted file mode 100644 index 61a25f6fc182..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/_azure_red_hat_open_shift_client.py +++ /dev/null @@ -1,152 +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 AzureRedHatOpenShiftClientConfiguration -from .operations import ( - MachinePoolsOperations, - OpenShiftClustersOperations, - OpenShiftVersionsOperations, - Operations, - SecretsOperations, - SyncIdentityProvidersOperations, - SyncSetsOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class AzureRedHatOpenShiftClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """Rest API for Azure Red Hat OpenShift 4. - - :ivar operations: Operations operations - :vartype operations: azure.mgmt.redhatopenshift.v2023_09_04.operations.Operations - :ivar open_shift_versions: OpenShiftVersionsOperations operations - :vartype open_shift_versions: - azure.mgmt.redhatopenshift.v2023_09_04.operations.OpenShiftVersionsOperations - :ivar open_shift_clusters: OpenShiftClustersOperations operations - :vartype open_shift_clusters: - azure.mgmt.redhatopenshift.v2023_09_04.operations.OpenShiftClustersOperations - :ivar machine_pools: MachinePoolsOperations operations - :vartype machine_pools: - azure.mgmt.redhatopenshift.v2023_09_04.operations.MachinePoolsOperations - :ivar secrets: SecretsOperations operations - :vartype secrets: azure.mgmt.redhatopenshift.v2023_09_04.operations.SecretsOperations - :ivar sync_identity_providers: SyncIdentityProvidersOperations operations - :vartype sync_identity_providers: - azure.mgmt.redhatopenshift.v2023_09_04.operations.SyncIdentityProvidersOperations - :ivar sync_sets: SyncSetsOperations operations - :vartype sync_sets: azure.mgmt.redhatopenshift.v2023_09_04.operations.SyncSetsOperations - :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-09-04". 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 = AzureRedHatOpenShiftClientConfiguration( - 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-09-04") - self.open_shift_versions = OpenShiftVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-04" - ) - self.open_shift_clusters = OpenShiftClustersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-04" - ) - self.machine_pools = MachinePoolsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-04" - ) - self.secrets = SecretsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-09-04") - self.sync_identity_providers = SyncIdentityProvidersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-04" - ) - self.sync_sets = SyncSetsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-04" - ) - - 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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/_configuration.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/_configuration.py deleted file mode 100644 index e1db92839436..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/_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 AzureRedHatOpenShiftClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for AzureRedHatOpenShiftClient. - - 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-09-04". 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-09-04") - - 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-redhatopenshift/{}".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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/_metadata.json b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/_metadata.json deleted file mode 100644 index 85334370a987..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/_metadata.json +++ /dev/null @@ -1,116 +0,0 @@ -{ - "chosen_version": "2023-09-04", - "total_api_version_list": ["2023-09-04"], - "client": { - "name": "AzureRedHatOpenShiftClient", - "filename": "_azure_red_hat_open_shift_client", - "description": "Rest API for Azure Red Hat OpenShift 4.", - "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\": [\"AzureRedHatOpenShiftClientConfiguration\"], \".._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\": [\"AzureRedHatOpenShiftClientConfiguration\"], \"..._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", - "open_shift_versions": "OpenShiftVersionsOperations", - "open_shift_clusters": "OpenShiftClustersOperations", - "machine_pools": "MachinePoolsOperations", - "secrets": "SecretsOperations", - "sync_identity_providers": "SyncIdentityProvidersOperations", - "sync_sets": "SyncSetsOperations" - } -} diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/_patch.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/_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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/_version.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/_version.py deleted file mode 100644 index b2efd13ce94d..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/_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 = "1.5.0" diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/aio/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/aio/__init__.py deleted file mode 100644 index b06f0016da77..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/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 ._azure_red_hat_open_shift_client import AzureRedHatOpenShiftClient - -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__ = [ - "AzureRedHatOpenShiftClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/aio/_azure_red_hat_open_shift_client.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/aio/_azure_red_hat_open_shift_client.py deleted file mode 100644 index da21ad8fbd20..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/aio/_azure_red_hat_open_shift_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 AzureRedHatOpenShiftClientConfiguration -from .operations import ( - MachinePoolsOperations, - OpenShiftClustersOperations, - OpenShiftVersionsOperations, - Operations, - SecretsOperations, - SyncIdentityProvidersOperations, - SyncSetsOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class AzureRedHatOpenShiftClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """Rest API for Azure Red Hat OpenShift 4. - - :ivar operations: Operations operations - :vartype operations: azure.mgmt.redhatopenshift.v2023_09_04.aio.operations.Operations - :ivar open_shift_versions: OpenShiftVersionsOperations operations - :vartype open_shift_versions: - azure.mgmt.redhatopenshift.v2023_09_04.aio.operations.OpenShiftVersionsOperations - :ivar open_shift_clusters: OpenShiftClustersOperations operations - :vartype open_shift_clusters: - azure.mgmt.redhatopenshift.v2023_09_04.aio.operations.OpenShiftClustersOperations - :ivar machine_pools: MachinePoolsOperations operations - :vartype machine_pools: - azure.mgmt.redhatopenshift.v2023_09_04.aio.operations.MachinePoolsOperations - :ivar secrets: SecretsOperations operations - :vartype secrets: azure.mgmt.redhatopenshift.v2023_09_04.aio.operations.SecretsOperations - :ivar sync_identity_providers: SyncIdentityProvidersOperations operations - :vartype sync_identity_providers: - azure.mgmt.redhatopenshift.v2023_09_04.aio.operations.SyncIdentityProvidersOperations - :ivar sync_sets: SyncSetsOperations operations - :vartype sync_sets: azure.mgmt.redhatopenshift.v2023_09_04.aio.operations.SyncSetsOperations - :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-09-04". 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 = AzureRedHatOpenShiftClientConfiguration( - 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-09-04") - self.open_shift_versions = OpenShiftVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-04" - ) - self.open_shift_clusters = OpenShiftClustersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-04" - ) - self.machine_pools = MachinePoolsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-04" - ) - self.secrets = SecretsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-09-04") - self.sync_identity_providers = SyncIdentityProvidersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-04" - ) - self.sync_sets = SyncSetsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-04" - ) - - 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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/aio/_configuration.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/aio/_configuration.py deleted file mode 100644 index de59456f1e7c..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/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 AzureRedHatOpenShiftClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for AzureRedHatOpenShiftClient. - - 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-09-04". 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-09-04") - - 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-redhatopenshift/{}".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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/aio/_patch.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/aio/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/aio/operations/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/aio/operations/__init__.py deleted file mode 100644 index f03257fe6903..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/aio/operations/__init__.py +++ /dev/null @@ -1,31 +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 ._open_shift_versions_operations import OpenShiftVersionsOperations -from ._open_shift_clusters_operations import OpenShiftClustersOperations -from ._machine_pools_operations import MachinePoolsOperations -from ._secrets_operations import SecretsOperations -from ._sync_identity_providers_operations import SyncIdentityProvidersOperations -from ._sync_sets_operations import SyncSetsOperations - -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", - "OpenShiftVersionsOperations", - "OpenShiftClustersOperations", - "MachinePoolsOperations", - "SecretsOperations", - "SyncIdentityProvidersOperations", - "SyncSetsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/aio/operations/_open_shift_clusters_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/aio/operations/_open_shift_clusters_operations.py deleted file mode 100644 index 1891780df611..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/aio/operations/_open_shift_clusters_operations.py +++ /dev/null @@ -1,918 +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, - 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._open_shift_clusters_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_admin_credentials_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 OpenShiftClustersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2023_09_04.aio.AzureRedHatOpenShiftClient`'s - :attr:`open_shift_clusters` 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.OpenShiftCluster"]: - """Lists OpenShift clusters in the specified subscription. - - The operation returns properties of each OpenShift cluster. - - :return: An iterator like instance of either OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2023_09_04.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-04")) - cls: ClsType[_models.OpenShiftClusterList] = 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("OpenShiftClusterList", 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) - raise HttpResponseError(response=response, 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.OpenShiftCluster"]: - """Lists OpenShift clusters in the specified subscription and resource group. - - The operation returns properties of each OpenShift cluster. - - :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 OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2023_09_04.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-04")) - cls: ClsType[_models.OpenShiftClusterList] = 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("OpenShiftClusterList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.OpenShiftCluster: - """Gets a OpenShift cluster with the specified subscription, resource group and resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: OpenShiftCluster or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.OpenShiftCluster - :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-09-04")) - cls: ClsType[_models.OpenShiftCluster] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenShiftCluster", 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, - resource_name: str, - parameters: Union[_models.OpenShiftCluster, IO[bytes]], - **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-09-04")) - 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, "OpenShiftCluster") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - 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 = 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]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - 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, - resource_name: str, - parameters: _models.OpenShiftCluster, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.OpenShiftCluster - :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 OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2023_09_04.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :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: An instance of AsyncLROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2023_09_04.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - parameters: Union[_models.OpenShiftCluster, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a OpenShiftCluster type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.OpenShiftCluster or IO[bytes] - :return: An instance of AsyncLROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2023_09_04.models.OpenShiftCluster] - :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-09-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OpenShiftCluster] = 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, - resource_name=resource_name, - parameters=parameters, - 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("OpenShiftCluster", 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.OpenShiftCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OpenShiftCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, resource_name: str, **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-09-04")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - 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, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Deletes a OpenShift cluster with the specified subscription, resource group and resource name. - - The operation returns nothing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: 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-09-04")) - 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, - resource_name=resource_name, - 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, **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 _update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: Union[_models.OpenShiftClusterUpdate, IO[bytes]], - **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-09-04")) - 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, "OpenShiftClusterUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - 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 = 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]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.OpenShiftClusterUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Updates a OpenShift cluster with the specified subscription, resource group and resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.OpenShiftClusterUpdate - :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 OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2023_09_04.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Updates a OpenShift cluster with the specified subscription, resource group and resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :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: An instance of AsyncLROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2023_09_04.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - resource_name: str, - parameters: Union[_models.OpenShiftClusterUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Updates a OpenShift cluster with the specified subscription, resource group and resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a OpenShiftClusterUpdate type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.OpenShiftClusterUpdate or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redhatopenshift.v2023_09_04.models.OpenShiftCluster] - :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-09-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OpenShiftCluster] = 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, - resource_name=resource_name, - parameters=parameters, - 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("OpenShiftCluster", 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.OpenShiftCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OpenShiftCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace_async - async def list_admin_credentials( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.OpenShiftClusterAdminKubeconfig: - """Lists admin kubeconfig of an OpenShift cluster with the specified subscription, resource group - and resource name. - - The operation returns the admin kubeconfig. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: OpenShiftClusterAdminKubeconfig or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.OpenShiftClusterAdminKubeconfig - :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-09-04")) - cls: ClsType[_models.OpenShiftClusterAdminKubeconfig] = kwargs.pop("cls", None) - - _request = build_list_admin_credentials_request( - resource_group_name=resource_group_name, - resource_name=resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenShiftClusterAdminKubeconfig", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def list_credentials( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.OpenShiftClusterCredentials: - """Lists credentials of an OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns the credentials. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: OpenShiftClusterCredentials or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.OpenShiftClusterCredentials - :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-09-04")) - cls: ClsType[_models.OpenShiftClusterCredentials] = kwargs.pop("cls", None) - - _request = build_list_credentials_request( - resource_group_name=resource_group_name, - resource_name=resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenShiftClusterCredentials", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/aio/operations/_open_shift_versions_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/aio/operations/_open_shift_versions_operations.py deleted file mode 100644 index 4d2844c5931d..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/aio/operations/_open_shift_versions_operations.py +++ /dev/null @@ -1,137 +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._open_shift_versions_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 OpenShiftVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2023_09_04.aio.AzureRedHatOpenShiftClient`'s - :attr:`open_shift_versions` 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, location: str, **kwargs: Any) -> AsyncIterable["_models.OpenShiftVersion"]: - """Lists all OpenShift versions available to install in the specified location. - - The operation returns the installable OpenShift versions as strings. - - :param location: The name of Azure region. Required. - :type location: str - :return: An iterator like instance of either OpenShiftVersion or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2023_09_04.models.OpenShiftVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-04")) - cls: ClsType[_models.OpenShiftVersionList] = 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( - location=location, - 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("OpenShiftVersionList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/aio/operations/_patch.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/aio/operations/_sync_identity_providers_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/aio/operations/_sync_identity_providers_operations.py deleted file mode 100644 index dc2ec236e3f9..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/aio/operations/_sync_identity_providers_operations.py +++ /dev/null @@ -1,577 +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, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload -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.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._sync_identity_providers_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_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 SyncIdentityProvidersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2023_09_04.aio.AzureRedHatOpenShiftClient`'s - :attr:`sync_identity_providers` 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, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SyncIdentityProvider"]: - """Lists SyncIdentityProviders that belong to that Azure Red Hat OpenShift Cluster. - - The operation returns properties of each SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: An iterator like instance of either SyncIdentityProvider or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncIdentityProvider] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-04")) - cls: ClsType[_models.SyncIdentityProviderList] = 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( - resource_group_name=resource_group_name, - resource_name=resource_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("SyncIdentityProviderList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Gets a SyncIdentityProvider with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncIdentityProvider - :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-09-04")) - cls: ClsType[_models.SyncIdentityProvider] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SyncIdentityProvider", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.SyncIdentityProvider, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Creates or updates a SyncIdentityProvider with the specified subscription, resource group and - resource name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncIdentityProvider - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncIdentityProvider - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Creates or updates a SyncIdentityProvider with the specified subscription, resource group and - resource name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Required. - :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: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncIdentityProvider - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.SyncIdentityProvider, IO[bytes]], - **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Creates or updates a SyncIdentityProvider with the specified subscription, resource group and - resource name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Is either a SyncIdentityProvider type or - a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncIdentityProvider or - IO[bytes] - :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncIdentityProvider - :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-09-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SyncIdentityProvider] = 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, "SyncIdentityProvider") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("SyncIdentityProvider", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SyncIdentityProvider", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> None: - """Deletes a SyncIdentityProvider with the specified subscription, resource group and resource - name. - - The operation returns nothing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :return: None or the result of cls(response) - :rtype: None - :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-09-04")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.SyncIdentityProviderUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Updates a SyncIdentityProvider with the specified subscription, resource group and resource - name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncIdentityProviderUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncIdentityProvider - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Updates a SyncIdentityProvider with the specified subscription, resource group and resource - name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Required. - :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: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncIdentityProvider - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.SyncIdentityProviderUpdate, IO[bytes]], - **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Updates a SyncIdentityProvider with the specified subscription, resource group and resource - name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Is either a SyncIdentityProviderUpdate - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncIdentityProviderUpdate or - IO[bytes] - :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncIdentityProvider - :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-09-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SyncIdentityProvider] = 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, "SyncIdentityProviderUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SyncIdentityProvider", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/aio/operations/_sync_sets_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/aio/operations/_sync_sets_operations.py deleted file mode 100644 index aeeb04840112..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/aio/operations/_sync_sets_operations.py +++ /dev/null @@ -1,565 +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, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload -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.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._sync_sets_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_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 SyncSetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2023_09_04.aio.AzureRedHatOpenShiftClient`'s - :attr:`sync_sets` 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, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.SyncSet"]: - """Lists SyncSets that belong to that Azure Red Hat OpenShift Cluster. - - The operation returns properties of each SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: An iterator like instance of either SyncSet or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-04")) - cls: ClsType[_models.SyncSetList] = 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( - resource_group_name=resource_group_name, - resource_name=resource_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("SyncSetList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> _models.SyncSet: - """Gets a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncSet - :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-09-04")) - cls: ClsType[_models.SyncSet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SyncSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.SyncSet, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncSet: - """Creates or updates a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :param parameters: The SyncSet resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncSet - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncSet: - """Creates or updates a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :param parameters: The SyncSet resource. Required. - :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: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.SyncSet, IO[bytes]], - **kwargs: Any - ) -> _models.SyncSet: - """Creates or updates a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :param parameters: The SyncSet resource. Is either a SyncSet type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncSet or IO[bytes] - :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncSet - :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-09-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SyncSet] = 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, "SyncSet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("SyncSet", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SyncSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> None: - """Deletes a SyncSet with the specified subscription, resource group and resource name. - - The operation returns nothing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :return: None or the result of cls(response) - :rtype: None - :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-09-04")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.SyncSetUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncSet: - """Updates a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :param parameters: The SyncSet resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncSetUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncSet: - """Updates a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :param parameters: The SyncSet resource. Required. - :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: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.SyncSetUpdate, IO[bytes]], - **kwargs: Any - ) -> _models.SyncSet: - """Updates a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :param parameters: The SyncSet resource. Is either a SyncSetUpdate type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncSetUpdate or IO[bytes] - :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncSet - :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-09-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SyncSet] = 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, "SyncSetUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SyncSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/models/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/models/__init__.py deleted file mode 100644 index bfc079515b45..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/models/__init__.py +++ /dev/null @@ -1,101 +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 APIServerProfile -from ._models_py3 import CloudErrorBody -from ._models_py3 import ClusterProfile -from ._models_py3 import ConsoleProfile -from ._models_py3 import Display -from ._models_py3 import IngressProfile -from ._models_py3 import MachinePool -from ._models_py3 import MachinePoolList -from ._models_py3 import MachinePoolUpdate -from ._models_py3 import MasterProfile -from ._models_py3 import NetworkProfile -from ._models_py3 import OpenShiftCluster -from ._models_py3 import OpenShiftClusterAdminKubeconfig -from ._models_py3 import OpenShiftClusterCredentials -from ._models_py3 import OpenShiftClusterList -from ._models_py3 import OpenShiftClusterUpdate -from ._models_py3 import OpenShiftVersion -from ._models_py3 import OpenShiftVersionList -from ._models_py3 import Operation -from ._models_py3 import OperationList -from ._models_py3 import ProxyResource -from ._models_py3 import Resource -from ._models_py3 import Secret -from ._models_py3 import SecretList -from ._models_py3 import SecretUpdate -from ._models_py3 import ServicePrincipalProfile -from ._models_py3 import SyncIdentityProvider -from ._models_py3 import SyncIdentityProviderList -from ._models_py3 import SyncIdentityProviderUpdate -from ._models_py3 import SyncSet -from ._models_py3 import SyncSetList -from ._models_py3 import SyncSetUpdate -from ._models_py3 import SystemData -from ._models_py3 import TrackedResource -from ._models_py3 import WorkerProfile - -from ._azure_red_hat_open_shift_client_enums import CreatedByType -from ._azure_red_hat_open_shift_client_enums import EncryptionAtHost -from ._azure_red_hat_open_shift_client_enums import FipsValidatedModules -from ._azure_red_hat_open_shift_client_enums import OutboundType -from ._azure_red_hat_open_shift_client_enums import PreconfiguredNSG -from ._azure_red_hat_open_shift_client_enums import ProvisioningState -from ._azure_red_hat_open_shift_client_enums import Visibility -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "APIServerProfile", - "CloudErrorBody", - "ClusterProfile", - "ConsoleProfile", - "Display", - "IngressProfile", - "MachinePool", - "MachinePoolList", - "MachinePoolUpdate", - "MasterProfile", - "NetworkProfile", - "OpenShiftCluster", - "OpenShiftClusterAdminKubeconfig", - "OpenShiftClusterCredentials", - "OpenShiftClusterList", - "OpenShiftClusterUpdate", - "OpenShiftVersion", - "OpenShiftVersionList", - "Operation", - "OperationList", - "ProxyResource", - "Resource", - "Secret", - "SecretList", - "SecretUpdate", - "ServicePrincipalProfile", - "SyncIdentityProvider", - "SyncIdentityProviderList", - "SyncIdentityProviderUpdate", - "SyncSet", - "SyncSetList", - "SyncSetUpdate", - "SystemData", - "TrackedResource", - "WorkerProfile", - "CreatedByType", - "EncryptionAtHost", - "FipsValidatedModules", - "OutboundType", - "PreconfiguredNSG", - "ProvisioningState", - "Visibility", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/models/_azure_red_hat_open_shift_client_enums.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/models/_azure_red_hat_open_shift_client_enums.py deleted file mode 100644 index 439dcf724385..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/models/_azure_red_hat_open_shift_client_enums.py +++ /dev/null @@ -1,67 +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 EncryptionAtHost(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """EncryptionAtHost represents encryption at host state.""" - - DISABLED = "Disabled" - ENABLED = "Enabled" - - -class FipsValidatedModules(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """FipsValidatedModules determines if FIPS is used.""" - - DISABLED = "Disabled" - ENABLED = "Enabled" - - -class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The outbound routing strategy used to provide your cluster egress to the internet.""" - - LOADBALANCER = "Loadbalancer" - USER_DEFINED_ROUTING = "UserDefinedRouting" - - -class PreconfiguredNSG(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """PreconfiguredNSG represents whether customers want to use their own NSG attached to the - subnets. - """ - - DISABLED = "Disabled" - ENABLED = "Enabled" - - -class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ProvisioningState represents a provisioning state.""" - - ADMIN_UPDATING = "AdminUpdating" - CREATING = "Creating" - DELETING = "Deleting" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class Visibility(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Visibility represents visibility.""" - - PRIVATE = "Private" - PUBLIC = "Public" diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/models/_models_py3.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/models/_models_py3.py deleted file mode 100644 index 54b0a8eae612..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/models/_models_py3.py +++ /dev/null @@ -1,1535 +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 APIServerProfile(_serialization.Model): - """APIServerProfile represents an API server profile. - - :ivar visibility: API server visibility. Known values are: "Private" and "Public". - :vartype visibility: str or ~azure.mgmt.redhatopenshift.v2023_09_04.models.Visibility - :ivar url: The URL to access the cluster API server. - :vartype url: str - :ivar ip: The IP of the cluster API server. - :vartype ip: str - """ - - _attribute_map = { - "visibility": {"key": "visibility", "type": "str"}, - "url": {"key": "url", "type": "str"}, - "ip": {"key": "ip", "type": "str"}, - } - - def __init__( - self, - *, - visibility: Optional[Union[str, "_models.Visibility"]] = None, - url: Optional[str] = None, - ip: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword visibility: API server visibility. Known values are: "Private" and "Public". - :paramtype visibility: str or ~azure.mgmt.redhatopenshift.v2023_09_04.models.Visibility - :keyword url: The URL to access the cluster API server. - :paramtype url: str - :keyword ip: The IP of the cluster API server. - :paramtype ip: str - """ - super().__init__(**kwargs) - self.visibility = visibility - self.url = url - self.ip = ip - - -class CloudErrorBody(_serialization.Model): - """CloudErrorBody represents the body of a cloud error. - - :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :vartype code: str - :ivar message: A message describing the error, intended to be suitable for display in a user - interface. - :vartype message: str - :ivar target: The target of the particular error. For example, the name of the property in - error. - :vartype target: str - :ivar details: A list of additional details about the error. - :vartype details: list[~azure.mgmt.redhatopenshift.v2023_09_04.models.CloudErrorBody] - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[CloudErrorBody]"}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[List["_models.CloudErrorBody"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :paramtype code: str - :keyword message: A message describing the error, intended to be suitable for display in a user - interface. - :paramtype message: str - :keyword target: The target of the particular error. For example, the name of the property in - error. - :paramtype target: str - :keyword details: A list of additional details about the error. - :paramtype details: list[~azure.mgmt.redhatopenshift.v2023_09_04.models.CloudErrorBody] - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - -class ClusterProfile(_serialization.Model): - """ClusterProfile represents a cluster profile. - - :ivar pull_secret: The pull secret for the cluster. - :vartype pull_secret: str - :ivar domain: The domain for the cluster. - :vartype domain: str - :ivar version: The version of the cluster. - :vartype version: str - :ivar resource_group_id: The ID of the cluster resource group. - :vartype resource_group_id: str - :ivar fips_validated_modules: If FIPS validated crypto modules are used. Known values are: - "Disabled" and "Enabled". - :vartype fips_validated_modules: str or - ~azure.mgmt.redhatopenshift.v2023_09_04.models.FipsValidatedModules - """ - - _attribute_map = { - "pull_secret": {"key": "pullSecret", "type": "str"}, - "domain": {"key": "domain", "type": "str"}, - "version": {"key": "version", "type": "str"}, - "resource_group_id": {"key": "resourceGroupId", "type": "str"}, - "fips_validated_modules": {"key": "fipsValidatedModules", "type": "str"}, - } - - def __init__( - self, - *, - pull_secret: Optional[str] = None, - domain: Optional[str] = None, - version: Optional[str] = None, - resource_group_id: Optional[str] = None, - fips_validated_modules: Optional[Union[str, "_models.FipsValidatedModules"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword pull_secret: The pull secret for the cluster. - :paramtype pull_secret: str - :keyword domain: The domain for the cluster. - :paramtype domain: str - :keyword version: The version of the cluster. - :paramtype version: str - :keyword resource_group_id: The ID of the cluster resource group. - :paramtype resource_group_id: str - :keyword fips_validated_modules: If FIPS validated crypto modules are used. Known values are: - "Disabled" and "Enabled". - :paramtype fips_validated_modules: str or - ~azure.mgmt.redhatopenshift.v2023_09_04.models.FipsValidatedModules - """ - super().__init__(**kwargs) - self.pull_secret = pull_secret - self.domain = domain - self.version = version - self.resource_group_id = resource_group_id - self.fips_validated_modules = fips_validated_modules - - -class ConsoleProfile(_serialization.Model): - """ConsoleProfile represents a console profile. - - :ivar url: The URL to access the cluster console. - :vartype url: str - """ - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - } - - def __init__(self, *, url: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword url: The URL to access the cluster console. - :paramtype url: str - """ - super().__init__(**kwargs) - self.url = url - - -class Display(_serialization.Model): - """Display represents the display details of an operation. - - :ivar provider: Friendly name of the resource provider. - :vartype provider: str - :ivar resource: Resource type on which the operation is performed. - :vartype resource: str - :ivar operation: Operation type: read, write, delete, listKeys/action, etc. - :vartype operation: str - :ivar description: Friendly name of the operation. - :vartype description: str - """ - - _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__( - self, - *, - provider: Optional[str] = None, - resource: Optional[str] = None, - operation: Optional[str] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword provider: Friendly name of the resource provider. - :paramtype provider: str - :keyword resource: Resource type on which the operation is performed. - :paramtype resource: str - :keyword operation: Operation type: read, write, delete, listKeys/action, etc. - :paramtype operation: str - :keyword description: Friendly name of the operation. - :paramtype description: str - """ - super().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class IngressProfile(_serialization.Model): - """IngressProfile represents an ingress profile. - - :ivar name: The ingress profile name. - :vartype name: str - :ivar visibility: Ingress visibility. Known values are: "Private" and "Public". - :vartype visibility: str or ~azure.mgmt.redhatopenshift.v2023_09_04.models.Visibility - :ivar ip: The IP of the ingress. - :vartype ip: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "visibility": {"key": "visibility", "type": "str"}, - "ip": {"key": "ip", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - visibility: Optional[Union[str, "_models.Visibility"]] = None, - ip: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The ingress profile name. - :paramtype name: str - :keyword visibility: Ingress visibility. Known values are: "Private" and "Public". - :paramtype visibility: str or ~azure.mgmt.redhatopenshift.v2023_09_04.models.Visibility - :keyword ip: The IP of the ingress. - :paramtype ip: str - """ - super().__init__(**kwargs) - self.name = name - self.visibility = visibility - self.ip = ip - - -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.redhatopenshift.v2023_09_04.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have - tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SystemData - """ - - -class MachinePool(ProxyResource): - """MachinePool represents a MachinePool. - - 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.redhatopenshift.v2023_09_04.models.SystemData - :ivar resources: - :vartype resources: str - """ - - _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"}, - "resources": {"key": "properties.resources", "type": "str"}, - } - - def __init__(self, *, resources: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword resources: - :paramtype resources: str - """ - super().__init__(**kwargs) - self.resources = resources - - -class MachinePoolList(_serialization.Model): - """MachinePoolList represents a list of MachinePools. - - :ivar value: The list of Machine Pools. - :vartype value: list[~azure.mgmt.redhatopenshift.v2023_09_04.models.MachinePool] - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[MachinePool]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.MachinePool"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of Machine Pools. - :paramtype value: list[~azure.mgmt.redhatopenshift.v2023_09_04.models.MachinePool] - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class MachinePoolUpdate(_serialization.Model): - """MachinePool represents a MachinePool. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SystemData - :ivar resources: - :vartype resources: str - """ - - _validation = { - "system_data": {"readonly": True}, - } - - _attribute_map = { - "system_data": {"key": "systemData", "type": "SystemData"}, - "resources": {"key": "properties.resources", "type": "str"}, - } - - def __init__(self, *, resources: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword resources: - :paramtype resources: str - """ - super().__init__(**kwargs) - self.system_data = None - self.resources = resources - - -class MasterProfile(_serialization.Model): - """MasterProfile represents a master profile. - - :ivar vm_size: The size of the master VMs. - :vartype vm_size: str - :ivar subnet_id: The Azure resource ID of the master subnet. - :vartype subnet_id: str - :ivar encryption_at_host: Whether master virtual machines are encrypted at host. Known values - are: "Disabled" and "Enabled". - :vartype encryption_at_host: str or - ~azure.mgmt.redhatopenshift.v2023_09_04.models.EncryptionAtHost - :ivar disk_encryption_set_id: The resource ID of an associated DiskEncryptionSet, if - applicable. - :vartype disk_encryption_set_id: str - """ - - _attribute_map = { - "vm_size": {"key": "vmSize", "type": "str"}, - "subnet_id": {"key": "subnetId", "type": "str"}, - "encryption_at_host": {"key": "encryptionAtHost", "type": "str"}, - "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, - } - - def __init__( - self, - *, - vm_size: Optional[str] = None, - subnet_id: Optional[str] = None, - encryption_at_host: Optional[Union[str, "_models.EncryptionAtHost"]] = None, - disk_encryption_set_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword vm_size: The size of the master VMs. - :paramtype vm_size: str - :keyword subnet_id: The Azure resource ID of the master subnet. - :paramtype subnet_id: str - :keyword encryption_at_host: Whether master virtual machines are encrypted at host. Known - values are: "Disabled" and "Enabled". - :paramtype encryption_at_host: str or - ~azure.mgmt.redhatopenshift.v2023_09_04.models.EncryptionAtHost - :keyword disk_encryption_set_id: The resource ID of an associated DiskEncryptionSet, if - applicable. - :paramtype disk_encryption_set_id: str - """ - super().__init__(**kwargs) - self.vm_size = vm_size - self.subnet_id = subnet_id - self.encryption_at_host = encryption_at_host - self.disk_encryption_set_id = disk_encryption_set_id - - -class NetworkProfile(_serialization.Model): - """NetworkProfile represents a network profile. - - :ivar pod_cidr: The CIDR used for OpenShift/Kubernetes Pods. - :vartype pod_cidr: str - :ivar service_cidr: The CIDR used for OpenShift/Kubernetes Services. - :vartype service_cidr: str - :ivar outbound_type: The OutboundType used for egress traffic. Known values are: "Loadbalancer" - and "UserDefinedRouting". - :vartype outbound_type: str or ~azure.mgmt.redhatopenshift.v2023_09_04.models.OutboundType - :ivar preconfigured_nsg: Specifies whether subnets are pre-attached with an NSG. Known values - are: "Disabled" and "Enabled". - :vartype preconfigured_nsg: str or - ~azure.mgmt.redhatopenshift.v2023_09_04.models.PreconfiguredNSG - """ - - _attribute_map = { - "pod_cidr": {"key": "podCidr", "type": "str"}, - "service_cidr": {"key": "serviceCidr", "type": "str"}, - "outbound_type": {"key": "outboundType", "type": "str"}, - "preconfigured_nsg": {"key": "preconfiguredNSG", "type": "str"}, - } - - def __init__( - self, - *, - pod_cidr: Optional[str] = None, - service_cidr: Optional[str] = None, - outbound_type: Optional[Union[str, "_models.OutboundType"]] = None, - preconfigured_nsg: Optional[Union[str, "_models.PreconfiguredNSG"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword pod_cidr: The CIDR used for OpenShift/Kubernetes Pods. - :paramtype pod_cidr: str - :keyword service_cidr: The CIDR used for OpenShift/Kubernetes Services. - :paramtype service_cidr: str - :keyword outbound_type: The OutboundType used for egress traffic. Known values are: - "Loadbalancer" and "UserDefinedRouting". - :paramtype outbound_type: str or ~azure.mgmt.redhatopenshift.v2023_09_04.models.OutboundType - :keyword preconfigured_nsg: Specifies whether subnets are pre-attached with an NSG. Known - values are: "Disabled" and "Enabled". - :paramtype preconfigured_nsg: str or - ~azure.mgmt.redhatopenshift.v2023_09_04.models.PreconfiguredNSG - """ - super().__init__(**kwargs) - self.pod_cidr = pod_cidr - self.service_cidr = service_cidr - self.outbound_type = outbound_type - self.preconfigured_nsg = preconfigured_nsg - - -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.redhatopenshift.v2023_09_04.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 OpenShiftCluster(TrackedResource): # pylint: disable=too-many-instance-attributes - """OpenShiftCluster represents an Azure Red Hat OpenShift cluster. - - 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.redhatopenshift.v2023_09_04.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 provisioning_state: The cluster provisioning state. Known values are: "AdminUpdating", - "Creating", "Deleting", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.redhatopenshift.v2023_09_04.models.ProvisioningState - :ivar cluster_profile: The cluster profile. - :vartype cluster_profile: ~azure.mgmt.redhatopenshift.v2023_09_04.models.ClusterProfile - :ivar console_profile: The console profile. - :vartype console_profile: ~azure.mgmt.redhatopenshift.v2023_09_04.models.ConsoleProfile - :ivar service_principal_profile: The cluster service principal profile. - :vartype service_principal_profile: - ~azure.mgmt.redhatopenshift.v2023_09_04.models.ServicePrincipalProfile - :ivar network_profile: The cluster network profile. - :vartype network_profile: ~azure.mgmt.redhatopenshift.v2023_09_04.models.NetworkProfile - :ivar master_profile: The cluster master profile. - :vartype master_profile: ~azure.mgmt.redhatopenshift.v2023_09_04.models.MasterProfile - :ivar worker_profiles: The cluster worker profiles. - :vartype worker_profiles: list[~azure.mgmt.redhatopenshift.v2023_09_04.models.WorkerProfile] - :ivar worker_profiles_status: The cluster worker profiles status. - :vartype worker_profiles_status: - list[~azure.mgmt.redhatopenshift.v2023_09_04.models.WorkerProfile] - :ivar apiserver_profile: The cluster API server profile. - :vartype apiserver_profile: ~azure.mgmt.redhatopenshift.v2023_09_04.models.APIServerProfile - :ivar ingress_profiles: The cluster ingress profiles. - :vartype ingress_profiles: list[~azure.mgmt.redhatopenshift.v2023_09_04.models.IngressProfile] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "worker_profiles_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"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "cluster_profile": {"key": "properties.clusterProfile", "type": "ClusterProfile"}, - "console_profile": {"key": "properties.consoleProfile", "type": "ConsoleProfile"}, - "service_principal_profile": {"key": "properties.servicePrincipalProfile", "type": "ServicePrincipalProfile"}, - "network_profile": {"key": "properties.networkProfile", "type": "NetworkProfile"}, - "master_profile": {"key": "properties.masterProfile", "type": "MasterProfile"}, - "worker_profiles": {"key": "properties.workerProfiles", "type": "[WorkerProfile]"}, - "worker_profiles_status": {"key": "properties.workerProfilesStatus", "type": "[WorkerProfile]"}, - "apiserver_profile": {"key": "properties.apiserverProfile", "type": "APIServerProfile"}, - "ingress_profiles": {"key": "properties.ingressProfiles", "type": "[IngressProfile]"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, - cluster_profile: Optional["_models.ClusterProfile"] = None, - console_profile: Optional["_models.ConsoleProfile"] = None, - service_principal_profile: Optional["_models.ServicePrincipalProfile"] = None, - network_profile: Optional["_models.NetworkProfile"] = None, - master_profile: Optional["_models.MasterProfile"] = None, - worker_profiles: Optional[List["_models.WorkerProfile"]] = None, - apiserver_profile: Optional["_models.APIServerProfile"] = None, - ingress_profiles: Optional[List["_models.IngressProfile"]] = 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 provisioning_state: The cluster provisioning state. Known values are: "AdminUpdating", - "Creating", "Deleting", "Failed", "Succeeded", and "Updating". - :paramtype provisioning_state: str or - ~azure.mgmt.redhatopenshift.v2023_09_04.models.ProvisioningState - :keyword cluster_profile: The cluster profile. - :paramtype cluster_profile: ~azure.mgmt.redhatopenshift.v2023_09_04.models.ClusterProfile - :keyword console_profile: The console profile. - :paramtype console_profile: ~azure.mgmt.redhatopenshift.v2023_09_04.models.ConsoleProfile - :keyword service_principal_profile: The cluster service principal profile. - :paramtype service_principal_profile: - ~azure.mgmt.redhatopenshift.v2023_09_04.models.ServicePrincipalProfile - :keyword network_profile: The cluster network profile. - :paramtype network_profile: ~azure.mgmt.redhatopenshift.v2023_09_04.models.NetworkProfile - :keyword master_profile: The cluster master profile. - :paramtype master_profile: ~azure.mgmt.redhatopenshift.v2023_09_04.models.MasterProfile - :keyword worker_profiles: The cluster worker profiles. - :paramtype worker_profiles: list[~azure.mgmt.redhatopenshift.v2023_09_04.models.WorkerProfile] - :keyword apiserver_profile: The cluster API server profile. - :paramtype apiserver_profile: ~azure.mgmt.redhatopenshift.v2023_09_04.models.APIServerProfile - :keyword ingress_profiles: The cluster ingress profiles. - :paramtype ingress_profiles: - list[~azure.mgmt.redhatopenshift.v2023_09_04.models.IngressProfile] - """ - super().__init__(tags=tags, location=location, **kwargs) - self.provisioning_state = provisioning_state - self.cluster_profile = cluster_profile - self.console_profile = console_profile - self.service_principal_profile = service_principal_profile - self.network_profile = network_profile - self.master_profile = master_profile - self.worker_profiles = worker_profiles - self.worker_profiles_status = None - self.apiserver_profile = apiserver_profile - self.ingress_profiles = ingress_profiles - - -class OpenShiftClusterAdminKubeconfig(_serialization.Model): - """OpenShiftClusterAdminKubeconfig represents an OpenShift cluster's admin kubeconfig. - - :ivar kubeconfig: The base64-encoded kubeconfig file. - :vartype kubeconfig: str - """ - - _attribute_map = { - "kubeconfig": {"key": "kubeconfig", "type": "str"}, - } - - def __init__(self, *, kubeconfig: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword kubeconfig: The base64-encoded kubeconfig file. - :paramtype kubeconfig: str - """ - super().__init__(**kwargs) - self.kubeconfig = kubeconfig - - -class OpenShiftClusterCredentials(_serialization.Model): - """OpenShiftClusterCredentials represents an OpenShift cluster's credentials. - - :ivar kubeadmin_username: The username for the kubeadmin user. - :vartype kubeadmin_username: str - :ivar kubeadmin_password: The password for the kubeadmin user. - :vartype kubeadmin_password: str - """ - - _attribute_map = { - "kubeadmin_username": {"key": "kubeadminUsername", "type": "str"}, - "kubeadmin_password": {"key": "kubeadminPassword", "type": "str"}, - } - - def __init__( - self, *, kubeadmin_username: Optional[str] = None, kubeadmin_password: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword kubeadmin_username: The username for the kubeadmin user. - :paramtype kubeadmin_username: str - :keyword kubeadmin_password: The password for the kubeadmin user. - :paramtype kubeadmin_password: str - """ - super().__init__(**kwargs) - self.kubeadmin_username = kubeadmin_username - self.kubeadmin_password = kubeadmin_password - - -class OpenShiftClusterList(_serialization.Model): - """OpenShiftClusterList represents a list of OpenShift clusters. - - :ivar value: The list of OpenShift clusters. - :vartype value: list[~azure.mgmt.redhatopenshift.v2023_09_04.models.OpenShiftCluster] - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[OpenShiftCluster]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.OpenShiftCluster"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The list of OpenShift clusters. - :paramtype value: list[~azure.mgmt.redhatopenshift.v2023_09_04.models.OpenShiftCluster] - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class OpenShiftClusterUpdate(_serialization.Model): # pylint: disable=too-many-instance-attributes - """OpenShiftCluster represents an Azure Red Hat OpenShift cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar tags: The resource tags. - :vartype tags: dict[str, str] - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SystemData - :ivar provisioning_state: The cluster provisioning state. Known values are: "AdminUpdating", - "Creating", "Deleting", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.redhatopenshift.v2023_09_04.models.ProvisioningState - :ivar cluster_profile: The cluster profile. - :vartype cluster_profile: ~azure.mgmt.redhatopenshift.v2023_09_04.models.ClusterProfile - :ivar console_profile: The console profile. - :vartype console_profile: ~azure.mgmt.redhatopenshift.v2023_09_04.models.ConsoleProfile - :ivar service_principal_profile: The cluster service principal profile. - :vartype service_principal_profile: - ~azure.mgmt.redhatopenshift.v2023_09_04.models.ServicePrincipalProfile - :ivar network_profile: The cluster network profile. - :vartype network_profile: ~azure.mgmt.redhatopenshift.v2023_09_04.models.NetworkProfile - :ivar master_profile: The cluster master profile. - :vartype master_profile: ~azure.mgmt.redhatopenshift.v2023_09_04.models.MasterProfile - :ivar worker_profiles: The cluster worker profiles. - :vartype worker_profiles: list[~azure.mgmt.redhatopenshift.v2023_09_04.models.WorkerProfile] - :ivar worker_profiles_status: The cluster worker profiles status. - :vartype worker_profiles_status: - list[~azure.mgmt.redhatopenshift.v2023_09_04.models.WorkerProfile] - :ivar apiserver_profile: The cluster API server profile. - :vartype apiserver_profile: ~azure.mgmt.redhatopenshift.v2023_09_04.models.APIServerProfile - :ivar ingress_profiles: The cluster ingress profiles. - :vartype ingress_profiles: list[~azure.mgmt.redhatopenshift.v2023_09_04.models.IngressProfile] - """ - - _validation = { - "system_data": {"readonly": True}, - "worker_profiles_status": {"readonly": True}, - } - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "cluster_profile": {"key": "properties.clusterProfile", "type": "ClusterProfile"}, - "console_profile": {"key": "properties.consoleProfile", "type": "ConsoleProfile"}, - "service_principal_profile": {"key": "properties.servicePrincipalProfile", "type": "ServicePrincipalProfile"}, - "network_profile": {"key": "properties.networkProfile", "type": "NetworkProfile"}, - "master_profile": {"key": "properties.masterProfile", "type": "MasterProfile"}, - "worker_profiles": {"key": "properties.workerProfiles", "type": "[WorkerProfile]"}, - "worker_profiles_status": {"key": "properties.workerProfilesStatus", "type": "[WorkerProfile]"}, - "apiserver_profile": {"key": "properties.apiserverProfile", "type": "APIServerProfile"}, - "ingress_profiles": {"key": "properties.ingressProfiles", "type": "[IngressProfile]"}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, - cluster_profile: Optional["_models.ClusterProfile"] = None, - console_profile: Optional["_models.ConsoleProfile"] = None, - service_principal_profile: Optional["_models.ServicePrincipalProfile"] = None, - network_profile: Optional["_models.NetworkProfile"] = None, - master_profile: Optional["_models.MasterProfile"] = None, - worker_profiles: Optional[List["_models.WorkerProfile"]] = None, - apiserver_profile: Optional["_models.APIServerProfile"] = None, - ingress_profiles: Optional[List["_models.IngressProfile"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: The resource tags. - :paramtype tags: dict[str, str] - :keyword provisioning_state: The cluster provisioning state. Known values are: "AdminUpdating", - "Creating", "Deleting", "Failed", "Succeeded", and "Updating". - :paramtype provisioning_state: str or - ~azure.mgmt.redhatopenshift.v2023_09_04.models.ProvisioningState - :keyword cluster_profile: The cluster profile. - :paramtype cluster_profile: ~azure.mgmt.redhatopenshift.v2023_09_04.models.ClusterProfile - :keyword console_profile: The console profile. - :paramtype console_profile: ~azure.mgmt.redhatopenshift.v2023_09_04.models.ConsoleProfile - :keyword service_principal_profile: The cluster service principal profile. - :paramtype service_principal_profile: - ~azure.mgmt.redhatopenshift.v2023_09_04.models.ServicePrincipalProfile - :keyword network_profile: The cluster network profile. - :paramtype network_profile: ~azure.mgmt.redhatopenshift.v2023_09_04.models.NetworkProfile - :keyword master_profile: The cluster master profile. - :paramtype master_profile: ~azure.mgmt.redhatopenshift.v2023_09_04.models.MasterProfile - :keyword worker_profiles: The cluster worker profiles. - :paramtype worker_profiles: list[~azure.mgmt.redhatopenshift.v2023_09_04.models.WorkerProfile] - :keyword apiserver_profile: The cluster API server profile. - :paramtype apiserver_profile: ~azure.mgmt.redhatopenshift.v2023_09_04.models.APIServerProfile - :keyword ingress_profiles: The cluster ingress profiles. - :paramtype ingress_profiles: - list[~azure.mgmt.redhatopenshift.v2023_09_04.models.IngressProfile] - """ - super().__init__(**kwargs) - self.tags = tags - self.system_data = None - self.provisioning_state = provisioning_state - self.cluster_profile = cluster_profile - self.console_profile = console_profile - self.service_principal_profile = service_principal_profile - self.network_profile = network_profile - self.master_profile = master_profile - self.worker_profiles = worker_profiles - self.worker_profiles_status = None - self.apiserver_profile = apiserver_profile - self.ingress_profiles = ingress_profiles - - -class OpenShiftVersion(ProxyResource): - """OpenShiftVersion represents an OpenShift version that can be installed. - - 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.redhatopenshift.v2023_09_04.models.SystemData - :ivar version: Version represents the version to create the cluster at. - :vartype version: str - """ - - _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"}, - "version": {"key": "properties.version", "type": "str"}, - } - - def __init__(self, *, version: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword version: Version represents the version to create the cluster at. - :paramtype version: str - """ - super().__init__(**kwargs) - self.version = version - - -class OpenShiftVersionList(_serialization.Model): - """OpenShiftVersionList represents a List of available versions. - - :ivar value: The List of available versions. - :vartype value: list[~azure.mgmt.redhatopenshift.v2023_09_04.models.OpenShiftVersion] - :ivar next_link: Next Link to next operation. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[OpenShiftVersion]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.OpenShiftVersion"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The List of available versions. - :paramtype value: list[~azure.mgmt.redhatopenshift.v2023_09_04.models.OpenShiftVersion] - :keyword next_link: Next Link to next operation. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class Operation(_serialization.Model): - """Operation represents an RP operation. - - :ivar name: Operation name: {provider}/{resource}/{operation}. - :vartype name: str - :ivar display: The object that describes the operation. - :vartype display: ~azure.mgmt.redhatopenshift.v2023_09_04.models.Display - :ivar origin: Sources of requests to this operation. Comma separated list with valid values - user or system, e.g. "user,system". - :vartype origin: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "display": {"key": "display", "type": "Display"}, - "origin": {"key": "origin", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - display: Optional["_models.Display"] = None, - origin: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Operation name: {provider}/{resource}/{operation}. - :paramtype name: str - :keyword display: The object that describes the operation. - :paramtype display: ~azure.mgmt.redhatopenshift.v2023_09_04.models.Display - :keyword origin: Sources of requests to this operation. Comma separated list with valid values - user or system, e.g. "user,system". - :paramtype origin: str - """ - super().__init__(**kwargs) - self.name = name - self.display = display - self.origin = origin - - -class OperationList(_serialization.Model): - """OperationList represents an RP operation list. - - :ivar value: List of operations supported by the resource provider. - :vartype value: list[~azure.mgmt.redhatopenshift.v2023_09_04.models.Operation] - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Operation]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: List of operations supported by the resource provider. - :paramtype value: list[~azure.mgmt.redhatopenshift.v2023_09_04.models.Operation] - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class Secret(ProxyResource): - """Secret represents a secret. - - 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.redhatopenshift.v2023_09_04.models.SystemData - :ivar secret_resources: The Secrets Resources. - :vartype secret_resources: str - """ - - _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"}, - "secret_resources": {"key": "properties.secretResources", "type": "str"}, - } - - def __init__(self, *, secret_resources: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword secret_resources: The Secrets Resources. - :paramtype secret_resources: str - """ - super().__init__(**kwargs) - self.secret_resources = secret_resources - - -class SecretList(_serialization.Model): - """SecretList represents a list of Secrets. - - :ivar value: The list of secrets. - :vartype value: list[~azure.mgmt.redhatopenshift.v2023_09_04.models.Secret] - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Secret]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.Secret"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of secrets. - :paramtype value: list[~azure.mgmt.redhatopenshift.v2023_09_04.models.Secret] - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SecretUpdate(_serialization.Model): - """Secret represents a secret. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SystemData - :ivar secret_resources: The Secrets Resources. - :vartype secret_resources: str - """ - - _validation = { - "system_data": {"readonly": True}, - } - - _attribute_map = { - "system_data": {"key": "systemData", "type": "SystemData"}, - "secret_resources": {"key": "properties.secretResources", "type": "str"}, - } - - def __init__(self, *, secret_resources: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword secret_resources: The Secrets Resources. - :paramtype secret_resources: str - """ - super().__init__(**kwargs) - self.system_data = None - self.secret_resources = secret_resources - - -class ServicePrincipalProfile(_serialization.Model): - """ServicePrincipalProfile represents a service principal profile. - - :ivar client_id: The client ID used for the cluster. - :vartype client_id: str - :ivar client_secret: The client secret used for the cluster. - :vartype client_secret: str - """ - - _attribute_map = { - "client_id": {"key": "clientId", "type": "str"}, - "client_secret": {"key": "clientSecret", "type": "str"}, - } - - def __init__(self, *, client_id: Optional[str] = None, client_secret: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword client_id: The client ID used for the cluster. - :paramtype client_id: str - :keyword client_secret: The client secret used for the cluster. - :paramtype client_secret: str - """ - super().__init__(**kwargs) - self.client_id = client_id - self.client_secret = client_secret - - -class SyncIdentityProvider(ProxyResource): - """SyncIdentityProvider represents a SyncIdentityProvider. - - 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.redhatopenshift.v2023_09_04.models.SystemData - :ivar resources: - :vartype resources: str - """ - - _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"}, - "resources": {"key": "properties.resources", "type": "str"}, - } - - def __init__(self, *, resources: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword resources: - :paramtype resources: str - """ - super().__init__(**kwargs) - self.resources = resources - - -class SyncIdentityProviderList(_serialization.Model): - """SyncSetList represents a list of SyncSets. - - :ivar value: The list of sync identity providers. - :vartype value: list[~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncIdentityProvider] - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[SyncIdentityProvider]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.SyncIdentityProvider"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The list of sync identity providers. - :paramtype value: list[~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncIdentityProvider] - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SyncIdentityProviderUpdate(_serialization.Model): - """SyncIdentityProvider represents a SyncIdentityProvider. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SystemData - :ivar resources: - :vartype resources: str - """ - - _validation = { - "system_data": {"readonly": True}, - } - - _attribute_map = { - "system_data": {"key": "systemData", "type": "SystemData"}, - "resources": {"key": "properties.resources", "type": "str"}, - } - - def __init__(self, *, resources: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword resources: - :paramtype resources: str - """ - super().__init__(**kwargs) - self.system_data = None - self.resources = resources - - -class SyncSet(ProxyResource): - """SyncSet represents a SyncSet for an Azure Red Hat OpenShift Cluster. - - 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.redhatopenshift.v2023_09_04.models.SystemData - :ivar resources: Resources represents the SyncSets configuration. - :vartype resources: str - """ - - _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"}, - "resources": {"key": "properties.resources", "type": "str"}, - } - - def __init__(self, *, resources: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword resources: Resources represents the SyncSets configuration. - :paramtype resources: str - """ - super().__init__(**kwargs) - self.resources = resources - - -class SyncSetList(_serialization.Model): - """SyncSetList represents a list of SyncSets. - - :ivar value: The list of syncsets. - :vartype value: list[~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncSet] - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[SyncSet]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.SyncSet"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of syncsets. - :paramtype value: list[~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncSet] - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SyncSetUpdate(_serialization.Model): - """SyncSet represents a SyncSet for an Azure Red Hat OpenShift Cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SystemData - :ivar resources: Resources represents the SyncSets configuration. - :vartype resources: str - """ - - _validation = { - "system_data": {"readonly": True}, - } - - _attribute_map = { - "system_data": {"key": "systemData", "type": "SystemData"}, - "resources": {"key": "properties.resources", "type": "str"}, - } - - def __init__(self, *, resources: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword resources: Resources represents the SyncSets configuration. - :paramtype resources: str - """ - super().__init__(**kwargs) - self.system_data = None - self.resources = resources - - -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.redhatopenshift.v2023_09_04.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.redhatopenshift.v2023_09_04.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.redhatopenshift.v2023_09_04.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.redhatopenshift.v2023_09_04.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 WorkerProfile(_serialization.Model): - """WorkerProfile represents a worker profile. - - :ivar name: The worker profile name. - :vartype name: str - :ivar vm_size: The size of the worker VMs. - :vartype vm_size: str - :ivar disk_size_gb: The disk size of the worker VMs. - :vartype disk_size_gb: int - :ivar subnet_id: The Azure resource ID of the worker subnet. - :vartype subnet_id: str - :ivar count: The number of worker VMs. - :vartype count: int - :ivar encryption_at_host: Whether master virtual machines are encrypted at host. Known values - are: "Disabled" and "Enabled". - :vartype encryption_at_host: str or - ~azure.mgmt.redhatopenshift.v2023_09_04.models.EncryptionAtHost - :ivar disk_encryption_set_id: The resource ID of an associated DiskEncryptionSet, if - applicable. - :vartype disk_encryption_set_id: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "vm_size": {"key": "vmSize", "type": "str"}, - "disk_size_gb": {"key": "diskSizeGB", "type": "int"}, - "subnet_id": {"key": "subnetId", "type": "str"}, - "count": {"key": "count", "type": "int"}, - "encryption_at_host": {"key": "encryptionAtHost", "type": "str"}, - "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - vm_size: Optional[str] = None, - disk_size_gb: Optional[int] = None, - subnet_id: Optional[str] = None, - count: Optional[int] = None, - encryption_at_host: Optional[Union[str, "_models.EncryptionAtHost"]] = None, - disk_encryption_set_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The worker profile name. - :paramtype name: str - :keyword vm_size: The size of the worker VMs. - :paramtype vm_size: str - :keyword disk_size_gb: The disk size of the worker VMs. - :paramtype disk_size_gb: int - :keyword subnet_id: The Azure resource ID of the worker subnet. - :paramtype subnet_id: str - :keyword count: The number of worker VMs. - :paramtype count: int - :keyword encryption_at_host: Whether master virtual machines are encrypted at host. Known - values are: "Disabled" and "Enabled". - :paramtype encryption_at_host: str or - ~azure.mgmt.redhatopenshift.v2023_09_04.models.EncryptionAtHost - :keyword disk_encryption_set_id: The resource ID of an associated DiskEncryptionSet, if - applicable. - :paramtype disk_encryption_set_id: str - """ - super().__init__(**kwargs) - self.name = name - self.vm_size = vm_size - self.disk_size_gb = disk_size_gb - self.subnet_id = subnet_id - self.count = count - self.encryption_at_host = encryption_at_host - self.disk_encryption_set_id = disk_encryption_set_id diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/models/_patch.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/operations/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/operations/__init__.py deleted file mode 100644 index f03257fe6903..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/operations/__init__.py +++ /dev/null @@ -1,31 +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 ._open_shift_versions_operations import OpenShiftVersionsOperations -from ._open_shift_clusters_operations import OpenShiftClustersOperations -from ._machine_pools_operations import MachinePoolsOperations -from ._secrets_operations import SecretsOperations -from ._sync_identity_providers_operations import SyncIdentityProvidersOperations -from ._sync_sets_operations import SyncSetsOperations - -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", - "OpenShiftVersionsOperations", - "OpenShiftClustersOperations", - "MachinePoolsOperations", - "SecretsOperations", - "SyncIdentityProvidersOperations", - "SyncSetsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/operations/_machine_pools_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/operations/_machine_pools_operations.py deleted file mode 100644 index 08a80e882e95..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/operations/_machine_pools_operations.py +++ /dev/null @@ -1,802 +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, Optional, Type, TypeVar, Union, overload -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( - resource_group_name: str, resource_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-09-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/machinePools", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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, resource_name: str, child_resource_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-09-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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, resource_name: str, child_resource_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-09-04")) - 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.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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 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, resource_name: str, child_resource_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-09-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, resource_name: str, child_resource_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-09-04")) - 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.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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 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) - - -class MachinePoolsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2023_09_04.AzureRedHatOpenShiftClient`'s - :attr:`machine_pools` 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, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.MachinePool"]: - """Lists MachinePools that belong to that Azure Red Hat OpenShift Cluster. - - The operation returns properties of each MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: An iterator like instance of either MachinePool or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2023_09_04.models.MachinePool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-04")) - cls: ClsType[_models.MachinePoolList] = 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( - resource_group_name=resource_group_name, - resource_name=resource_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("MachinePoolList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> _models.MachinePool: - """Gets a MachinePool with the specified subscription, resource group and resource name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.MachinePool - :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-09-04")) - cls: ClsType[_models.MachinePool] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MachinePool", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.MachinePool, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MachinePool: - """Creates or updates a MachinePool with the specified subscription, resource group and resource - name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :param parameters: The MachinePool resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.MachinePool - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.MachinePool - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MachinePool: - """Creates or updates a MachinePool with the specified subscription, resource group and resource - name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :param parameters: The MachinePool resource. Required. - :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: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.MachinePool - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.MachinePool, IO[bytes]], - **kwargs: Any - ) -> _models.MachinePool: - """Creates or updates a MachinePool with the specified subscription, resource group and resource - name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :param parameters: The MachinePool resource. Is either a MachinePool type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.MachinePool or IO[bytes] - :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.MachinePool - :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-09-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MachinePool] = 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, "MachinePool") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("MachinePool", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("MachinePool", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> None: - """Deletes a MachinePool with the specified subscription, resource group and resource name. - - The operation returns nothing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :return: None or the result of cls(response) - :rtype: None - :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-09-04")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.MachinePoolUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MachinePool: - """Updates a MachinePool with the specified subscription, resource group and resource name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :param parameters: The MachinePool resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.MachinePoolUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.MachinePool - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MachinePool: - """Updates a MachinePool with the specified subscription, resource group and resource name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :param parameters: The MachinePool resource. Required. - :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: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.MachinePool - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.MachinePoolUpdate, IO[bytes]], - **kwargs: Any - ) -> _models.MachinePool: - """Updates a MachinePool with the specified subscription, resource group and resource name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :param parameters: The MachinePool resource. Is either a MachinePoolUpdate type or a IO[bytes] - type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.MachinePoolUpdate or IO[bytes] - :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.MachinePool - :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-09-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MachinePool] = 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, "MachinePoolUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MachinePool", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/operations/_open_shift_clusters_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/operations/_open_shift_clusters_operations.py deleted file mode 100644 index 89e54f49709d..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/operations/_open_shift_clusters_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, - 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_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-09-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.RedHatOpenShift/openShiftClusters" - ) # pylint: disable=line-too-long - 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-09-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("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, resource_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-09-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _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, resource_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-09-04")) - 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.RedHatOpenShift/openShiftClusters/{resourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, resource_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-09-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, resource_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-09-04")) - 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.RedHatOpenShift/openShiftClusters/{resourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_admin_credentials_request( - resource_group_name: str, resource_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-09-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}/listAdminCredentials", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _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) - - -def build_list_credentials_request( - resource_group_name: str, resource_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-09-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}/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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _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 OpenShiftClustersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2023_09_04.AzureRedHatOpenShiftClient`'s - :attr:`open_shift_clusters` 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.OpenShiftCluster"]: - """Lists OpenShift clusters in the specified subscription. - - The operation returns properties of each OpenShift cluster. - - :return: An iterator like instance of either OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2023_09_04.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-04")) - cls: ClsType[_models.OpenShiftClusterList] = 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("OpenShiftClusterList", 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) - raise HttpResponseError(response=response, 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.OpenShiftCluster"]: - """Lists OpenShift clusters in the specified subscription and resource group. - - The operation returns properties of each OpenShift cluster. - - :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 OpenShiftCluster or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2023_09_04.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-04")) - cls: ClsType[_models.OpenShiftClusterList] = 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("OpenShiftClusterList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.OpenShiftCluster: - """Gets a OpenShift cluster with the specified subscription, resource group and resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: OpenShiftCluster or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.OpenShiftCluster - :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-09-04")) - cls: ClsType[_models.OpenShiftCluster] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenShiftCluster", 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, - resource_name: str, - parameters: Union[_models.OpenShiftCluster, IO[bytes]], - **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-09-04")) - 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, "OpenShiftCluster") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - 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 = 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]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.OpenShiftCluster, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.OpenShiftCluster - :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 OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2023_09_04.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :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: An instance of LROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2023_09_04.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - parameters: Union[_models.OpenShiftCluster, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.OpenShiftCluster]: - """Creates or updates a OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a OpenShiftCluster type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.OpenShiftCluster or IO[bytes] - :return: An instance of LROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2023_09_04.models.OpenShiftCluster] - :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-09-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OpenShiftCluster] = 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, - resource_name=resource_name, - parameters=parameters, - 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("OpenShiftCluster", 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.OpenShiftCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OpenShiftCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, resource_name: str, **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-09-04")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes a OpenShift cluster with the specified subscription, resource group and resource name. - - The operation returns nothing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: 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-09-04")) - 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, - resource_name=resource_name, - 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, **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 _update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: Union[_models.OpenShiftClusterUpdate, IO[bytes]], - **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-09-04")) - 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, "OpenShiftClusterUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - 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 = 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]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.OpenShiftClusterUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OpenShiftCluster]: - """Updates a OpenShift cluster with the specified subscription, resource group and resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.OpenShiftClusterUpdate - :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 OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2023_09_04.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OpenShiftCluster]: - """Updates a OpenShift cluster with the specified subscription, resource group and resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Required. - :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: An instance of LROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2023_09_04.models.OpenShiftCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - resource_name: str, - parameters: Union[_models.OpenShiftClusterUpdate, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.OpenShiftCluster]: - """Updates a OpenShift cluster with the specified subscription, resource group and resource name. - - The operation returns properties of a OpenShift cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param parameters: The OpenShift cluster resource. Is either a OpenShiftClusterUpdate type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.OpenShiftClusterUpdate or - IO[bytes] - :return: An instance of LROPoller that returns either OpenShiftCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2023_09_04.models.OpenShiftCluster] - :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-09-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OpenShiftCluster] = 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, - resource_name=resource_name, - parameters=parameters, - 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("OpenShiftCluster", 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.OpenShiftCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OpenShiftCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_admin_credentials( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.OpenShiftClusterAdminKubeconfig: - """Lists admin kubeconfig of an OpenShift cluster with the specified subscription, resource group - and resource name. - - The operation returns the admin kubeconfig. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: OpenShiftClusterAdminKubeconfig or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.OpenShiftClusterAdminKubeconfig - :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-09-04")) - cls: ClsType[_models.OpenShiftClusterAdminKubeconfig] = kwargs.pop("cls", None) - - _request = build_list_admin_credentials_request( - resource_group_name=resource_group_name, - resource_name=resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenShiftClusterAdminKubeconfig", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_credentials( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.OpenShiftClusterCredentials: - """Lists credentials of an OpenShift cluster with the specified subscription, resource group and - resource name. - - The operation returns the credentials. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: OpenShiftClusterCredentials or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.OpenShiftClusterCredentials - :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-09-04")) - cls: ClsType[_models.OpenShiftClusterCredentials] = kwargs.pop("cls", None) - - _request = build_list_credentials_request( - resource_group_name=resource_group_name, - resource_name=resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OpenShiftClusterCredentials", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/operations/_open_shift_versions_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/operations/_open_shift_versions_operations.py deleted file mode 100644 index fe5ed8f65f1d..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/operations/_open_shift_versions_operations.py +++ /dev/null @@ -1,168 +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(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.RedHatOpenShift/locations/{location}/openshiftversions", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "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) - - -class OpenShiftVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2023_09_04.AzureRedHatOpenShiftClient`'s - :attr:`open_shift_versions` 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, location: str, **kwargs: Any) -> Iterable["_models.OpenShiftVersion"]: - """Lists all OpenShift versions available to install in the specified location. - - The operation returns the installable OpenShift versions as strings. - - :param location: The name of Azure region. Required. - :type location: str - :return: An iterator like instance of either OpenShiftVersion or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2023_09_04.models.OpenShiftVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-04")) - cls: ClsType[_models.OpenShiftVersionList] = 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( - location=location, - 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("OpenShiftVersionList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/operations/_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/operations/_operations.py deleted file mode 100644 index cab864745158..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/operations/_operations.py +++ /dev/null @@ -1,154 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.RedHatOpenShift/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.redhatopenshift.v2023_09_04.AzureRedHatOpenShiftClient`'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"]: - """Lists all of the available RP operations. - - The operation returns the RP operations. - - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2023_09_04.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-09-04")) - cls: ClsType[_models.OperationList] = 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("OperationList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/operations/_patch.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/operations/_secrets_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/operations/_secrets_operations.py deleted file mode 100644 index 01d59aca4fdb..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/operations/_secrets_operations.py +++ /dev/null @@ -1,797 +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, Optional, Type, TypeVar, Union, overload -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( - resource_group_name: str, resource_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-09-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/secrets", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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, resource_name: str, child_resource_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-09-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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, resource_name: str, child_resource_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-09-04")) - 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.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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 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, resource_name: str, child_resource_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-09-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, resource_name: str, child_resource_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-09-04")) - 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.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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 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) - - -class SecretsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2023_09_04.AzureRedHatOpenShiftClient`'s - :attr:`secrets` 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, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.Secret"]: - """Lists Secrets that belong to that Azure Red Hat OpenShift Cluster. - - The operation returns properties of each Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: An iterator like instance of either Secret or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2023_09_04.models.Secret] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-04")) - cls: ClsType[_models.SecretList] = 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( - resource_group_name=resource_group_name, - resource_name=resource_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("SecretList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> _models.Secret: - """Gets a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.Secret - :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-09-04")) - cls: ClsType[_models.Secret] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Secret", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.Secret, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Secret: - """Creates or updates a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :param parameters: The Secret resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.Secret - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Secret: - """Creates or updates a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :param parameters: The Secret resource. Required. - :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: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.Secret, IO[bytes]], - **kwargs: Any - ) -> _models.Secret: - """Creates or updates a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :param parameters: The Secret resource. Is either a Secret type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.Secret or IO[bytes] - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.Secret - :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-09-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Secret] = 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, "Secret") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("Secret", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Secret", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> None: - """Deletes a Secret with the specified subscription, resource group and resource name. - - The operation returns nothing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :return: None or the result of cls(response) - :rtype: None - :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-09-04")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.SecretUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Secret: - """Updates a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :param parameters: The Secret resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SecretUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Secret: - """Updates a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :param parameters: The Secret resource. Required. - :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: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.SecretUpdate, IO[bytes]], - **kwargs: Any - ) -> _models.Secret: - """Updates a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :param parameters: The Secret resource. Is either a SecretUpdate type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SecretUpdate or IO[bytes] - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.Secret - :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-09-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Secret] = 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, "SecretUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Secret", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/operations/_sync_identity_providers_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/operations/_sync_identity_providers_operations.py deleted file mode 100644 index 86275ffb7a19..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/operations/_sync_identity_providers_operations.py +++ /dev/null @@ -1,811 +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, Optional, Type, TypeVar, Union, overload -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( - resource_group_name: str, resource_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-09-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/syncIdentityProviders", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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, resource_name: str, child_resource_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-09-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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, resource_name: str, child_resource_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-09-04")) - 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.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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 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, resource_name: str, child_resource_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-09-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, resource_name: str, child_resource_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-09-04")) - 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.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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 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) - - -class SyncIdentityProvidersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2023_09_04.AzureRedHatOpenShiftClient`'s - :attr:`sync_identity_providers` 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, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.SyncIdentityProvider"]: - """Lists SyncIdentityProviders that belong to that Azure Red Hat OpenShift Cluster. - - The operation returns properties of each SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: An iterator like instance of either SyncIdentityProvider or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncIdentityProvider] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-04")) - cls: ClsType[_models.SyncIdentityProviderList] = 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( - resource_group_name=resource_group_name, - resource_name=resource_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("SyncIdentityProviderList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Gets a SyncIdentityProvider with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncIdentityProvider - :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-09-04")) - cls: ClsType[_models.SyncIdentityProvider] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SyncIdentityProvider", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.SyncIdentityProvider, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Creates or updates a SyncIdentityProvider with the specified subscription, resource group and - resource name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncIdentityProvider - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncIdentityProvider - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Creates or updates a SyncIdentityProvider with the specified subscription, resource group and - resource name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Required. - :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: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncIdentityProvider - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.SyncIdentityProvider, IO[bytes]], - **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Creates or updates a SyncIdentityProvider with the specified subscription, resource group and - resource name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Is either a SyncIdentityProvider type or - a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncIdentityProvider or - IO[bytes] - :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncIdentityProvider - :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-09-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SyncIdentityProvider] = 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, "SyncIdentityProvider") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("SyncIdentityProvider", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SyncIdentityProvider", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> None: - """Deletes a SyncIdentityProvider with the specified subscription, resource group and resource - name. - - The operation returns nothing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :return: None or the result of cls(response) - :rtype: None - :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-09-04")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.SyncIdentityProviderUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Updates a SyncIdentityProvider with the specified subscription, resource group and resource - name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncIdentityProviderUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncIdentityProvider - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Updates a SyncIdentityProvider with the specified subscription, resource group and resource - name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Required. - :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: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncIdentityProvider - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.SyncIdentityProviderUpdate, IO[bytes]], - **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Updates a SyncIdentityProvider with the specified subscription, resource group and resource - name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Is either a SyncIdentityProviderUpdate - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncIdentityProviderUpdate or - IO[bytes] - :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncIdentityProvider - :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-09-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SyncIdentityProvider] = 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, "SyncIdentityProviderUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SyncIdentityProvider", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/operations/_sync_sets_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/operations/_sync_sets_operations.py deleted file mode 100644 index 50c9ea8f6202..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/operations/_sync_sets_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, Optional, Type, TypeVar, Union, overload -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( - resource_group_name: str, resource_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-09-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/syncSets", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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, resource_name: str, child_resource_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-09-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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, resource_name: str, child_resource_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-09-04")) - 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.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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 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, resource_name: str, child_resource_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-09-04")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, resource_name: str, child_resource_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-09-04")) - 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.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$", - ), - "childResourceName": _SERIALIZER.url( - "child_resource_name", - child_resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-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 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) - - -class SyncSetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2023_09_04.AzureRedHatOpenShiftClient`'s - :attr:`sync_sets` 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, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.SyncSet"]: - """Lists SyncSets that belong to that Azure Red Hat OpenShift Cluster. - - The operation returns properties of each SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: An iterator like instance of either SyncSet or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-04")) - cls: ClsType[_models.SyncSetList] = 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( - resource_group_name=resource_group_name, - resource_name=resource_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("SyncSetList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> _models.SyncSet: - """Gets a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncSet - :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-09-04")) - cls: ClsType[_models.SyncSet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SyncSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.SyncSet, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncSet: - """Creates or updates a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :param parameters: The SyncSet resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncSet - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncSet: - """Creates or updates a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :param parameters: The SyncSet resource. Required. - :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: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.SyncSet, IO[bytes]], - **kwargs: Any - ) -> _models.SyncSet: - """Creates or updates a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :param parameters: The SyncSet resource. Is either a SyncSet type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncSet or IO[bytes] - :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncSet - :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-09-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SyncSet] = 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, "SyncSet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("SyncSet", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SyncSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> None: - """Deletes a SyncSet with the specified subscription, resource group and resource name. - - The operation returns nothing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :return: None or the result of cls(response) - :rtype: None - :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-09-04")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.SyncSetUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncSet: - """Updates a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :param parameters: The SyncSet resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncSetUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncSet: - """Updates a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :param parameters: The SyncSet resource. Required. - :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: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.SyncSetUpdate, IO[bytes]], - **kwargs: Any - ) -> _models.SyncSet: - """Updates a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :param parameters: The SyncSet resource. Is either a SyncSetUpdate type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncSetUpdate or IO[bytes] - :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_09_04.models.SyncSet - :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-09-04")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SyncSet] = 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, "SyncSetUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SyncSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/py.typed b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_09_04/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/__init__.py deleted file mode 100644 index c64163c98d3d..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/__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 ._azure_red_hat_open_shift_client import AzureRedHatOpenShiftClient -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__ = [ - "AzureRedHatOpenShiftClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/_azure_red_hat_open_shift_client.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/_azure_red_hat_open_shift_client.py deleted file mode 100644 index 1da85bd4d0ce..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/_azure_red_hat_open_shift_client.py +++ /dev/null @@ -1,152 +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 AzureRedHatOpenShiftClientConfiguration -from .operations import ( - MachinePoolsOperations, - OpenShiftClustersOperations, - OpenShiftVersionsOperations, - Operations, - SecretsOperations, - SyncIdentityProvidersOperations, - SyncSetsOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class AzureRedHatOpenShiftClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """Rest API for Azure Red Hat OpenShift 4. - - :ivar operations: Operations operations - :vartype operations: azure.mgmt.redhatopenshift.v2023_11_22.operations.Operations - :ivar open_shift_versions: OpenShiftVersionsOperations operations - :vartype open_shift_versions: - azure.mgmt.redhatopenshift.v2023_11_22.operations.OpenShiftVersionsOperations - :ivar open_shift_clusters: OpenShiftClustersOperations operations - :vartype open_shift_clusters: - azure.mgmt.redhatopenshift.v2023_11_22.operations.OpenShiftClustersOperations - :ivar machine_pools: MachinePoolsOperations operations - :vartype machine_pools: - azure.mgmt.redhatopenshift.v2023_11_22.operations.MachinePoolsOperations - :ivar secrets: SecretsOperations operations - :vartype secrets: azure.mgmt.redhatopenshift.v2023_11_22.operations.SecretsOperations - :ivar sync_identity_providers: SyncIdentityProvidersOperations operations - :vartype sync_identity_providers: - azure.mgmt.redhatopenshift.v2023_11_22.operations.SyncIdentityProvidersOperations - :ivar sync_sets: SyncSetsOperations operations - :vartype sync_sets: azure.mgmt.redhatopenshift.v2023_11_22.operations.SyncSetsOperations - :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-11-22". 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 = AzureRedHatOpenShiftClientConfiguration( - 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-11-22") - self.open_shift_versions = OpenShiftVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-22" - ) - self.open_shift_clusters = OpenShiftClustersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-22" - ) - self.machine_pools = MachinePoolsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-22" - ) - self.secrets = SecretsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-11-22") - self.sync_identity_providers = SyncIdentityProvidersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-22" - ) - self.sync_sets = SyncSetsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-22" - ) - - 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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/_configuration.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/_configuration.py deleted file mode 100644 index db318d6f55d8..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/_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 AzureRedHatOpenShiftClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for AzureRedHatOpenShiftClient. - - 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-11-22". 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-11-22") - - 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-redhatopenshift/{}".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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/_metadata.json b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/_metadata.json deleted file mode 100644 index a5d0091c25bc..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/_metadata.json +++ /dev/null @@ -1,116 +0,0 @@ -{ - "chosen_version": "2023-11-22", - "total_api_version_list": ["2023-11-22"], - "client": { - "name": "AzureRedHatOpenShiftClient", - "filename": "_azure_red_hat_open_shift_client", - "description": "Rest API for Azure Red Hat OpenShift 4.", - "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\": [\"AzureRedHatOpenShiftClientConfiguration\"], \".._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\": [\"AzureRedHatOpenShiftClientConfiguration\"], \"..._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", - "open_shift_versions": "OpenShiftVersionsOperations", - "open_shift_clusters": "OpenShiftClustersOperations", - "machine_pools": "MachinePoolsOperations", - "secrets": "SecretsOperations", - "sync_identity_providers": "SyncIdentityProvidersOperations", - "sync_sets": "SyncSetsOperations" - } -} diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/_patch.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/_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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/_version.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/_version.py deleted file mode 100644 index b2efd13ce94d..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/_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 = "1.5.0" diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/aio/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/aio/__init__.py deleted file mode 100644 index b06f0016da77..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/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 ._azure_red_hat_open_shift_client import AzureRedHatOpenShiftClient - -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__ = [ - "AzureRedHatOpenShiftClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/aio/_azure_red_hat_open_shift_client.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/aio/_azure_red_hat_open_shift_client.py deleted file mode 100644 index 571c513524df..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/aio/_azure_red_hat_open_shift_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 AzureRedHatOpenShiftClientConfiguration -from .operations import ( - MachinePoolsOperations, - OpenShiftClustersOperations, - OpenShiftVersionsOperations, - Operations, - SecretsOperations, - SyncIdentityProvidersOperations, - SyncSetsOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class AzureRedHatOpenShiftClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """Rest API for Azure Red Hat OpenShift 4. - - :ivar operations: Operations operations - :vartype operations: azure.mgmt.redhatopenshift.v2023_11_22.aio.operations.Operations - :ivar open_shift_versions: OpenShiftVersionsOperations operations - :vartype open_shift_versions: - azure.mgmt.redhatopenshift.v2023_11_22.aio.operations.OpenShiftVersionsOperations - :ivar open_shift_clusters: OpenShiftClustersOperations operations - :vartype open_shift_clusters: - azure.mgmt.redhatopenshift.v2023_11_22.aio.operations.OpenShiftClustersOperations - :ivar machine_pools: MachinePoolsOperations operations - :vartype machine_pools: - azure.mgmt.redhatopenshift.v2023_11_22.aio.operations.MachinePoolsOperations - :ivar secrets: SecretsOperations operations - :vartype secrets: azure.mgmt.redhatopenshift.v2023_11_22.aio.operations.SecretsOperations - :ivar sync_identity_providers: SyncIdentityProvidersOperations operations - :vartype sync_identity_providers: - azure.mgmt.redhatopenshift.v2023_11_22.aio.operations.SyncIdentityProvidersOperations - :ivar sync_sets: SyncSetsOperations operations - :vartype sync_sets: azure.mgmt.redhatopenshift.v2023_11_22.aio.operations.SyncSetsOperations - :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-11-22". 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 = AzureRedHatOpenShiftClientConfiguration( - 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-11-22") - self.open_shift_versions = OpenShiftVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-22" - ) - self.open_shift_clusters = OpenShiftClustersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-22" - ) - self.machine_pools = MachinePoolsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-22" - ) - self.secrets = SecretsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-11-22") - self.sync_identity_providers = SyncIdentityProvidersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-22" - ) - self.sync_sets = SyncSetsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-22" - ) - - 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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/aio/_configuration.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/aio/_configuration.py deleted file mode 100644 index f3376438bb0e..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/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 AzureRedHatOpenShiftClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for AzureRedHatOpenShiftClient. - - 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-11-22". 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-11-22") - - 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-redhatopenshift/{}".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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/aio/_patch.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/aio/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/aio/operations/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/aio/operations/__init__.py deleted file mode 100644 index f03257fe6903..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/aio/operations/__init__.py +++ /dev/null @@ -1,31 +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 ._open_shift_versions_operations import OpenShiftVersionsOperations -from ._open_shift_clusters_operations import OpenShiftClustersOperations -from ._machine_pools_operations import MachinePoolsOperations -from ._secrets_operations import SecretsOperations -from ._sync_identity_providers_operations import SyncIdentityProvidersOperations -from ._sync_sets_operations import SyncSetsOperations - -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", - "OpenShiftVersionsOperations", - "OpenShiftClustersOperations", - "MachinePoolsOperations", - "SecretsOperations", - "SyncIdentityProvidersOperations", - "SyncSetsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/aio/operations/_machine_pools_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/aio/operations/_machine_pools_operations.py deleted file mode 100644 index 627db4a70693..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/aio/operations/_machine_pools_operations.py +++ /dev/null @@ -1,568 +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, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload -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.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._machine_pools_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_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 MachinePoolsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2023_11_22.aio.AzureRedHatOpenShiftClient`'s - :attr:`machine_pools` 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, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.MachinePool"]: - """Lists MachinePools that belong to that Azure Red Hat OpenShift Cluster. - - The operation returns properties of each MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: An iterator like instance of either MachinePool or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2023_11_22.models.MachinePool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-11-22")) - cls: ClsType[_models.MachinePoolList] = 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( - resource_group_name=resource_group_name, - resource_name=resource_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("MachinePoolList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> _models.MachinePool: - """Gets a MachinePool with the specified subscription, resource group and resource name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MachinePool - :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-11-22")) - cls: ClsType[_models.MachinePool] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MachinePool", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.MachinePool, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MachinePool: - """Creates or updates a MachinePool with the specified subscription, resource group and resource - name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :param parameters: The MachinePool resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MachinePool - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MachinePool - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MachinePool: - """Creates or updates a MachinePool with the specified subscription, resource group and resource - name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :param parameters: The MachinePool resource. Required. - :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: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MachinePool - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.MachinePool, IO[bytes]], - **kwargs: Any - ) -> _models.MachinePool: - """Creates or updates a MachinePool with the specified subscription, resource group and resource - name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :param parameters: The MachinePool resource. Is either a MachinePool type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MachinePool or IO[bytes] - :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MachinePool - :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-11-22")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MachinePool] = 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, "MachinePool") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("MachinePool", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("MachinePool", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> None: - """Deletes a MachinePool with the specified subscription, resource group and resource name. - - The operation returns nothing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :return: None or the result of cls(response) - :rtype: None - :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-11-22")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.MachinePoolUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MachinePool: - """Updates a MachinePool with the specified subscription, resource group and resource name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :param parameters: The MachinePool resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MachinePoolUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MachinePool - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MachinePool: - """Updates a MachinePool with the specified subscription, resource group and resource name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :param parameters: The MachinePool resource. Required. - :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: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MachinePool - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.MachinePoolUpdate, IO[bytes]], - **kwargs: Any - ) -> _models.MachinePool: - """Updates a MachinePool with the specified subscription, resource group and resource name. - - The operation returns properties of a MachinePool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the MachinePool resource. Required. - :type child_resource_name: str - :param parameters: The MachinePool resource. Is either a MachinePoolUpdate type or a IO[bytes] - type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MachinePoolUpdate or IO[bytes] - :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MachinePool - :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-11-22")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MachinePool] = 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, "MachinePoolUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MachinePool", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/aio/operations/_open_shift_versions_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/aio/operations/_open_shift_versions_operations.py deleted file mode 100644 index fe485196a242..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/aio/operations/_open_shift_versions_operations.py +++ /dev/null @@ -1,137 +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._open_shift_versions_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 OpenShiftVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2023_11_22.aio.AzureRedHatOpenShiftClient`'s - :attr:`open_shift_versions` 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, location: str, **kwargs: Any) -> AsyncIterable["_models.OpenShiftVersion"]: - """Lists all OpenShift versions available to install in the specified location. - - The operation returns the installable OpenShift versions as strings. - - :param location: The name of Azure region. Required. - :type location: str - :return: An iterator like instance of either OpenShiftVersion or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-11-22")) - cls: ClsType[_models.OpenShiftVersionList] = 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( - location=location, - 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("OpenShiftVersionList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/aio/operations/_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/aio/operations/_operations.py deleted file mode 100644 index 6cf94120ccba..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/aio/operations/_operations.py +++ /dev/null @@ -1,133 +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.redhatopenshift.v2023_11_22.aio.AzureRedHatOpenShiftClient`'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"]: - """Lists all of the available RP operations. - - The operation returns the RP operations. - - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2023_11_22.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-11-22")) - cls: ClsType[_models.OperationList] = 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("OperationList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/aio/operations/_patch.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/aio/operations/_secrets_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/aio/operations/_secrets_operations.py deleted file mode 100644 index 3eca1c8d67a6..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/aio/operations/_secrets_operations.py +++ /dev/null @@ -1,564 +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, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload -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.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._secrets_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_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 SecretsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2023_11_22.aio.AzureRedHatOpenShiftClient`'s - :attr:`secrets` 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, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.Secret"]: - """Lists Secrets that belong to that Azure Red Hat OpenShift Cluster. - - The operation returns properties of each Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: An iterator like instance of either Secret or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2023_11_22.models.Secret] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-11-22")) - cls: ClsType[_models.SecretList] = 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( - resource_group_name=resource_group_name, - resource_name=resource_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("SecretList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> _models.Secret: - """Gets a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.Secret - :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-11-22")) - cls: ClsType[_models.Secret] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Secret", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.Secret, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Secret: - """Creates or updates a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :param parameters: The Secret resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.Secret - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Secret: - """Creates or updates a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :param parameters: The Secret resource. Required. - :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: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.Secret, IO[bytes]], - **kwargs: Any - ) -> _models.Secret: - """Creates or updates a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :param parameters: The Secret resource. Is either a Secret type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.Secret or IO[bytes] - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.Secret - :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-11-22")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Secret] = 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, "Secret") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("Secret", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Secret", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> None: - """Deletes a Secret with the specified subscription, resource group and resource name. - - The operation returns nothing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :return: None or the result of cls(response) - :rtype: None - :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-11-22")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.SecretUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Secret: - """Updates a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :param parameters: The Secret resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SecretUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Secret: - """Updates a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :param parameters: The Secret resource. Required. - :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: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.SecretUpdate, IO[bytes]], - **kwargs: Any - ) -> _models.Secret: - """Updates a Secret with the specified subscription, resource group and resource name. - - The operation returns properties of a Secret. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the Secret resource. Required. - :type child_resource_name: str - :param parameters: The Secret resource. Is either a SecretUpdate type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SecretUpdate or IO[bytes] - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.Secret - :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-11-22")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Secret] = 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, "SecretUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Secret", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/aio/operations/_sync_identity_providers_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/aio/operations/_sync_identity_providers_operations.py deleted file mode 100644 index eecca584c7e2..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/aio/operations/_sync_identity_providers_operations.py +++ /dev/null @@ -1,577 +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, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload -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.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._sync_identity_providers_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_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 SyncIdentityProvidersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2023_11_22.aio.AzureRedHatOpenShiftClient`'s - :attr:`sync_identity_providers` 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, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SyncIdentityProvider"]: - """Lists SyncIdentityProviders that belong to that Azure Red Hat OpenShift Cluster. - - The operation returns properties of each SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: An iterator like instance of either SyncIdentityProvider or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncIdentityProvider] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-11-22")) - cls: ClsType[_models.SyncIdentityProviderList] = 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( - resource_group_name=resource_group_name, - resource_name=resource_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("SyncIdentityProviderList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Gets a SyncIdentityProvider with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncIdentityProvider - :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-11-22")) - cls: ClsType[_models.SyncIdentityProvider] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SyncIdentityProvider", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.SyncIdentityProvider, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Creates or updates a SyncIdentityProvider with the specified subscription, resource group and - resource name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncIdentityProvider - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncIdentityProvider - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Creates or updates a SyncIdentityProvider with the specified subscription, resource group and - resource name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Required. - :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: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncIdentityProvider - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.SyncIdentityProvider, IO[bytes]], - **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Creates or updates a SyncIdentityProvider with the specified subscription, resource group and - resource name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Is either a SyncIdentityProvider type or - a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncIdentityProvider or - IO[bytes] - :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncIdentityProvider - :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-11-22")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SyncIdentityProvider] = 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, "SyncIdentityProvider") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("SyncIdentityProvider", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SyncIdentityProvider", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> None: - """Deletes a SyncIdentityProvider with the specified subscription, resource group and resource - name. - - The operation returns nothing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :return: None or the result of cls(response) - :rtype: None - :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-11-22")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.SyncIdentityProviderUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Updates a SyncIdentityProvider with the specified subscription, resource group and resource - name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncIdentityProviderUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncIdentityProvider - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Updates a SyncIdentityProvider with the specified subscription, resource group and resource - name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Required. - :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: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncIdentityProvider - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.SyncIdentityProviderUpdate, IO[bytes]], - **kwargs: Any - ) -> _models.SyncIdentityProvider: - """Updates a SyncIdentityProvider with the specified subscription, resource group and resource - name. - - The operation returns properties of a SyncIdentityProvider. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncIdentityProvider resource. Required. - :type child_resource_name: str - :param parameters: The SyncIdentityProvider resource. Is either a SyncIdentityProviderUpdate - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncIdentityProviderUpdate or - IO[bytes] - :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncIdentityProvider - :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-11-22")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SyncIdentityProvider] = 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, "SyncIdentityProviderUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SyncIdentityProvider", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/aio/operations/_sync_sets_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/aio/operations/_sync_sets_operations.py deleted file mode 100644 index 2febf99445ed..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/aio/operations/_sync_sets_operations.py +++ /dev/null @@ -1,565 +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, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload -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.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._sync_sets_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_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 SyncSetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redhatopenshift.v2023_11_22.aio.AzureRedHatOpenShiftClient`'s - :attr:`sync_sets` 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, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.SyncSet"]: - """Lists SyncSets that belong to that Azure Red Hat OpenShift Cluster. - - The operation returns properties of each SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :return: An iterator like instance of either SyncSet or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-11-22")) - cls: ClsType[_models.SyncSetList] = 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( - resource_group_name=resource_group_name, - resource_name=resource_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("SyncSetList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> _models.SyncSet: - """Gets a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncSet - :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-11-22")) - cls: ClsType[_models.SyncSet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SyncSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.SyncSet, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncSet: - """Creates or updates a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :param parameters: The SyncSet resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncSet - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncSet: - """Creates or updates a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :param parameters: The SyncSet resource. Required. - :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: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.SyncSet, IO[bytes]], - **kwargs: Any - ) -> _models.SyncSet: - """Creates or updates a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :param parameters: The SyncSet resource. Is either a SyncSet type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncSet or IO[bytes] - :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncSet - :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-11-22")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SyncSet] = 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, "SyncSet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("SyncSet", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SyncSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, child_resource_name: str, **kwargs: Any - ) -> None: - """Deletes a SyncSet with the specified subscription, resource group and resource name. - - The operation returns nothing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :return: None or the result of cls(response) - :rtype: None - :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-11-22")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_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, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: _models.SyncSetUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncSet: - """Updates a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :param parameters: The SyncSet resource. Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncSetUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncSet: - """Updates a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :param parameters: The SyncSet resource. Required. - :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: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - resource_name: str, - child_resource_name: str, - parameters: Union[_models.SyncSetUpdate, IO[bytes]], - **kwargs: Any - ) -> _models.SyncSet: - """Updates a SyncSet with the specified subscription, resource group and resource name. - - The operation returns properties of a SyncSet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the OpenShift cluster resource. Required. - :type resource_name: str - :param child_resource_name: The name of the SyncSet resource. Required. - :type child_resource_name: str - :param parameters: The SyncSet resource. Is either a SyncSetUpdate type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncSetUpdate or IO[bytes] - :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncSet - :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-11-22")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SyncSet] = 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, "SyncSetUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - child_resource_name=child_resource_name, - subscription_id=self._config.subscription_id, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SyncSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/models/_patch.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/operations/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/operations/__init__.py deleted file mode 100644 index f03257fe6903..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/operations/__init__.py +++ /dev/null @@ -1,31 +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 ._open_shift_versions_operations import OpenShiftVersionsOperations -from ._open_shift_clusters_operations import OpenShiftClustersOperations -from ._machine_pools_operations import MachinePoolsOperations -from ._secrets_operations import SecretsOperations -from ._sync_identity_providers_operations import SyncIdentityProvidersOperations -from ._sync_sets_operations import SyncSetsOperations - -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", - "OpenShiftVersionsOperations", - "OpenShiftClustersOperations", - "MachinePoolsOperations", - "SecretsOperations", - "SyncIdentityProvidersOperations", - "SyncSetsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/operations/_patch.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/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/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/py.typed b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/v2023_11_22/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/machine_pools_create_or_update.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/machine_pools_create_or_update.py index 890d7837b837..b1c40785811f 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/machine_pools_create_or_update.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/machine_pools_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/machine_pools_update.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/machine_pools_update.py index 817417e5be3d..b69db1b1a64b 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/machine_pools_update.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/machine_pools_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_create_or_update.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_create_or_update.py index c867f5f2bf0a..97d2619267ca 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_create_or_update.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_update.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_update.py index 95766c877866..b32be42cb3b1 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_update.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_create_or_update.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_create_or_update.py index ce7934defe39..a1ce2c852fe8 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_create_or_update.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_update.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_update.py index 691a36f3d23a..514139ce7c29 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_update.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_identity_providers_create_or_update.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_identity_providers_create_or_update.py index 899f55a97fcf..d5577a75815b 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_identity_providers_create_or_update.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_identity_providers_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_identity_providers_update.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_identity_providers_update.py index 3f77b2d347c5..a8637c4bc430 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_identity_providers_update.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_identity_providers_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_sets_create_or_update.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_sets_create_or_update.py index 551a699d3d39..85d85667547b 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_sets_create_or_update.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_sets_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_sets_update.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_sets_update.py index 2cdc369c6d06..0245456fcab3 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_sets_update.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_sets_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_machine_pools_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_machine_pools_operations.py index b80749daba39..6ad96ff80235 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_machine_pools_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_machine_pools_operations.py @@ -24,7 +24,7 @@ def test_list(self, resource_group): response = self.client.machine_pools.list( resource_group_name=resource_group.name, resource_name="str", - api_version="2023-09-04", + api_version="2023-11-22", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_get(self, resource_group): resource_group_name=resource_group.name, resource_name="str", child_resource_name="str", - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself @@ -64,7 +64,7 @@ def test_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself @@ -77,7 +77,7 @@ def test_delete(self, resource_group): resource_group_name=resource_group.name, resource_name="str", child_resource_name="str", - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself @@ -101,7 +101,7 @@ def test_update(self, resource_group): "lastModifiedByType": "str", }, }, - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_machine_pools_operations_async.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_machine_pools_operations_async.py index e4a3f4d38de7..386fd27a5403 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_machine_pools_operations_async.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_machine_pools_operations_async.py @@ -25,7 +25,7 @@ async def test_list(self, resource_group): response = self.client.machine_pools.list( resource_group_name=resource_group.name, resource_name="str", - api_version="2023-09-04", + api_version="2023-11-22", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_get(self, resource_group): resource_group_name=resource_group.name, resource_name="str", child_resource_name="str", - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself @@ -65,7 +65,7 @@ async def test_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself @@ -78,7 +78,7 @@ async def test_delete(self, resource_group): resource_group_name=resource_group.name, resource_name="str", child_resource_name="str", - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself @@ -102,7 +102,7 @@ async def test_update(self, resource_group): "lastModifiedByType": "str", }, }, - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_open_shift_clusters_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_open_shift_clusters_operations.py index cf20c8e7ece3..4a277fa65254 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_open_shift_clusters_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_open_shift_clusters_operations.py @@ -22,7 +22,7 @@ def setup_method(self, method): @recorded_by_proxy def test_list(self, resource_group): response = self.client.open_shift_clusters.list( - api_version="2023-09-04", + api_version="2023-11-22", ) result = [r for r in response] # please add some check logic here by yourself @@ -33,7 +33,7 @@ def test_list(self, resource_group): def test_list_by_resource_group(self, resource_group): response = self.client.open_shift_clusters.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2023-09-04", + api_version="2023-11-22", ) result = [r for r in response] # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get(self, resource_group): response = self.client.open_shift_clusters.get( resource_group_name=resource_group.name, resource_name="str", - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself @@ -78,6 +78,10 @@ def test_begin_create_or_update(self, resource_group): }, "name": "str", "networkProfile": { + "loadBalancerProfile": { + "effectiveOutboundIps": [{"id": "str"}], + "managedOutboundIps": {"count": 0}, + }, "outboundType": "str", "podCidr": "str", "preconfiguredNSG": "str", @@ -118,7 +122,7 @@ def test_begin_create_or_update(self, resource_group): } ], }, - api_version="2023-09-04", + api_version="2023-11-22", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -130,7 +134,7 @@ def test_begin_delete(self, resource_group): response = self.client.open_shift_clusters.begin_delete( resource_group_name=resource_group.name, resource_name="str", - api_version="2023-09-04", + api_version="2023-11-22", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -160,6 +164,10 @@ def test_begin_update(self, resource_group): "vmSize": "str", }, "networkProfile": { + "loadBalancerProfile": { + "effectiveOutboundIps": [{"id": "str"}], + "managedOutboundIps": {"count": 0}, + }, "outboundType": "str", "podCidr": "str", "preconfiguredNSG": "str", @@ -199,7 +207,7 @@ def test_begin_update(self, resource_group): } ], }, - api_version="2023-09-04", + api_version="2023-11-22", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -211,7 +219,7 @@ def test_list_admin_credentials(self, resource_group): response = self.client.open_shift_clusters.list_admin_credentials( resource_group_name=resource_group.name, resource_name="str", - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself @@ -223,7 +231,7 @@ def test_list_credentials(self, resource_group): response = self.client.open_shift_clusters.list_credentials( resource_group_name=resource_group.name, resource_name="str", - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_open_shift_clusters_operations_async.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_open_shift_clusters_operations_async.py index 08f48a10adf9..8983ff4be505 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_open_shift_clusters_operations_async.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_open_shift_clusters_operations_async.py @@ -23,7 +23,7 @@ def setup_method(self, method): @recorded_by_proxy_async async def test_list(self, resource_group): response = self.client.open_shift_clusters.list( - api_version="2023-09-04", + api_version="2023-11-22", ) result = [r async for r in response] # please add some check logic here by yourself @@ -34,7 +34,7 @@ async def test_list(self, resource_group): async def test_list_by_resource_group(self, resource_group): response = self.client.open_shift_clusters.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2023-09-04", + api_version="2023-11-22", ) result = [r async for r in response] # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get(self, resource_group): response = await self.client.open_shift_clusters.get( resource_group_name=resource_group.name, resource_name="str", - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself @@ -80,6 +80,10 @@ async def test_begin_create_or_update(self, resource_group): }, "name": "str", "networkProfile": { + "loadBalancerProfile": { + "effectiveOutboundIps": [{"id": "str"}], + "managedOutboundIps": {"count": 0}, + }, "outboundType": "str", "podCidr": "str", "preconfiguredNSG": "str", @@ -120,7 +124,7 @@ async def test_begin_create_or_update(self, resource_group): } ], }, - api_version="2023-09-04", + api_version="2023-11-22", ) ).result() # call '.result()' to poll until service return final result @@ -134,7 +138,7 @@ async def test_begin_delete(self, resource_group): await self.client.open_shift_clusters.begin_delete( resource_group_name=resource_group.name, resource_name="str", - api_version="2023-09-04", + api_version="2023-11-22", ) ).result() # call '.result()' to poll until service return final result @@ -166,6 +170,10 @@ async def test_begin_update(self, resource_group): "vmSize": "str", }, "networkProfile": { + "loadBalancerProfile": { + "effectiveOutboundIps": [{"id": "str"}], + "managedOutboundIps": {"count": 0}, + }, "outboundType": "str", "podCidr": "str", "preconfiguredNSG": "str", @@ -205,7 +213,7 @@ async def test_begin_update(self, resource_group): } ], }, - api_version="2023-09-04", + api_version="2023-11-22", ) ).result() # call '.result()' to poll until service return final result @@ -218,7 +226,7 @@ async def test_list_admin_credentials(self, resource_group): response = await self.client.open_shift_clusters.list_admin_credentials( resource_group_name=resource_group.name, resource_name="str", - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself @@ -230,7 +238,7 @@ async def test_list_credentials(self, resource_group): response = await self.client.open_shift_clusters.list_credentials( resource_group_name=resource_group.name, resource_name="str", - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_open_shift_versions_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_open_shift_versions_operations.py index d3e62135eab5..cf56e7397727 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_open_shift_versions_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_open_shift_versions_operations.py @@ -23,7 +23,7 @@ def setup_method(self, method): def test_list(self, resource_group): response = self.client.open_shift_versions.list( location="str", - api_version="2023-09-04", + api_version="2023-11-22", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_open_shift_versions_operations_async.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_open_shift_versions_operations_async.py index 159afb3a2942..f0a4299c977c 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_open_shift_versions_operations_async.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_open_shift_versions_operations_async.py @@ -24,7 +24,7 @@ def setup_method(self, method): async def test_list(self, resource_group): response = self.client.open_shift_versions.list( location="str", - api_version="2023-09-04", + api_version="2023-11-22", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_operations.py index f6449fde0f86..1b121b0a67d5 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_operations.py @@ -22,7 +22,7 @@ def setup_method(self, method): @recorded_by_proxy def test_list(self, resource_group): response = self.client.operations.list( - api_version="2023-09-04", + api_version="2023-11-22", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_operations_async.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_operations_async.py index 9f42bdba07b7..3e3e3df01417 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_operations_async.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_operations_async.py @@ -23,7 +23,7 @@ def setup_method(self, method): @recorded_by_proxy_async async def test_list(self, resource_group): response = self.client.operations.list( - api_version="2023-09-04", + api_version="2023-11-22", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_secrets_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_secrets_operations.py index aee04ec51021..56810cb63a1f 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_secrets_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_secrets_operations.py @@ -24,7 +24,7 @@ def test_list(self, resource_group): response = self.client.secrets.list( resource_group_name=resource_group.name, resource_name="str", - api_version="2023-09-04", + api_version="2023-11-22", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_get(self, resource_group): resource_group_name=resource_group.name, resource_name="str", child_resource_name="str", - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself @@ -64,7 +64,7 @@ def test_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself @@ -77,7 +77,7 @@ def test_delete(self, resource_group): resource_group_name=resource_group.name, resource_name="str", child_resource_name="str", - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself @@ -101,7 +101,7 @@ def test_update(self, resource_group): "lastModifiedByType": "str", }, }, - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_secrets_operations_async.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_secrets_operations_async.py index b869763d5225..cd8189d692fb 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_secrets_operations_async.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_secrets_operations_async.py @@ -25,7 +25,7 @@ async def test_list(self, resource_group): response = self.client.secrets.list( resource_group_name=resource_group.name, resource_name="str", - api_version="2023-09-04", + api_version="2023-11-22", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_get(self, resource_group): resource_group_name=resource_group.name, resource_name="str", child_resource_name="str", - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself @@ -65,7 +65,7 @@ async def test_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself @@ -78,7 +78,7 @@ async def test_delete(self, resource_group): resource_group_name=resource_group.name, resource_name="str", child_resource_name="str", - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself @@ -102,7 +102,7 @@ async def test_update(self, resource_group): "lastModifiedByType": "str", }, }, - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_sync_identity_providers_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_sync_identity_providers_operations.py index 620c0ca5943f..aac10440ba70 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_sync_identity_providers_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_sync_identity_providers_operations.py @@ -24,7 +24,7 @@ def test_list(self, resource_group): response = self.client.sync_identity_providers.list( resource_group_name=resource_group.name, resource_name="str", - api_version="2023-09-04", + api_version="2023-11-22", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_get(self, resource_group): resource_group_name=resource_group.name, resource_name="str", child_resource_name="str", - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself @@ -64,7 +64,7 @@ def test_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself @@ -77,7 +77,7 @@ def test_delete(self, resource_group): resource_group_name=resource_group.name, resource_name="str", child_resource_name="str", - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself @@ -101,7 +101,7 @@ def test_update(self, resource_group): "lastModifiedByType": "str", }, }, - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_sync_identity_providers_operations_async.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_sync_identity_providers_operations_async.py index 3aa962536c97..6ffd2ef566eb 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_sync_identity_providers_operations_async.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_sync_identity_providers_operations_async.py @@ -25,7 +25,7 @@ async def test_list(self, resource_group): response = self.client.sync_identity_providers.list( resource_group_name=resource_group.name, resource_name="str", - api_version="2023-09-04", + api_version="2023-11-22", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_get(self, resource_group): resource_group_name=resource_group.name, resource_name="str", child_resource_name="str", - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself @@ -65,7 +65,7 @@ async def test_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself @@ -78,7 +78,7 @@ async def test_delete(self, resource_group): resource_group_name=resource_group.name, resource_name="str", child_resource_name="str", - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself @@ -102,7 +102,7 @@ async def test_update(self, resource_group): "lastModifiedByType": "str", }, }, - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_sync_sets_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_sync_sets_operations.py index ae6232686aaf..e3c9864448da 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_sync_sets_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_sync_sets_operations.py @@ -24,7 +24,7 @@ def test_list(self, resource_group): response = self.client.sync_sets.list( resource_group_name=resource_group.name, resource_name="str", - api_version="2023-09-04", + api_version="2023-11-22", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_get(self, resource_group): resource_group_name=resource_group.name, resource_name="str", child_resource_name="str", - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself @@ -64,7 +64,7 @@ def test_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself @@ -77,7 +77,7 @@ def test_delete(self, resource_group): resource_group_name=resource_group.name, resource_name="str", child_resource_name="str", - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself @@ -101,7 +101,7 @@ def test_update(self, resource_group): "lastModifiedByType": "str", }, }, - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_sync_sets_operations_async.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_sync_sets_operations_async.py index 0ef4ca24bfee..c3c4a047fcdc 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_sync_sets_operations_async.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_sync_sets_operations_async.py @@ -25,7 +25,7 @@ async def test_list(self, resource_group): response = self.client.sync_sets.list( resource_group_name=resource_group.name, resource_name="str", - api_version="2023-09-04", + api_version="2023-11-22", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_get(self, resource_group): resource_group_name=resource_group.name, resource_name="str", child_resource_name="str", - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself @@ -65,7 +65,7 @@ async def test_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself @@ -78,7 +78,7 @@ async def test_delete(self, resource_group): resource_group_name=resource_group.name, resource_name="str", child_resource_name="str", - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself @@ -102,7 +102,7 @@ async def test_update(self, resource_group): "lastModifiedByType": "str", }, }, - api_version="2023-09-04", + api_version="2023-11-22", ) # please add some check logic here by yourself diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/setup.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/setup.py index 3b01571beadc..49d37ccedc5f 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/setup.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/setup.py @@ -22,9 +22,11 @@ # Version extraction inspired from 'requests' with open( - os.path.join(package_folder_path, "version.py") - if os.path.exists(os.path.join(package_folder_path, "version.py")) - else os.path.join(package_folder_path, "_version.py"), + ( + os.path.join(package_folder_path, "version.py") + if os.path.exists(os.path.join(package_folder_path, "version.py")) + else os.path.join(package_folder_path, "_version.py") + ), "r", ) as fd: version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/tests/disable_test_cli_mgmt_redhatopenshift.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/tests/disable_test_cli_mgmt_redhatopenshift.py index 1c3e2ca80216..59c1af6db883 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/tests/disable_test_cli_mgmt_redhatopenshift.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/tests/disable_test_cli_mgmt_redhatopenshift.py @@ -1,10 +1,10 @@ # coding: utf-8 -#------------------------------------------------------------------------- +# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- # TEST SCENARIO COVERAGE @@ -21,84 +21,78 @@ import azure.mgmt.redhatopenshift from devtools_testutils import AzureMgmtTestCase, ResourceGroupPreparer -AZURE_LOCATION = 'australiaeast' +AZURE_LOCATION = "australiaeast" + @unittest.skip("skip test") class MgmtAzureRedHatOpenShiftClientTest(AzureMgmtTestCase): def setUp(self): super(MgmtAzureRedHatOpenShiftClientTest, self).setUp() - self.mgmt_client = self.create_mgmt_client( - azure.mgmt.redhatopenshift.AzureRedHatOpenShiftClient - ) + self.mgmt_client = self.create_mgmt_client(azure.mgmt.redhatopenshift.AzureRedHatOpenShiftClient) if self.is_live: from azure.mgmt.network import NetworkManagementClient - self.network_client = self.create_mgmt_client( - NetworkManagementClient - ) + + self.network_client = self.create_mgmt_client(NetworkManagementClient) from azure.mgmt.authorization import AuthorizationManagementClient - self.authorization_client = self.create_mgmt_client( - AuthorizationManagementClient - ) + + self.authorization_client = self.create_mgmt_client(AuthorizationManagementClient) from azure.mgmt.containerregistry import ContainerRegistryManagementClient - self.acr_client = self.create_mgmt_client( - ContainerRegistryManagementClient - ) + + self.acr_client = self.create_mgmt_client(ContainerRegistryManagementClient) def create_virtual_network(self, group_name, location, network_name, subnet_name): - - azure_operation_poller = self.network_client.virtual_networks.create_or_update( - group_name, - network_name, - { - 'location': location, - 'address_space': { - 'address_prefixes': ['10.0.0.0/16'] - } - }, - ) - result_create = azure_operation_poller.result() - - async_subnet_creation = self.network_client.subnets.create_or_update( - group_name, - network_name, - subnet_name, - subnet_parameters={'address_prefix': '10.0.0.0/24', "private_link_service_network_policies": "Disabled", "private_endpoint_network_policies": "Disabled", "service_endpoints": [ { "service": "Microsoft.ContainerRegistry" } ] } - ) - subnet_info = async_subnet_creation.result() - - return subnet_info + + azure_operation_poller = self.network_client.virtual_networks.create_or_update( + group_name, + network_name, + {"location": location, "address_space": {"address_prefixes": ["10.0.0.0/16"]}}, + ) + result_create = azure_operation_poller.result() + + async_subnet_creation = self.network_client.subnets.create_or_update( + group_name, + network_name, + subnet_name, + subnet_parameters={ + "address_prefix": "10.0.0.0/24", + "private_link_service_network_policies": "Disabled", + "private_endpoint_network_policies": "Disabled", + "service_endpoints": [{"service": "Microsoft.ContainerRegistry"}], + }, + ) + subnet_info = async_subnet_creation.result() + + return subnet_info def create_subnet(self, group_name, location, network_name, subnet_name): async_subnet_creation = self.network_client.subnets.create_or_update( group_name, network_name, subnet_name, - subnet_parameters={'address_prefix': '10.0.1.0/24', "private_link_service_network_policies": "Disabled", "private_endpoint_network_policies": "Disabled", "service_endpoints": [ { "service": "Microsoft.ContainerRegistry" } ] } + subnet_parameters={ + "address_prefix": "10.0.1.0/24", + "private_link_service_network_policies": "Disabled", + "private_endpoint_network_policies": "Disabled", + "service_endpoints": [{"service": "Microsoft.ContainerRegistry"}], + }, ) subnet_info = async_subnet_creation.result() - subnet_info = self.network_client.subnets.get(group_name, - network_name, - subnet_name) + subnet_info = self.network_client.subnets.get(group_name, network_name, subnet_name) print(str(subnet_info)) return subnet_info - def assign_role(self, - service_principal_id, - scope, - name, - full_id): + def assign_role(self, service_principal_id, scope, name, full_id): BODY = { "role_definition_id": full_id, "principal_id": service_principal_id, - "principal_type": "ServicePrincipal" + "principal_type": "ServicePrincipal", } result = self.authorization_client.role_assignments.create(scope, role_assignment_name=name, parameters=BODY) - @ResourceGroupPreparer(location=AZURE_LOCATION) def test_redhatopenshift(self, resource_group): @@ -111,71 +105,96 @@ def test_redhatopenshift(self, resource_group): SUBNET_NAME_2 = "mysubnet2" if self.is_live: - SUBNET = self.create_virtual_network(RESOURCE_GROUP, AZURE_LOCATION, VIRTUAL_NETWORK_NAME, SUBNET_NAME) - SUBNET_2 = self.create_subnet(RESOURCE_GROUP, AZURE_LOCATION, VIRTUAL_NETWORK_NAME, SUBNET_NAME_2) - - self.assign_role(self.settings.SERVICE_PRINCIPAL_ID, # SP Object ID - "/subscriptions/" + SUBSCRIPTION_ID + "/resourceGroups/" + RESOURCE_GROUP + "/providers/Microsoft.Network/virtualNetworks/" + VIRTUAL_NETWORK_NAME, - "1fa638dc-b769-420d-b822-340abb216e78", - "/subscriptions/" + SUBSCRIPTION_ID + "/providers/Microsoft.Authorization/roleDefinitions/" + "b24988ac-6180-42a0-ab88-20f7382dd24c") - self.assign_role(self.settings.ARO_SERVICE_PRINCIPAL_ID, - "/subscriptions/" + SUBSCRIPTION_ID + "/resourceGroups/" + RESOURCE_GROUP + "/providers/Microsoft.Network/virtualNetworks/" + VIRTUAL_NETWORK_NAME, - "1fa638dc-b769-420d-b822-340abb216e77", - "/subscriptions/" + SUBSCRIPTION_ID + "/providers/Microsoft.Authorization/roleDefinitions/" + "b24988ac-6180-42a0-ab88-20f7382dd24c") - CLIENT_ID = self.settings.CLIENT_ID - CLIENT_SECRET = self.settings.CLIENT_SECRET - self.be_careful_with_service_principal + SUBNET = self.create_virtual_network(RESOURCE_GROUP, AZURE_LOCATION, VIRTUAL_NETWORK_NAME, SUBNET_NAME) + SUBNET_2 = self.create_subnet(RESOURCE_GROUP, AZURE_LOCATION, VIRTUAL_NETWORK_NAME, SUBNET_NAME_2) + + self.assign_role( + self.settings.SERVICE_PRINCIPAL_ID, # SP Object ID + "/subscriptions/" + + SUBSCRIPTION_ID + + "/resourceGroups/" + + RESOURCE_GROUP + + "/providers/Microsoft.Network/virtualNetworks/" + + VIRTUAL_NETWORK_NAME, + "1fa638dc-b769-420d-b822-340abb216e78", + "/subscriptions/" + + SUBSCRIPTION_ID + + "/providers/Microsoft.Authorization/roleDefinitions/" + + "b24988ac-6180-42a0-ab88-20f7382dd24c", + ) + self.assign_role( + self.settings.ARO_SERVICE_PRINCIPAL_ID, + "/subscriptions/" + + SUBSCRIPTION_ID + + "/resourceGroups/" + + RESOURCE_GROUP + + "/providers/Microsoft.Network/virtualNetworks/" + + VIRTUAL_NETWORK_NAME, + "1fa638dc-b769-420d-b822-340abb216e77", + "/subscriptions/" + + SUBSCRIPTION_ID + + "/providers/Microsoft.Authorization/roleDefinitions/" + + "b24988ac-6180-42a0-ab88-20f7382dd24c", + ) + CLIENT_ID = self.settings.CLIENT_ID + CLIENT_SECRET = self.settings.CLIENT_SECRET + self.be_careful_with_service_principal else: - CLIENT_ID = "00000000-0000-0000-0000-000000000000" - CLIENT_SECRET = "xxxxxxxx" + CLIENT_ID = "00000000-0000-0000-0000-000000000000" + CLIENT_SECRET = "xxxxxxxx" # /OpenShiftClusters/put/Creates or updates a OpenShift cluster with the specified subscription, resource group and resource name.[put] BODY = { - "location": "australiaeast", - "tags": { - "key": "value" - }, - "cluster_profile": { - "pull_secret": "", - "domain": "ab0176mx", - "resource_group_id": "/subscriptions/" + SUBSCRIPTION_ID + "/resourceGroups/" + "aro-ab0176mx" - }, - "service_principal_profile": { - "client_id": CLIENT_ID, - "client_secret": CLIENT_SECRET - }, - "network_profile": { - "pod_cidr": "10.128.0.0/14", - "service_cidr": "172.30.0.0/16" - }, - "master_profile": { - "vm_size": "Standard_D8s_v3", - "subnet_id": "/subscriptions/" + SUBSCRIPTION_ID + "/resourceGroups/" + RESOURCE_GROUP + "/providers/Microsoft.Network/virtualNetworks/" + VIRTUAL_NETWORK_NAME + "/subnets/" + SUBNET_NAME + "" - }, - "worker_profiles": [ - { - "name": "worker", - "vm_size": "Standard_D4s_v3", - "disk_size_gb": "128", - "subnet_id": "/subscriptions/" + SUBSCRIPTION_ID + "/resourceGroups/" + RESOURCE_GROUP + "/providers/Microsoft.Network/virtualNetworks/" + VIRTUAL_NETWORK_NAME + "/subnets/" + SUBNET_NAME_2 + "", - "count": "3" - } - ], - "apiserver_profile": { - "visibility": "Public" - }, - "ingress_profiles": [ - { - "name": "default", - "visibility": "Public" - } - ] + "location": "australiaeast", + "tags": {"key": "value"}, + "cluster_profile": { + "pull_secret": "", + "domain": "ab0176mx", + "resource_group_id": "/subscriptions/" + SUBSCRIPTION_ID + "/resourceGroups/" + "aro-ab0176mx", + }, + "service_principal_profile": {"client_id": CLIENT_ID, "client_secret": CLIENT_SECRET}, + "network_profile": {"pod_cidr": "10.128.0.0/14", "service_cidr": "172.30.0.0/16"}, + "master_profile": { + "vm_size": "Standard_D8s_v3", + "subnet_id": "/subscriptions/" + + SUBSCRIPTION_ID + + "/resourceGroups/" + + RESOURCE_GROUP + + "/providers/Microsoft.Network/virtualNetworks/" + + VIRTUAL_NETWORK_NAME + + "/subnets/" + + SUBNET_NAME + + "", + }, + "worker_profiles": [ + { + "name": "worker", + "vm_size": "Standard_D4s_v3", + "disk_size_gb": "128", + "subnet_id": "/subscriptions/" + + SUBSCRIPTION_ID + + "/resourceGroups/" + + RESOURCE_GROUP + + "/providers/Microsoft.Network/virtualNetworks/" + + VIRTUAL_NETWORK_NAME + + "/subnets/" + + SUBNET_NAME_2 + + "", + "count": "3", + } + ], + "apiserver_profile": {"visibility": "Public"}, + "ingress_profiles": [{"name": "default", "visibility": "Public"}], } - result = self.mgmt_client.open_shift_clusters.create_or_update(resource_group_name=RESOURCE_GROUP, resource_name=RESOURCE_NAME, parameters=BODY) + result = self.mgmt_client.open_shift_clusters.create_or_update( + resource_group_name=RESOURCE_GROUP, resource_name=RESOURCE_NAME, parameters=BODY + ) result = result.result() # /OpenShiftClusters/get/Gets a OpenShift cluster with the specified subscription, resource group and resource name.[get] - result = self.mgmt_client.open_shift_clusters.get(resource_group_name=RESOURCE_GROUP, resource_name=RESOURCE_NAME) + result = self.mgmt_client.open_shift_clusters.get( + resource_group_name=RESOURCE_GROUP, resource_name=RESOURCE_NAME + ) # /OpenShiftClusters/get/Lists OpenShift clusters in the specified subscription and resource group.[get] result = self.mgmt_client.open_shift_clusters.list_by_resource_group(resource_group_name=RESOURCE_GROUP) @@ -187,57 +206,64 @@ def test_redhatopenshift(self, resource_group): result = self.mgmt_client.operations.list() # /OpenShiftClusters/post/Lists credentials of an OpenShift cluster with the specified subscription, resource group and resource name.[post] - result = self.mgmt_client.open_shift_clusters.list_credentials(resource_group_name=RESOURCE_GROUP, resource_name=RESOURCE_NAME) + result = self.mgmt_client.open_shift_clusters.list_credentials( + resource_group_name=RESOURCE_GROUP, resource_name=RESOURCE_NAME + ) # /OpenShiftClusters/patch/Creates or updates a OpenShift cluster with the specified subscription, resource group and resource name.[patch] BODY = { - "tags": { - "key": "value" - }, - "cluster_profile": { - "pull_secret": "", - "domain": "ab0176mx", - "resource_group_id": "/subscriptions/" + SUBSCRIPTION_ID + "/resourceGroups/" + "aro-ab0176mx" - }, - "service_principal_profile": { - "client_id": CLIENT_ID, - "client_secret": CLIENT_SECRET - }, - "network_profile": { - "pod_cidr": "10.128.0.0/14", - "service_cidr": "172.30.0.0/16" - }, - "master_profile": { - "vm_size": "Standard_D8s_v3", - "subnet_id": "/subscriptions/" + SUBSCRIPTION_ID + "/resourceGroups/" + RESOURCE_GROUP + "/providers/Microsoft.Network/virtualNetworks/" + VIRTUAL_NETWORK_NAME + "/subnets/" + SUBNET_NAME + "" - }, - "worker_profiles": [ - { - # "name": "worker", - "vm_size": "Standard_D4s_v3", - "disk_size_gb": "128", - "subnet_id": "/subscriptions/" + SUBSCRIPTION_ID + "/resourceGroups/" + RESOURCE_GROUP + "/providers/Microsoft.Network/virtualNetworks/" + VIRTUAL_NETWORK_NAME + "/subnets/" + SUBNET_NAME_2 + "", - "count": "3" - } - ], - "apiserver_profile": { - "visibility": "Public" - }, - "ingress_profiles": [ - { - "name": "default", - "visibility": "Public" - } - ] + "tags": {"key": "value"}, + "cluster_profile": { + "pull_secret": "", + "domain": "ab0176mx", + "resource_group_id": "/subscriptions/" + SUBSCRIPTION_ID + "/resourceGroups/" + "aro-ab0176mx", + }, + "service_principal_profile": {"client_id": CLIENT_ID, "client_secret": CLIENT_SECRET}, + "network_profile": {"pod_cidr": "10.128.0.0/14", "service_cidr": "172.30.0.0/16"}, + "master_profile": { + "vm_size": "Standard_D8s_v3", + "subnet_id": "/subscriptions/" + + SUBSCRIPTION_ID + + "/resourceGroups/" + + RESOURCE_GROUP + + "/providers/Microsoft.Network/virtualNetworks/" + + VIRTUAL_NETWORK_NAME + + "/subnets/" + + SUBNET_NAME + + "", + }, + "worker_profiles": [ + { + # "name": "worker", + "vm_size": "Standard_D4s_v3", + "disk_size_gb": "128", + "subnet_id": "/subscriptions/" + + SUBSCRIPTION_ID + + "/resourceGroups/" + + RESOURCE_GROUP + + "/providers/Microsoft.Network/virtualNetworks/" + + VIRTUAL_NETWORK_NAME + + "/subnets/" + + SUBNET_NAME_2 + + "", + "count": "3", + } + ], + "apiserver_profile": {"visibility": "Public"}, + "ingress_profiles": [{"name": "default", "visibility": "Public"}], } - result = self.mgmt_client.open_shift_clusters.update(resource_group_name=RESOURCE_GROUP, resource_name=RESOURCE_NAME, parameters=BODY) + result = self.mgmt_client.open_shift_clusters.update( + resource_group_name=RESOURCE_GROUP, resource_name=RESOURCE_NAME, parameters=BODY + ) result = result.result() # /OpenShiftClusters/delete/Deletes a OpenShift cluster with the specified subscription, resource group and resource name.[delete] - result = self.mgmt_client.open_shift_clusters.delete(resource_group_name=RESOURCE_GROUP, resource_name=RESOURCE_NAME) + result = self.mgmt_client.open_shift_clusters.delete( + resource_group_name=RESOURCE_GROUP, resource_name=RESOURCE_NAME + ) result = result.result() -#------------------------------------------------------------------------------ -if __name__ == '__main__': +# ------------------------------------------------------------------------------ +if __name__ == "__main__": unittest.main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/tests/test_azure_red_hat_open_shift4_open_shift_clusters_operations_async_test.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/tests/test_azure_red_hat_open_shift4_open_shift_clusters_operations_async_test.py index 132ab09a3e10..ebfdd7f7a955 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/tests/test_azure_red_hat_open_shift4_open_shift_clusters_operations_async_test.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/tests/test_azure_red_hat_open_shift4_open_shift_clusters_operations_async_test.py @@ -14,7 +14,7 @@ AZURE_LOCATION = "eastus" - +@pytest.mark.live_test_only class TestAzureRedHatOpenShift4OpenShiftClustersOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(AzureRedHatOpenShiftClient, is_async=True) @@ -22,20 +22,15 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_list(self, resource_group): - response = self.client.open_shift_clusters.list( - api_version="2023-11-22", - ) + response = self.client.open_shift_clusters.list() result = [r async for r in response] assert response - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_list_by_resource_group(self, resource_group): response = self.client.open_shift_clusters.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2023-11-22", ) result = [r async for r in response] assert result == [] - \ No newline at end of file diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/tests/test_azure_red_hat_open_shift4_open_shift_clusters_operations_test.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/tests/test_azure_red_hat_open_shift4_open_shift_clusters_operations_test.py index dd4065e716d0..84a83916b491 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/tests/test_azure_red_hat_open_shift4_open_shift_clusters_operations_test.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/tests/test_azure_red_hat_open_shift4_open_shift_clusters_operations_test.py @@ -13,7 +13,7 @@ AZURE_LOCATION = "eastus" - +@pytest.mark.live_test_only class TestAzureRedHatOpenShift4OpenShiftClustersOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(AzureRedHatOpenShiftClient) @@ -21,20 +21,15 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_list(self, resource_group): - response = self.client.open_shift_clusters.list( - api_version="2023-11-22", - ) + response = self.client.open_shift_clusters.list() result = [r for r in response] assert response - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_list_by_resource_group(self, resource_group): response = self.client.open_shift_clusters.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2023-11-22", ) result = [r for r in response] assert result == [] - \ No newline at end of file diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/tests/test_azure_red_hat_open_shift4_operations_async_test.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/tests/test_azure_red_hat_open_shift4_operations_async_test.py index a49683d20b85..9295bca4eb6f 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/tests/test_azure_red_hat_open_shift4_operations_async_test.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/tests/test_azure_red_hat_open_shift4_operations_async_test.py @@ -14,7 +14,7 @@ AZURE_LOCATION = "eastus" - +@pytest.mark.live_test_only class TestAzureRedHatOpenShift4OperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(AzureRedHatOpenShiftClient, is_async=True) @@ -22,9 +22,6 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_list(self, resource_group): - response = self.client.operations.list( - api_version="2023-11-22", - ) + response = self.client.operations.list() result = [r async for r in response] assert result - diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/tests/test_azure_red_hat_open_shift4_operations_test.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/tests/test_azure_red_hat_open_shift4_operations_test.py index 731ca738f5de..d3da434a5051 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/tests/test_azure_red_hat_open_shift4_operations_test.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/tests/test_azure_red_hat_open_shift4_operations_test.py @@ -13,7 +13,7 @@ AZURE_LOCATION = "eastus" - +@pytest.mark.live_test_only class TestAzureRedHatOpenShift4Operations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(AzureRedHatOpenShiftClient) @@ -21,9 +21,6 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_list(self, resource_group): - response = self.client.operations.list( - api_version="2023-11-22", - ) + response = self.client.operations.list() result = [r for r in response] assert result -