diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/CHANGELOG.md b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/CHANGELOG.md index 9df1dd3da0eb..e7e8575fb2d7 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/CHANGELOG.md +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/CHANGELOG.md @@ -1,5 +1,52 @@ # Release History +## 3.0.0 (2026-02-06) + +### Features Added + + - Model `AzureRedHatOpenShiftClient` added parameter `cloud_setting` in method `__init__` + - Client `AzureRedHatOpenShiftClient` added operation group `platform_workload_identity_role_sets` + - Client `AzureRedHatOpenShiftClient` added operation group `platform_workload_identity_role_set` + - Model `ClusterProfile` added property `oidc_issuer` + - Model `OpenShiftCluster` added property `identity` + - Model `OpenShiftCluster` added property `platform_workload_identity_profile` + - Model `OpenShiftClusterUpdate` added property `identity` + - Model `OpenShiftClusterUpdate` added property `platform_workload_identity_profile` + - Added model `ManagedServiceIdentity` + - Added enum `ManagedServiceIdentityType` + - Added model `PlatformWorkloadIdentity` + - Added model `PlatformWorkloadIdentityProfile` + - Added model `PlatformWorkloadIdentityRole` + - Added model `PlatformWorkloadIdentityRoleSet` + - Added model `PlatformWorkloadIdentityRoleSetList` + - Added model `UserAssignedIdentity` + - Added operation group `PlatformWorkloadIdentityRoleSetOperations` + - Added operation group `PlatformWorkloadIdentityRoleSetsOperations` + +### Breaking Changes + + - Deleted or renamed client operation group `AzureRedHatOpenShiftClient.machine_pools` + - Deleted or renamed client operation group `AzureRedHatOpenShiftClient.secrets` + - Deleted or renamed client operation group `AzureRedHatOpenShiftClient.sync_identity_providers` + - Deleted or renamed client operation group `AzureRedHatOpenShiftClient.sync_sets` + - Model `OpenShiftClusterUpdate` deleted or renamed its instance variable `system_data` + - Deleted or renamed model `MachinePool` + - Deleted or renamed model `MachinePoolList` + - Deleted or renamed model `MachinePoolUpdate` + - Deleted or renamed model `Secret` + - Deleted or renamed model `SecretList` + - Deleted or renamed model `SecretUpdate` + - Deleted or renamed model `SyncIdentityProvider` + - Deleted or renamed model `SyncIdentityProviderList` + - Deleted or renamed model `SyncIdentityProviderUpdate` + - Deleted or renamed model `SyncSet` + - Deleted or renamed model `SyncSetList` + - Deleted or renamed model `SyncSetUpdate` + - Deleted or renamed operation group `MachinePoolsOperations` + - Deleted or renamed operation group `SecretsOperations` + - Deleted or renamed operation group `SyncIdentityProvidersOperations` + - Deleted or renamed operation group `SyncSetsOperations` + ## 2.0.0 (2024-10-30) ### Breaking Changes diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/MANIFEST.in b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/MANIFEST.in index f613d9ba0210..9407420cf38c 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/MANIFEST.in +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/MANIFEST.in @@ -1,8 +1,7 @@ -include _meta.json -recursive-include tests *.py *.json -recursive-include samples *.py *.md include *.md -include azure/__init__.py -include azure/mgmt/__init__.py include LICENSE include azure/mgmt/redhatopenshift/py.typed +recursive-include tests *.py +recursive-include samples *.py *.md +include azure/__init__.py +include azure/mgmt/__init__.py diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/README.md b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/README.md index 2e9c20567988..feff304ae814 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/README.md +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Red Hat Openshift Management Client Library. -This package has been tested with Python 3.8+. +This package has been tested with Python 3.9+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.8+ is required to use this package. +- Python 3.9+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package @@ -24,7 +24,7 @@ pip install azure-identity ### Authentication -By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configuration of the following environment variables. - `AZURE_CLIENT_ID` for Azure client ID. - `AZURE_TENANT_ID` for Azure tenant ID. diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/_meta.json b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/_meta.json deleted file mode 100644 index f95af25c6039..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "2776cb32cd6ca9ea953a13ae26c954b989e83367", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.10.2", - "use": [ - "@autorest/python@6.19.0", - "@autorest/modelerfour@4.27.0" - ], - "autorest_command": "autorest specification/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/_metadata.json b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/_metadata.json new file mode 100644 index 000000000000..d58e3600b003 --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/_metadata.json @@ -0,0 +1,11 @@ +{ + "commit": "f52764d11d53276b79bbbba37f977ef0b03bbd2c", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest": "3.10.2", + "use": [ + "@autorest/python@6.45.1", + "@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 --package-mode=azure-mgmt --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.45.1 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "readme": "specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/OpenShiftClusters/readme.md" +} \ No newline at end of file diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/apiview-properties.json b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/apiview-properties.json new file mode 100644 index 000000000000..a60407f6fd0f --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/apiview-properties.json @@ -0,0 +1,72 @@ +{ + "CrossLanguagePackageId": null, + "CrossLanguageDefinitionId": { + "azure.mgmt.redhatopenshift.models.APIServerProfile": null, + "azure.mgmt.redhatopenshift.models.CloudErrorBody": null, + "azure.mgmt.redhatopenshift.models.ClusterProfile": null, + "azure.mgmt.redhatopenshift.models.ConsoleProfile": null, + "azure.mgmt.redhatopenshift.models.Display": null, + "azure.mgmt.redhatopenshift.models.EffectiveOutboundIP": null, + "azure.mgmt.redhatopenshift.models.IngressProfile": null, + "azure.mgmt.redhatopenshift.models.LoadBalancerProfile": null, + "azure.mgmt.redhatopenshift.models.ManagedOutboundIPs": null, + "azure.mgmt.redhatopenshift.models.ManagedServiceIdentity": null, + "azure.mgmt.redhatopenshift.models.MasterProfile": null, + "azure.mgmt.redhatopenshift.models.NetworkProfile": null, + "azure.mgmt.redhatopenshift.models.Resource": null, + "azure.mgmt.redhatopenshift.models.TrackedResource": null, + "azure.mgmt.redhatopenshift.models.OpenShiftCluster": null, + "azure.mgmt.redhatopenshift.models.OpenShiftClusterAdminKubeconfig": null, + "azure.mgmt.redhatopenshift.models.OpenShiftClusterCredentials": null, + "azure.mgmt.redhatopenshift.models.OpenShiftClusterList": null, + "azure.mgmt.redhatopenshift.models.OpenShiftClusterUpdate": null, + "azure.mgmt.redhatopenshift.models.ProxyResource": null, + "azure.mgmt.redhatopenshift.models.OpenShiftVersion": null, + "azure.mgmt.redhatopenshift.models.OpenShiftVersionList": null, + "azure.mgmt.redhatopenshift.models.Operation": null, + "azure.mgmt.redhatopenshift.models.OperationList": null, + "azure.mgmt.redhatopenshift.models.PlatformWorkloadIdentity": null, + "azure.mgmt.redhatopenshift.models.PlatformWorkloadIdentityProfile": null, + "azure.mgmt.redhatopenshift.models.PlatformWorkloadIdentityRole": null, + "azure.mgmt.redhatopenshift.models.PlatformWorkloadIdentityRoleSet": null, + "azure.mgmt.redhatopenshift.models.PlatformWorkloadIdentityRoleSetList": null, + "azure.mgmt.redhatopenshift.models.ServicePrincipalProfile": null, + "azure.mgmt.redhatopenshift.models.SystemData": null, + "azure.mgmt.redhatopenshift.models.UserAssignedIdentity": null, + "azure.mgmt.redhatopenshift.models.WorkerProfile": null, + "azure.mgmt.redhatopenshift.models.CreatedByType": null, + "azure.mgmt.redhatopenshift.models.EncryptionAtHost": null, + "azure.mgmt.redhatopenshift.models.Visibility": null, + "azure.mgmt.redhatopenshift.models.ManagedServiceIdentityType": null, + "azure.mgmt.redhatopenshift.models.ProvisioningState": null, + "azure.mgmt.redhatopenshift.models.FipsValidatedModules": null, + "azure.mgmt.redhatopenshift.models.OutboundType": null, + "azure.mgmt.redhatopenshift.models.PreconfiguredNSG": null, + "azure.mgmt.redhatopenshift.operations.Operations.list": null, + "azure.mgmt.redhatopenshift.aio.operations.Operations.list": null, + "azure.mgmt.redhatopenshift.operations.OpenShiftVersionsOperations.list": null, + "azure.mgmt.redhatopenshift.aio.operations.OpenShiftVersionsOperations.list": null, + "azure.mgmt.redhatopenshift.operations.OpenShiftVersionsOperations.get": null, + "azure.mgmt.redhatopenshift.aio.operations.OpenShiftVersionsOperations.get": null, + "azure.mgmt.redhatopenshift.operations.PlatformWorkloadIdentityRoleSetsOperations.list": null, + "azure.mgmt.redhatopenshift.aio.operations.PlatformWorkloadIdentityRoleSetsOperations.list": null, + "azure.mgmt.redhatopenshift.operations.PlatformWorkloadIdentityRoleSetOperations.get": null, + "azure.mgmt.redhatopenshift.aio.operations.PlatformWorkloadIdentityRoleSetOperations.get": null, + "azure.mgmt.redhatopenshift.operations.OpenShiftClustersOperations.list": null, + "azure.mgmt.redhatopenshift.aio.operations.OpenShiftClustersOperations.list": null, + "azure.mgmt.redhatopenshift.operations.OpenShiftClustersOperations.list_by_resource_group": null, + "azure.mgmt.redhatopenshift.aio.operations.OpenShiftClustersOperations.list_by_resource_group": null, + "azure.mgmt.redhatopenshift.operations.OpenShiftClustersOperations.get": null, + "azure.mgmt.redhatopenshift.aio.operations.OpenShiftClustersOperations.get": null, + "azure.mgmt.redhatopenshift.operations.OpenShiftClustersOperations.begin_create_or_update": null, + "azure.mgmt.redhatopenshift.aio.operations.OpenShiftClustersOperations.begin_create_or_update": null, + "azure.mgmt.redhatopenshift.operations.OpenShiftClustersOperations.begin_delete": null, + "azure.mgmt.redhatopenshift.aio.operations.OpenShiftClustersOperations.begin_delete": null, + "azure.mgmt.redhatopenshift.operations.OpenShiftClustersOperations.begin_update": null, + "azure.mgmt.redhatopenshift.aio.operations.OpenShiftClustersOperations.begin_update": null, + "azure.mgmt.redhatopenshift.operations.OpenShiftClustersOperations.list_admin_credentials": null, + "azure.mgmt.redhatopenshift.aio.operations.OpenShiftClustersOperations.list_admin_credentials": null, + "azure.mgmt.redhatopenshift.operations.OpenShiftClustersOperations.list_credentials": null, + "azure.mgmt.redhatopenshift.aio.operations.OpenShiftClustersOperations.list_credentials": null + } +} \ No newline at end of file diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/__init__.py index 8db66d3d0f0f..d55ccad1f573 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/__init__.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/__init__.py @@ -1 +1 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/__init__.py index 8db66d3d0f0f..d55ccad1f573 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/__init__.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/__init__.py @@ -1 +1 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore 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 c64163c98d3d..bddf8279c601 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/__init__.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._azure_red_hat_open_shift_client import AzureRedHatOpenShiftClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._azure_red_hat_open_shift_client import AzureRedHatOpenShiftClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "AzureRedHatOpenShiftClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _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 150eafc9e5da..95ef4224f197 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 @@ -7,57 +7,58 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from ._configuration import AzureRedHatOpenShiftClientConfiguration -from ._serialization import Deserializer, Serializer +from ._utils.serialization import Deserializer, Serializer from .operations import ( - MachinePoolsOperations, OpenShiftClustersOperations, OpenShiftVersionsOperations, Operations, - SecretsOperations, - SyncIdentityProvidersOperations, - SyncSetsOperations, + PlatformWorkloadIdentityRoleSetOperations, + PlatformWorkloadIdentityRoleSetsOperations, ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports + from azure.core import AzureClouds from azure.core.credentials import TokenCredential -class AzureRedHatOpenShiftClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class AzureRedHatOpenShiftClient: """Rest API for Azure Red Hat OpenShift 4. :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 platform_workload_identity_role_sets: PlatformWorkloadIdentityRoleSetsOperations + operations + :vartype platform_workload_identity_role_sets: + azure.mgmt.redhatopenshift.operations.PlatformWorkloadIdentityRoleSetsOperations + :ivar platform_workload_identity_role_set: PlatformWorkloadIdentityRoleSetOperations operations + :vartype platform_workload_identity_role_set: + azure.mgmt.redhatopenshift.operations.PlatformWorkloadIdentityRoleSetOperations :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. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str - :keyword api_version: Api Version. Default value is "2023-11-22". Note that overriding this + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2025-07-25". 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 @@ -68,12 +69,24 @@ def __init__( self, credential: "TokenCredential", subscription_id: str, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = AzureRedHatOpenShiftClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, + subscription_id=subscription_id, + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -92,7 +105,7 @@ def __init__( 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) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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) @@ -102,15 +115,15 @@ def __init__( self.open_shift_versions = OpenShiftVersionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.open_shift_clusters = OpenShiftClustersOperations( + self.platform_workload_identity_role_sets = PlatformWorkloadIdentityRoleSetsOperations( 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.platform_workload_identity_role_set = PlatformWorkloadIdentityRoleSetOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.open_shift_clusters = OpenShiftClustersOperations( 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) -> HttpResponse: """Runs the network request through the client's chained policies. 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 db318d6f55d8..de49d35baeb1 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_configuration.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_configuration.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy @@ -14,11 +14,11 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports + from azure.core import AzureClouds from azure.core.credentials import TokenCredential -class AzureRedHatOpenShiftClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class AzureRedHatOpenShiftClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for AzureRedHatOpenShiftClient. Note that all parameters used to create this instance are saved as instance @@ -26,15 +26,24 @@ class AzureRedHatOpenShiftClientConfiguration: # pylint: disable=too-many-insta :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. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-11-22". Note that overriding this + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2025-07-25". 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") + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2025-07-25") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -43,6 +52,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs self.credential = credential self.subscription_id = subscription_id + self.cloud_setting = cloud_setting 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)) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_utils/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_utils/__init__.py new file mode 100644 index 000000000000..0af9b28f6607 --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_utils/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_serialization.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_utils/serialization.py similarity index 81% rename from sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_serialization.py rename to sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_utils/serialization.py index 8139854b97bb..6da830e0cf4a 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_serialization.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_utils/serialization.py @@ -1,30 +1,12 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -# pylint: skip-file # pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode @@ -39,7 +21,6 @@ import sys import codecs from typing import ( - Dict, Any, cast, Optional, @@ -48,11 +29,7 @@ IO, Mapping, Callable, - TypeVar, MutableMapping, - Type, - List, - Mapping, ) try: @@ -62,13 +39,13 @@ import xml.etree.ElementTree as ET import isodate # type: ignore +from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -ModelType = TypeVar("ModelType", bound="Model") JSON = MutableMapping[str, Any] @@ -91,6 +68,8 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: :param data: Input, could be bytes or stream (will be decoded with UTF8) or text :type data: str or bytes or IO :param str content_type: The content type. + :return: The deserialized data. + :rtype: object """ if hasattr(data, "read"): # Assume a stream @@ -112,7 +91,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: try: return json.loads(data_as_str) except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) + raise DeserializationError("JSON is invalid: {}".format(err), err) from err elif "xml" in (content_type or []): try: @@ -155,6 +134,11 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], Use bytes and headers to NOT use any requests/aiohttp or whatever specific implementation. Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object """ # Try to use content-type from headers if available content_type = None @@ -179,80 +163,31 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], except NameError: _long_type = int - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0.""" - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation.""" - return "Z" - - def dst(self, dt): - """No daylight saving for UTC.""" - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset # type: ignore -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset): - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc -except ImportError: - TZ_UTC = UTC() # type: ignore +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? None: - self.additional_properties: Optional[Dict[str, Any]] = {} - for k in kwargs: + self.additional_properties: Optional[dict[str, Any]] = {} + for k in kwargs: # pylint: disable=consider-using-dict-items if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) elif k in self._validation and self._validation[k].get("readonly", False): @@ -300,13 +242,23 @@ def __init__(self, **kwargs: Any) -> None: setattr(self, k, kwargs[k]) def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ return not self.__eq__(other) def __str__(self) -> str: @@ -326,7 +278,11 @@ def is_xml_model(cls) -> bool: @classmethod def _create_xml_node(cls): - """Create XML node.""" + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ try: xml_map = cls._xml_map # type: ignore except AttributeError: @@ -346,12 +302,14 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) 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. @@ -380,12 +338,15 @@ def my_key_transformer(key, attr_desc, value): If you want XML serialization, you can pass the kwargs is_xml=True. + :param bool keep_readonly: If you want to serialize the readonly attributes :param function key_transformer: A key transformer function. :returns: A dict JSON compatible object :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) @classmethod def _infer_class_models(cls): @@ -395,30 +356,31 @@ def _infer_class_models(cls): client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} if cls.__name__ not in client_models: raise ValueError("Not Autorest generated code") - except Exception: + except Exception: # pylint: disable=broad-exception-caught # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. client_models = {cls.__name__: cls} return client_models @classmethod - def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( - cls: Type[ModelType], + cls, data: Any, - key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, - ) -> ModelType: + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -426,9 +388,11 @@ def from_dict( and last_rest_key_case_insensitive_extractor) :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -448,21 +412,25 @@ def _flatten_subtype(cls, key, objects): return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): - result.update(objects[valuetype]._flatten_subtype(key, objects)) + result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access return result @classmethod def _classify(cls, response, objects): """Check the class _subtype_map for any child classes. We want to ignore any inherited _subtype_maps. - Remove the polymorphic key from the initial data. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class """ for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): subtype_value = None if not isinstance(response, ET.Element): rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) else: subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) if subtype_value: @@ -501,11 +469,13 @@ def _decode_attribute_map_key(key): inside the received data. :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str """ return key.replace("\\.", ".") -class Serializer(object): +class Serializer: # pylint: disable=too-many-public-methods """Request object model serializer.""" basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -540,7 +510,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) -> None: self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -556,17 +526,20 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, type] = dict(classes) if classes else {} + self.dependencies: dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True - def _serialize(self, target_obj, data_type=None, **kwargs): + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): """Serialize data into a string according to type. - :param target_obj: The data to be serialized. + :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict - :raises: SerializationError if serialization fails. + :raises SerializationError: if serialization fails. + :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) keep_readonly = kwargs.get("keep_readonly", False) @@ -592,17 +565,19 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized = {} if is_xml_model_serialization: - serialized = target_obj._create_xml_node() + serialized = target_obj._create_xml_node() # pylint: disable=protected-access try: - attributes = target_obj._attribute_map + attributes = target_obj._attribute_map # pylint: disable=protected-access for attr, attr_desc in attributes.items(): attr_name = attr - if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): continue if attr_name == "additional_properties" and attr_desc["key"] == "": if target_obj.additional_properties is not None: - serialized.update(target_obj.additional_properties) + serialized |= target_obj.additional_properties continue try: @@ -633,7 +608,8 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if isinstance(new_attr, list): serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + # If the down XML has no XML/Name, + # we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): splitted_tag = new_attr.tag.split("}") if len(splitted_tag) == 2: # Namespace @@ -664,17 +640,17 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) raise SerializationError(msg) from err - else: - return serialized + return serialized def body(self, data, data_type, **kwargs): """Serialize data intended for a request body. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized request body """ # Just in case this is a dict @@ -703,7 +679,7 @@ def body(self, data, data_type, **kwargs): attribute_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, ] - data = deserializer._deserialize(data_type, data) + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access except DeserializationError as err: raise SerializationError("Unable to build a model: " + str(err)) from err @@ -712,11 +688,13 @@ def body(self, data, data_type, **kwargs): def url(self, name, data, data_type, **kwargs): """Serialize data intended for a URL path. - :param data: The data to be serialized. + :param str name: The name of the URL path parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :returns: The serialized URL path + :raises TypeError: if serialization fails. + :raises ValueError: if data is None """ try: output = self.serialize_data(data, data_type, **kwargs) @@ -728,21 +706,20 @@ def url(self, name, data, data_type, **kwargs): output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return output + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output def query(self, name, data, data_type, **kwargs): """Serialize data intended for a URL query. - :param data: The data to be serialized. + :param str name: The name of the query parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :keyword bool skip_quote: Whether to skip quote the serialized result. - Defaults to False. :rtype: str, list - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized query parameter """ try: # Treat the list aside, since we don't want to encode the div separator @@ -759,19 +736,20 @@ def query(self, name, data, data_type, **kwargs): output = str(output) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def header(self, name, data, data_type, **kwargs): """Serialize data intended for a request header. - :param data: The data to be serialized. + :param str name: The name of the header. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized header """ try: if data_type in ["[str]"]: @@ -780,21 +758,20 @@ def header(self, name, data, data_type, **kwargs): output = self.serialize_data(data, data_type, **kwargs) if data_type == "bool": output = json.dumps(output) - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def serialize_data(self, data, data_type, **kwargs): """Serialize generic data according to supplied data type. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :param bool required: Whether it's essential that the data not be - empty or None - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list """ if data is None: raise ValueError("No value for given attribute") @@ -805,12 +782,12 @@ def serialize_data(self, data, data_type, **kwargs): if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) - elif data_type in self.serialize_type: + if data_type in self.serialize_type: return self.serialize_type[data_type](data, **kwargs) # If dependencies is empty, try with current data class # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, data.__class__) + enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) if issubclass(enum_type, Enum): return Serializer.serialize_enum(data, enum_obj=enum_type) @@ -821,11 +798,10 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." raise SerializationError(msg.format(data, data_type)) from err - else: - return self._serialize(data, **kwargs) + return self._serialize(data, **kwargs) @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) if custom_serializer: return custom_serializer @@ -841,23 +817,33 @@ def serialize_basic(cls, data, data_type, **kwargs): - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - is_xml bool : If set, use xml_basic_types_serializers - :param data: Object to be serialized. + :param obj data: Object to be serialized. :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object + :raises TypeError: raise if data_type is not one of str, int, float, bool. """ custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) if data_type == "str": return cls.serialize_unicode(data) - return eval(data_type)(data) # nosec + if data_type == "int": + return int(data) + if data_type == "float": + return float(data) + if data_type == "bool": + return bool(data) + raise TypeError("Unknown basic data type: {}".format(data_type)) @classmethod def serialize_unicode(cls, data): """Special handling for serializing unicode strings in Py2. Encode to UTF-8 if unicode, otherwise handle as a str. - :param data: Object to be serialized. + :param str data: Object to be serialized. :rtype: str + :return: serialized object """ try: # If I received an enum, return its value return data.value @@ -871,8 +857,7 @@ def serialize_unicode(cls, data): return data except NameError: return str(data) - else: - return str(data) + return str(data) def serialize_iter(self, data, iter_type, div=None, **kwargs): """Serialize iterable. @@ -882,15 +867,13 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): serialization_ctxt['type'] should be same as data_type. - is_xml bool : If set, serialize as XML - :param list attr: Object to be serialized. + :param list data: Object to be serialized. :param str iter_type: Type of object in the iterable. - :param bool required: Whether the objects in the iterable must - not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. - :keyword bool do_quote: Whether to quote the serialized result of each iterable element. Defaults to False. :rtype: list, str + :return: serialized iterable """ if isinstance(data, str): raise SerializationError("Refuse str type as a valid iter type.") @@ -945,9 +928,8 @@ def serialize_dict(self, attr, dict_type, **kwargs): :param dict attr: Object to be serialized. :param str dict_type: Type of object in the dictionary. - :param bool required: Whether the objects in the dictionary must - not be None or empty. :rtype: dict + :return: serialized dictionary """ serialization_ctxt = kwargs.get("serialization_ctxt", {}) serialized = {} @@ -971,7 +953,7 @@ def serialize_dict(self, attr, dict_type, **kwargs): return serialized - def serialize_object(self, attr, **kwargs): + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Serialize a generic object. This will be handled as a dictionary. If object passed in is not a basic type (str, int, float, dict, list) it will simply be @@ -979,6 +961,7 @@ def serialize_object(self, attr, **kwargs): :param dict attr: Object to be serialized. :rtype: dict or str + :return: serialized object """ if attr is None: return None @@ -1003,7 +986,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_decimal(attr) # If it's a model or I know this dependency, serialize as a Model - elif obj_type in self.dependencies.values() or isinstance(attr, Model): + if obj_type in self.dependencies.values() or isinstance(attr, Model): return self._serialize(attr) if obj_type == dict: @@ -1034,56 +1017,61 @@ def serialize_enum(attr, enum_obj=None): try: enum_obj(result) # type: ignore return result - except ValueError: + except ValueError as exc: for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) + raise SerializationError(error.format(attr, enum_obj)) from exc @staticmethod - def serialize_bytearray(attr, **kwargs): + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument """Serialize bytearray into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ return b64encode(attr).decode() @staticmethod - def serialize_base64(attr, **kwargs): + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument """Serialize str into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ encoded = b64encode(attr).decode("ascii") return encoded.strip("=").replace("+", "-").replace("/", "_") @staticmethod - def serialize_decimal(attr, **kwargs): + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument """Serialize Decimal object to float. - :param attr: Object to be serialized. + :param decimal attr: Object to be serialized. :rtype: float + :return: serialized decimal """ return float(attr) @staticmethod - def serialize_long(attr, **kwargs): + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument """Serialize long (Py2) or int (Py3). - :param attr: Object to be serialized. + :param int attr: Object to be serialized. :rtype: int/long + :return: serialized long """ return _long_type(attr) @staticmethod - def serialize_date(attr, **kwargs): + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument """Serialize Date object into ISO-8601 formatted string. :param Date attr: Object to be serialized. :rtype: str + :return: serialized date """ if isinstance(attr, str): attr = isodate.parse_date(attr) @@ -1091,11 +1079,12 @@ def serialize_date(attr, **kwargs): return t @staticmethod - def serialize_time(attr, **kwargs): + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument """Serialize Time object into ISO-8601 formatted string. :param datetime.time attr: Object to be serialized. :rtype: str + :return: serialized time """ if isinstance(attr, str): attr = isodate.parse_time(attr) @@ -1105,30 +1094,32 @@ def serialize_time(attr, **kwargs): return t @staticmethod - def serialize_duration(attr, **kwargs): + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument """Serialize TimeDelta object into ISO-8601 formatted string. :param TimeDelta attr: Object to be serialized. :rtype: str + :return: serialized duration """ if isinstance(attr, str): attr = isodate.parse_duration(attr) return isodate.duration_isoformat(attr) @staticmethod - def serialize_rfc(attr, **kwargs): + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into RFC-1123 formatted string. :param Datetime attr: Object to be serialized. :rtype: str - :raises: TypeError if format invalid. + :raises TypeError: if format invalid. + :return: serialized rfc """ try: if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() - except AttributeError: - raise TypeError("RFC1123 object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( Serializer.days[utc.tm_wday], @@ -1141,12 +1132,13 @@ def serialize_rfc(attr, **kwargs): ) @staticmethod - def serialize_iso(attr, **kwargs): + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into ISO-8601 formatted string. :param Datetime attr: Object to be serialized. :rtype: str - :raises: SerializationError if format invalid. + :raises SerializationError: if format invalid. + :return: serialized iso """ if isinstance(attr, str): attr = isodate.parse_datetime(attr) @@ -1172,13 +1164,14 @@ def serialize_iso(attr, **kwargs): raise TypeError(msg) from err @staticmethod - def serialize_unix(attr, **kwargs): + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into IntTime format. This is represented as seconds. :param Datetime attr: Object to be serialized. :rtype: int - :raises: SerializationError if format invalid + :raises SerializationError: if format invalid + :return: serialied unix """ if isinstance(attr, int): return attr @@ -1186,17 +1179,17 @@ def serialize_unix(attr, **kwargs): if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") return int(calendar.timegm(attr.utctimetuple())) - except AttributeError: - raise TypeError("Unix time object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc -def rest_key_extractor(attr, attr_desc, data): +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument key = attr_desc["key"] working_data = data while "." in key: # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(List[str], _FLATTEN.split(key)) + dict_keys = cast(list[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1211,7 +1204,9 @@ def rest_key_extractor(attr, attr_desc, data): return working_data.get(key) -def rest_key_case_insensitive_extractor(attr, attr_desc, data): +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): key = attr_desc["key"] working_data = data @@ -1232,17 +1227,29 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): return attribute_key_case_insensitive_extractor(key, None, working_data) -def last_rest_key_extractor(attr, attr_desc, data): - """Extract the attribute in "data" based on the last part of the JSON path key.""" +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) return attribute_key_extractor(dict_keys[-1], None, data) -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument """Extract the attribute in "data" based on the last part of the JSON path key. This is the case insensitive version of "last_rest_key_extractor" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) @@ -1279,7 +1286,7 @@ def _extract_name_from_internal_type(internal_type): return xml_name -def xml_key_extractor(attr, attr_desc, data): +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements if isinstance(data, dict): return None @@ -1331,22 +1338,21 @@ def xml_key_extractor(attr, attr_desc, data): if is_iter_type: if is_wrapped: return None # is_wrapped no node, we want None - else: - return [] # not wrapped, assume empty list + return [] # not wrapped, assume empty list return None # Assume it's not there, maybe an optional node. # If is_iter_type and not wrapped, return all found children if is_iter_type: if not is_wrapped: return children - else: # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) + # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name ) - return list(children[0]) # Might be empty list and that's ok. + ) + return list(children[0]) # Might be empty list and that's ok. # Here it's not a itertype, we should have found one element only or empty if len(children) > 1: @@ -1354,7 +1360,7 @@ def xml_key_extractor(attr, attr_desc, data): return children[0] -class Deserializer(object): +class Deserializer: """Response object model deserializer. :param dict classes: Class type dictionary for deserializing complex types. @@ -1363,9 +1369,9 @@ class Deserializer(object): basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - 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}]?") + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1385,7 +1391,7 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, type] = dict(classes) if classes else {} + self.dependencies: dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1401,27 +1407,29 @@ def __call__(self, target_obj, response_data, content_type=None): :param str target_obj: Target data type to deserialize to. :param requests.Response response_data: REST response object. :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: object """ data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) - def _deserialize(self, target_obj, data): + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements """Call the deserializer on a model. Data needs to be already deserialized as JSON or XML ElementTree :param str target_obj: Target data type to deserialize to. :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: object """ # This is already a model, go recursive just in case if hasattr(data, "_attribute_map"): constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] try: - for attr, mapconfig in data._attribute_map.items(): + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access if attr in constants: continue value = getattr(data, attr) @@ -1440,13 +1448,13 @@ def _deserialize(self, target_obj, data): if isinstance(response, str): return self.deserialize_data(data, response) - elif isinstance(response, type) and issubclass(response, Enum): + if isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) if data is None or data is CoreNull: return data try: - attributes = response._attribute_map # type: ignore + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1476,9 +1484,8 @@ def _deserialize(self, target_obj, data): except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore raise DeserializationError(msg) from err - else: - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) def _build_additional_properties(self, attribute_map, data): if not self.additional_properties_detection: @@ -1505,6 +1512,8 @@ def _classify_target(self, target, data): :param str target: The target object type to deserialize to. :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple """ if target is None: return None, None @@ -1516,7 +1525,7 @@ def _classify_target(self, target, data): return target, target try: - target = target._classify(data, self.dependencies) # type: ignore + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1531,10 +1540,12 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): :param str target_obj: The target object type to deserialize to. :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object """ try: return self(target_obj, data, content_type=content_type) - except: + except: # pylint: disable=bare-except _LOGGER.debug( "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) @@ -1552,10 +1563,12 @@ def _unpack_content(raw_data, content_type=None): If raw_data is something else, bypass all logic and return it directly. - :param raw_data: Data to be processed. - :param content_type: How to parse if raw_data is a string/bytes. + :param obj raw_data: Data to be processed. + :param str content_type: How to parse if raw_data is a string/bytes. :raises JSONDecodeError: If JSON is requested and parsing is impossible. :raises UnicodeDecodeError: If bytes is not UTF8 + :rtype: object + :return: Unpacked content. """ # Assume this is enough to detect a Pipeline Response without importing it context = getattr(raw_data, "context", {}) @@ -1579,24 +1592,35 @@ def _unpack_content(raw_data, content_type=None): def _instantiate_model(self, response, attrs, additional_properties=None): """Instantiate a response model passing in deserialized args. - :param response: The response model class. - :param d_attrs: The deserialized response attributes. + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. """ if callable(response): subtype = getattr(response, "_subtype_map", {}) try: - readonly = [k for k, v in response._validation.items() if v.get("readonly")] - const = [k for k, v in response._validation.items() if v.get("constant")] + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") + ] kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} response_obj = response(**kwargs) for attr in readonly: setattr(response_obj, attr, attrs.get(attr)) if additional_properties: - response_obj.additional_properties = additional_properties + response_obj.additional_properties = additional_properties # type: ignore return response_obj except TypeError as err: msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) + raise DeserializationError(msg + str(err)) from err else: try: for attr, value in attrs.items(): @@ -1605,15 +1629,16 @@ def _instantiate_model(self, response, attrs, additional_properties=None): except Exception as exp: msg = "Unable to populate response model. " msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) + raise DeserializationError(msg) from exp - def deserialize_data(self, data, data_type): + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements """Process data for deserialization according to data type. :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: object """ if data is None: return data @@ -1627,7 +1652,11 @@ def deserialize_data(self, data, data_type): if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): return data - is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "object", + "[]", + r"{}", + ] if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: return None data_val = self.deserialize_type[data_type](data) @@ -1647,14 +1676,14 @@ def deserialize_data(self, data, data_type): msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) raise DeserializationError(msg) from err - else: - return self._deserialize(obj_type, data) + return self._deserialize(obj_type, data) def deserialize_iter(self, attr, iter_type): """Deserialize an iterable. :param list attr: Iterable to be deserialized. :param str iter_type: The type of object in the iterable. + :return: Deserialized iterable. :rtype: list """ if attr is None: @@ -1671,6 +1700,7 @@ def deserialize_dict(self, attr, dict_type): :param dict/list attr: Dictionary to be deserialized. Also accepts a list of key, value pairs. :param str dict_type: The object type of the items in the dictionary. + :return: Deserialized dictionary. :rtype: dict """ if isinstance(attr, list): @@ -1681,13 +1711,14 @@ def deserialize_dict(self, attr, dict_type): attr = {el.tag: el.text for el in attr} return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - def deserialize_object(self, attr, **kwargs): + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Deserialize a generic object. This will be handled as a dictionary. :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. :rtype: dict - :raises: TypeError if non-builtin datatype encountered. + :raises TypeError: if non-builtin datatype encountered. """ if attr is None: return None @@ -1720,11 +1751,10 @@ def deserialize_object(self, attr, **kwargs): pass return deserialized - else: - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) - def deserialize_basic(self, attr, data_type): + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements """Deserialize basic builtin data type from string. Will attempt to convert to str, int, float and bool. This function will also accept '1', '0', 'true' and 'false' as @@ -1732,8 +1762,9 @@ def deserialize_basic(self, attr, data_type): :param str attr: response string to be deserialized. :param str data_type: deserialization data type. + :return: Deserialized basic type. :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. + :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1743,24 +1774,27 @@ def deserialize_basic(self, attr, data_type): if data_type == "str": # None or '', node is empty string. return "" - else: - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, str): + if isinstance(attr, str): if attr.lower() in ["true", "1"]: return True - elif attr.lower() in ["false", "0"]: + if attr.lower() in ["false", "0"]: return False raise TypeError("Invalid boolean value: {}".format(attr)) if data_type == "str": return self.deserialize_unicode(attr) - return eval(data_type)(attr) # nosec + if data_type == "int": + return int(attr) + if data_type == "float": + return float(attr) + raise TypeError("Unknown basic data type: {}".format(data_type)) @staticmethod def deserialize_unicode(data): @@ -1768,6 +1802,7 @@ def deserialize_unicode(data): as a string. :param str data: response string to be deserialized. + :return: Deserialized string. :rtype: str or unicode """ # We might be here because we have an enum modeled as string, @@ -1781,8 +1816,7 @@ def deserialize_unicode(data): return data except NameError: return str(data) - else: - return str(data) + return str(data) @staticmethod def deserialize_enum(data, enum_obj): @@ -1794,6 +1828,7 @@ def deserialize_enum(data, enum_obj): :param str data: Response string to be deserialized. If this value is None or invalid it will be returned as-is. :param Enum enum_obj: Enum object to deserialize to. + :return: Deserialized enum object. :rtype: Enum """ if isinstance(data, enum_obj) or data is None: @@ -1804,9 +1839,9 @@ def deserialize_enum(data, enum_obj): # Workaround. We might consider remove it in the future. try: return list(enum_obj.__members__.values())[data] - except IndexError: + except IndexError as exc: error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) + raise DeserializationError(error.format(data, enum_obj)) from exc try: return enum_obj(str(data)) except ValueError: @@ -1822,8 +1857,9 @@ def deserialize_bytearray(attr): """Deserialize string into bytearray. :param str attr: response string to be deserialized. + :return: Deserialized bytearray :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1834,8 +1870,9 @@ def deserialize_base64(attr): """Deserialize base64 encoded string into string. :param str attr: response string to be deserialized. + :return: Deserialized base64 string :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1849,8 +1886,9 @@ def deserialize_decimal(attr): """Deserialize string into Decimal object. :param str attr: response string to be deserialized. - :rtype: Decimal - :raises: DeserializationError if string format invalid. + :return: Deserialized decimal + :raises DeserializationError: if string format invalid. + :rtype: decimal """ if isinstance(attr, ET.Element): attr = attr.text @@ -1865,8 +1903,9 @@ def deserialize_long(attr): """Deserialize string into long (Py2) or int (Py3). :param str attr: response string to be deserialized. + :return: Deserialized int :rtype: long or int - :raises: ValueError if string format invalid. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1877,8 +1916,9 @@ def deserialize_duration(attr): """Deserialize ISO-8601 formatted string into TimeDelta object. :param str attr: response string to be deserialized. + :return: Deserialized duration :rtype: TimeDelta - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1887,16 +1927,16 @@ def deserialize_duration(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." raise DeserializationError(msg) from err - else: - return duration + return duration @staticmethod def deserialize_date(attr): """Deserialize ISO-8601 formatted string into Date object. :param str attr: response string to be deserialized. + :return: Deserialized date :rtype: Date - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1910,8 +1950,9 @@ def deserialize_time(attr): """Deserialize ISO-8601 formatted string into time object. :param str attr: response string to be deserialized. + :return: Deserialized time :rtype: datetime.time - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1924,31 +1965,32 @@ def deserialize_rfc(attr): """Deserialize RFC-1123 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text try: parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) except ValueError as err: msg = "Cannot deserialize to rfc datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_iso(attr): """Deserialize ISO-8601 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1976,8 +2018,7 @@ def deserialize_iso(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_unix(attr): @@ -1985,8 +2026,9 @@ def deserialize_unix(attr): This is represented as seconds. :param int attr: Object to be serialized. + :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :raises DeserializationError: if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore @@ -1996,5 +2038,4 @@ def deserialize_unix(attr): except ValueError as err: msg = "Cannot deserialize to unix datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj 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 48944bf3938a..cac9f5d10f8b 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_version.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "3.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 b06f0016da77..85bf1858da3e 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 @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._azure_red_hat_open_shift_client import AzureRedHatOpenShiftClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._azure_red_hat_open_shift_client import AzureRedHatOpenShiftClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "AzureRedHatOpenShiftClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _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 4862d11c40cd..a5d9343bae58 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 @@ -7,33 +7,33 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models -from .._serialization import Deserializer, Serializer +from .._utils.serialization import Deserializer, Serializer from ._configuration import AzureRedHatOpenShiftClientConfiguration from .operations import ( - MachinePoolsOperations, OpenShiftClustersOperations, OpenShiftVersionsOperations, Operations, - SecretsOperations, - SyncIdentityProvidersOperations, - SyncSetsOperations, + PlatformWorkloadIdentityRoleSetOperations, + PlatformWorkloadIdentityRoleSetsOperations, ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports + from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential -class AzureRedHatOpenShiftClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class AzureRedHatOpenShiftClient: """Rest API for Azure Red Hat OpenShift 4. :ivar operations: Operations operations @@ -41,25 +41,26 @@ class AzureRedHatOpenShiftClient: # pylint: disable=client-accepts-api-version- :ivar open_shift_versions: OpenShiftVersionsOperations operations :vartype open_shift_versions: azure.mgmt.redhatopenshift.aio.operations.OpenShiftVersionsOperations + :ivar platform_workload_identity_role_sets: PlatformWorkloadIdentityRoleSetsOperations + operations + :vartype platform_workload_identity_role_sets: + azure.mgmt.redhatopenshift.aio.operations.PlatformWorkloadIdentityRoleSetsOperations + :ivar platform_workload_identity_role_set: PlatformWorkloadIdentityRoleSetOperations operations + :vartype platform_workload_identity_role_set: + azure.mgmt.redhatopenshift.aio.operations.PlatformWorkloadIdentityRoleSetOperations :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. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str - :keyword api_version: Api Version. Default value is "2023-11-22". Note that overriding this + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2025-07-25". 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 @@ -70,12 +71,24 @@ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = AzureRedHatOpenShiftClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, + subscription_id=subscription_id, + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -94,7 +107,9 @@ def __init__( 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) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, 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) @@ -104,15 +119,15 @@ def __init__( self.open_shift_versions = OpenShiftVersionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.open_shift_clusters = OpenShiftClustersOperations( + self.platform_workload_identity_role_sets = PlatformWorkloadIdentityRoleSetsOperations( 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.platform_workload_identity_role_set = PlatformWorkloadIdentityRoleSetOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.open_shift_clusters = OpenShiftClustersOperations( 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 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 f3376438bb0e..90b8b8df5001 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 @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy @@ -14,11 +14,11 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports + from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential -class AzureRedHatOpenShiftClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class AzureRedHatOpenShiftClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for AzureRedHatOpenShiftClient. Note that all parameters used to create this instance are saved as instance @@ -26,15 +26,24 @@ class AzureRedHatOpenShiftClientConfiguration: # pylint: disable=too-many-insta :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. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-11-22". Note that overriding this + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2025-07-25". 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") + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2025-07-25") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -43,6 +52,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k self.credential = credential self.subscription_id = subscription_id + self.cloud_setting = cloud_setting 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)) diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/__init__.py index f03257fe6903..0940c895da8b 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/__init__.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/__init__.py @@ -5,27 +5,29 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -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 typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._open_shift_versions_operations import OpenShiftVersionsOperations # type: ignore +from ._platform_workload_identity_role_sets_operations import PlatformWorkloadIdentityRoleSetsOperations # type: ignore +from ._platform_workload_identity_role_set_operations import PlatformWorkloadIdentityRoleSetOperations # type: ignore +from ._open_shift_clusters_operations import OpenShiftClustersOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ "Operations", "OpenShiftVersionsOperations", + "PlatformWorkloadIdentityRoleSetsOperations", + "PlatformWorkloadIdentityRoleSetOperations", "OpenShiftClustersOperations", - "MachinePoolsOperations", - "SecretsOperations", - "SyncIdentityProvidersOperations", - "SyncSetsOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_machine_pools_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_machine_pools_operations.py deleted file mode 100644 index 6f7a5a2d00f2..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_machine_pools_operations.py +++ /dev/null @@ -1,562 +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.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") - - @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.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._config.api_version)) - 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._config.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.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._config.api_version)) - 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.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.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.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.models.MachinePool or IO[bytes] - :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.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._config.api_version)) - 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) - - 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._config.api_version)) - 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.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.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.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.models.MachinePoolUpdate or IO[bytes] - :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.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._config.api_version)) - 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/aio/operations/_open_shift_clusters_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_open_shift_clusters_operations.py index 79143236e115..76b4d1979c8e 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_open_shift_clusters_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_open_shift_clusters_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +32,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._open_shift_clusters_operations import ( build_create_or_update_request, build_delete_request, @@ -42,13 +43,11 @@ build_list_request, build_update_request, ) +from .._configuration import AzureRedHatOpenShiftClientConfiguration -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]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class OpenShiftClustersOperations: @@ -65,13 +64,15 @@ class OpenShiftClustersOperations: 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._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AzureRedHatOpenShiftClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.OpenShiftCluster"]: + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.OpenShiftCluster"]: """Lists OpenShift clusters in the specified subscription. The operation returns properties of each OpenShift cluster. @@ -87,7 +88,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.OpenShiftCluster"]: 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]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -150,7 +151,7 @@ async def get_next(next_link=None): @distributed_trace def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.OpenShiftCluster"]: + ) -> AsyncItemPaged["_models.OpenShiftCluster"]: """Lists OpenShift clusters in the specified subscription and resource group. The operation returns properties of each OpenShift cluster. @@ -169,7 +170,7 @@ def list_by_resource_group( 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]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -245,7 +246,7 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) :rtype: ~azure.mgmt.redhatopenshift.models.OpenShiftCluster :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -294,7 +295,7 @@ async def _create_or_update_initial( parameters: Union[_models.OpenShiftCluster, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -491,7 +492,7 @@ def get_long_running_output(pipeline_response): async def _delete_initial( self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -600,7 +601,7 @@ async def _update_initial( parameters: Union[_models.OpenShiftClusterUpdate, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -669,7 +670,8 @@ async def begin_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Updates a OpenShift cluster with the specified subscription, resource group and resource name. + """Creates or updates a OpenShift cluster with the specified subscription, resource group and + resource name. The operation returns properties of a OpenShift cluster. @@ -699,7 +701,8 @@ async def begin_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Updates a OpenShift cluster with the specified subscription, resource group and resource name. + """Creates or updates a OpenShift cluster with the specified subscription, resource group and + resource name. The operation returns properties of a OpenShift cluster. @@ -727,7 +730,8 @@ async def begin_update( parameters: Union[_models.OpenShiftClusterUpdate, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.OpenShiftCluster]: - """Updates a OpenShift cluster with the specified subscription, resource group and resource name. + """Creates or updates a OpenShift cluster with the specified subscription, resource group and + resource name. The operation returns properties of a OpenShift cluster. @@ -809,7 +813,7 @@ async def list_admin_credentials( :rtype: ~azure.mgmt.redhatopenshift.models.OpenShiftClusterAdminKubeconfig :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -869,7 +873,7 @@ async def list_credentials( :rtype: ~azure.mgmt.redhatopenshift.models.OpenShiftClusterCredentials :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_open_shift_versions_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_open_shift_versions_operations.py index 14ef60644f08..cd89c27619d9 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_open_shift_versions_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_open_shift_versions_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # 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 +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -22,18 +22,18 @@ 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._open_shift_versions_operations import build_list_request +from ..._utils.serialization import Deserializer, Serializer +from ...operations._open_shift_versions_operations import build_get_request, build_list_request +from .._configuration import AzureRedHatOpenShiftClientConfiguration -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]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class OpenShiftVersionsOperations: @@ -50,18 +50,20 @@ class OpenShiftVersionsOperations: 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._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AzureRedHatOpenShiftClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.OpenShiftVersion"]: + def list(self, location: str, **kwargs: Any) -> AsyncItemPaged["_models.OpenShiftVersion"]: """Lists all OpenShift versions available to install in the specified location. - The operation returns the installable OpenShift versions as strings. + The operation returns the installable OpenShift versions as a string. - :param location: The name of Azure region. Required. + :param location: The name of the Azure region. Required. :type location: str :return: An iterator like instance of either OpenShiftVersion or the result of cls(response) :rtype: @@ -74,7 +76,7 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.OpenShift 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]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -134,3 +136,60 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get(self, location: str, open_shift_version: str, **kwargs: Any) -> _models.OpenShiftVersion: + """Gets an available OpenShift version to install in the specified location. + + This operation returns installable OpenShift version as a string. + + :param location: The name of the Azure region. Required. + :type location: str + :param open_shift_version: The desired version value of the OpenShiftVersion resource. + Required. + :type open_shift_version: str + :return: OpenShiftVersion or the result of cls(response) + :rtype: ~azure.mgmt.redhatopenshift.models.OpenShiftVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OpenShiftVersion] = kwargs.pop("cls", None) + + _request = build_get_request( + location=location, + open_shift_version=open_shift_version, + 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("OpenShiftVersion", 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/aio/operations/_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_operations.py index 37358486a661..dd6d8eacd573 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # 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 +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,14 +26,13 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._operations import build_list_request +from .._configuration import AzureRedHatOpenShiftClientConfiguration -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]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class Operations: @@ -50,13 +49,15 @@ class Operations: 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._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AzureRedHatOpenShiftClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Operation"]: """Lists all of the available RP operations. The operation returns the RP operations. @@ -71,7 +72,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: 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]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_platform_workload_identity_role_set_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_platform_workload_identity_role_set_operations.py new file mode 100644 index 000000000000..37a4ad4039cb --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_platform_workload_identity_role_set_operations.py @@ -0,0 +1,115 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar + +from azure.core import AsyncPipelineClient +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_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 ..._utils.serialization import Deserializer, Serializer +from ...operations._platform_workload_identity_role_set_operations import build_get_request +from .._configuration import AzureRedHatOpenShiftClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list + + +class PlatformWorkloadIdentityRoleSetOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.redhatopenshift.aio.AzureRedHatOpenShiftClient`'s + :attr:`platform_workload_identity_role_set` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AzureRedHatOpenShiftClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, location: str, open_shift_minor_version: str, **kwargs: Any + ) -> _models.PlatformWorkloadIdentityRoleSet: + """Gets a mapping of an OpenShift version to identity requirements, which includes operatorName, + roleDefinitionName, roleDefinitionId, and serviceAccounts. + + This operation returns Platform Workload Identity Role Set as a string. + + :param location: The name of the Azure region. Required. + :type location: str + :param open_shift_minor_version: The desired version value of the + PlatformWorkloadIdentityRoleSet resource. Required. + :type open_shift_minor_version: str + :return: PlatformWorkloadIdentityRoleSet or the result of cls(response) + :rtype: ~azure.mgmt.redhatopenshift.models.PlatformWorkloadIdentityRoleSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PlatformWorkloadIdentityRoleSet] = kwargs.pop("cls", None) + + _request = build_get_request( + location=location, + open_shift_minor_version=open_shift_minor_version, + 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("PlatformWorkloadIdentityRoleSet", 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/aio/operations/_platform_workload_identity_role_sets_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_platform_workload_identity_role_sets_operations.py new file mode 100644 index 000000000000..fe962d4d0921 --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_platform_workload_identity_role_sets_operations.py @@ -0,0 +1,139 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar +import urllib.parse + +from azure.core import AsyncPipelineClient +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 ..._utils.serialization import Deserializer, Serializer +from ...operations._platform_workload_identity_role_sets_operations import build_list_request +from .._configuration import AzureRedHatOpenShiftClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list + + +class PlatformWorkloadIdentityRoleSetsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.redhatopenshift.aio.AzureRedHatOpenShiftClient`'s + :attr:`platform_workload_identity_role_sets` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AzureRedHatOpenShiftClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, location: str, **kwargs: Any) -> AsyncItemPaged["_models.PlatformWorkloadIdentityRoleSet"]: + """Lists a mapping of OpenShift versions to identity requirements, which include operatorName, + roleDefinitionName, roleDefinitionId, and serviceAccounts. + + This operation returns a list of Platform Workload Identity Role Sets as a string. + + :param location: The name of the Azure region. Required. + :type location: str + :return: An iterator like instance of either PlatformWorkloadIdentityRoleSet or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.models.PlatformWorkloadIdentityRoleSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PlatformWorkloadIdentityRoleSetList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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._config.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("PlatformWorkloadIdentityRoleSetList", 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/aio/operations/_secrets_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_secrets_operations.py deleted file mode 100644 index a89e55a7aa24..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_secrets_operations.py +++ /dev/null @@ -1,558 +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.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") - - @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.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._config.api_version)) - 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._config.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.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._config.api_version)) - 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.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.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.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.models.Secret or IO[bytes] - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.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._config.api_version)) - 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) - - 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._config.api_version)) - 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.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.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.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.models.SecretUpdate or IO[bytes] - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.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._config.api_version)) - 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/aio/operations/_sync_identity_providers_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_sync_identity_providers_operations.py deleted file mode 100644 index c0073ae25f44..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_sync_identity_providers_operations.py +++ /dev/null @@ -1,570 +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.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") - - @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.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._config.api_version)) - 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._config.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.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._config.api_version)) - 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.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.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.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.models.SyncIdentityProvider or IO[bytes] - :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.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._config.api_version)) - 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) - - 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._config.api_version)) - 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.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.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.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.models.SyncIdentityProviderUpdate or IO[bytes] - :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.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._config.api_version)) - 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/aio/operations/_sync_sets_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_sync_sets_operations.py deleted file mode 100644 index 4341fbe9b590..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/aio/operations/_sync_sets_operations.py +++ /dev/null @@ -1,559 +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.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") - - @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.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._config.api_version)) - 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._config.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.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._config.api_version)) - 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.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.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.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.models.SyncSet or IO[bytes] - :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.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._config.api_version)) - 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) - - 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._config.api_version)) - 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.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.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.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.models.SyncSetUpdate or IO[bytes] - :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.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._config.api_version)) - 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/models/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/models/__init__.py index ac29f6814737..6cbbe32480fc 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/models/__init__.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/models/__init__.py @@ -5,55 +5,62 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -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 EffectiveOutboundIP -from ._models_py3 import IngressProfile -from ._models_py3 import LoadBalancerProfile -from ._models_py3 import MachinePool -from ._models_py3 import MachinePoolList -from ._models_py3 import MachinePoolUpdate -from ._models_py3 import ManagedOutboundIPs -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 typing import TYPE_CHECKING -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 +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + APIServerProfile, + CloudErrorBody, + ClusterProfile, + ConsoleProfile, + Display, + EffectiveOutboundIP, + IngressProfile, + LoadBalancerProfile, + ManagedOutboundIPs, + ManagedServiceIdentity, + MasterProfile, + NetworkProfile, + OpenShiftCluster, + OpenShiftClusterAdminKubeconfig, + OpenShiftClusterCredentials, + OpenShiftClusterList, + OpenShiftClusterUpdate, + OpenShiftVersion, + OpenShiftVersionList, + Operation, + OperationList, + PlatformWorkloadIdentity, + PlatformWorkloadIdentityProfile, + PlatformWorkloadIdentityRole, + PlatformWorkloadIdentityRoleSet, + PlatformWorkloadIdentityRoleSetList, + ProxyResource, + Resource, + ServicePrincipalProfile, + SystemData, + TrackedResource, + UserAssignedIdentity, + WorkerProfile, +) + +from ._azure_red_hat_open_shift_client_enums import ( # type: ignore + CreatedByType, + EncryptionAtHost, + FipsValidatedModules, + ManagedServiceIdentityType, + OutboundType, + PreconfiguredNSG, + ProvisioningState, + Visibility, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -65,10 +72,8 @@ "EffectiveOutboundIP", "IngressProfile", "LoadBalancerProfile", - "MachinePool", - "MachinePoolList", - "MachinePoolUpdate", "ManagedOutboundIPs", + "ManagedServiceIdentity", "MasterProfile", "NetworkProfile", "OpenShiftCluster", @@ -80,28 +85,26 @@ "OpenShiftVersionList", "Operation", "OperationList", + "PlatformWorkloadIdentity", + "PlatformWorkloadIdentityProfile", + "PlatformWorkloadIdentityRole", + "PlatformWorkloadIdentityRoleSet", + "PlatformWorkloadIdentityRoleSetList", "ProxyResource", "Resource", - "Secret", - "SecretList", - "SecretUpdate", "ServicePrincipalProfile", - "SyncIdentityProvider", - "SyncIdentityProviderList", - "SyncIdentityProviderUpdate", - "SyncSet", - "SyncSetList", - "SyncSetUpdate", "SystemData", "TrackedResource", + "UserAssignedIdentity", "WorkerProfile", "CreatedByType", "EncryptionAtHost", "FipsValidatedModules", + "ManagedServiceIdentityType", "OutboundType", "PreconfiguredNSG", "ProvisioningState", "Visibility", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/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 index 8be2edf2fdb5..30d9f182f79c 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/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 @@ -33,6 +33,17 @@ class FipsValidatedModules(str, Enum, metaclass=CaseInsensitiveEnumMeta): ENABLED = "Enabled" +class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of managed service identity (where both SystemAssigned and UserAssigned types are + allowed). + """ + + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" + + class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The outbound routing strategy used to provide your cluster egress to the internet.""" diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/models/_models_py3.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/models/_models_py3.py index 5e301305ffac..ccd330b6b6e6 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/models/_models_py3.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/models/_models_py3.py @@ -1,5 +1,5 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines # 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. @@ -8,12 +8,11 @@ # -------------------------------------------------------------------------- import datetime -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Optional, TYPE_CHECKING, Union -from .. import _serialization +from .._utils import serialization as _serialization if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models @@ -48,8 +47,8 @@ def __init__(self, *, visibility: Optional[Union[str, "_models.Visibility"]] = N """ super().__init__(**kwargs) self.visibility = visibility - self.url = None - self.ip = None + self.url: Optional[str] = None + self.ip: Optional[str] = None class CloudErrorBody(_serialization.Model): @@ -81,7 +80,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["_models.CloudErrorBody"]] = None, + details: Optional[list["_models.CloudErrorBody"]] = None, **kwargs: Any ) -> None: """ @@ -107,6 +106,8 @@ def __init__( class ClusterProfile(_serialization.Model): """ClusterProfile represents a cluster profile. + Variables are only populated by the server, and will be ignored when sending a request. + :ivar pull_secret: The pull secret for the cluster. :vartype pull_secret: str :ivar domain: The domain for the cluster. @@ -118,14 +119,21 @@ class ClusterProfile(_serialization.Model): :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.models.FipsValidatedModules + :ivar oidc_issuer: The URL of the managed OIDC issuer in a workload identity cluster. + :vartype oidc_issuer: str """ + _validation = { + "oidc_issuer": {"readonly": True}, + } + _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"}, + "oidc_issuer": {"key": "oidcIssuer", "type": "str"}, } def __init__( @@ -158,6 +166,7 @@ def __init__( self.version = version self.resource_group_id = resource_group_id self.fips_validated_modules = fips_validated_modules + self.oidc_issuer: Optional[str] = None class ConsoleProfile(_serialization.Model): @@ -180,7 +189,7 @@ class ConsoleProfile(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.url = None + self.url: Optional[str] = None class Display(_serialization.Model): @@ -289,7 +298,7 @@ def __init__( super().__init__(**kwargs) self.name = name self.visibility = visibility - self.ip = None + self.ip: Optional[str] = None class LoadBalancerProfile(_serialization.Model): @@ -322,195 +331,96 @@ def __init__(self, *, managed_outbound_ips: Optional["_models.ManagedOutboundIPs """ super().__init__(**kwargs) self.managed_outbound_ips = managed_outbound_ips - self.effective_outbound_ips = None + self.effective_outbound_ips: Optional[list["_models.EffectiveOutboundIP"]] = None -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. +class ManagedOutboundIPs(_serialization.Model): + """ManagedOutboundIPs represents the desired managed outbound IPs for the cluster public load + balancer. - :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.models.SystemData + :ivar count: Count represents the desired number of IPv4 outbound IPs created and managed by + Azure for the cluster public load balancer. Allowed values are in the range of 1 - 20. The + default value is 1. + :vartype count: int """ - _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"}, + "count": {"key": "count", "type": "int"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__(self, *, count: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword count: Count represents the desired number of IPv4 outbound IPs created and managed by + Azure for the cluster public load balancer. Allowed values are in the range of 1 - 20. The + default value is 1. + :paramtype count: int + """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None + self.count = count -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have - tags and a location. +class ManagedServiceIdentity(_serialization.Model): + """Managed service identity (system assigned and/or user assigned identities). Variables are only populated by the server, and will be ignored when sending a request. - :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.models.SystemData - """ - - -class MachinePool(ProxyResource): - """MachinePool represents a MachinePool. - - 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.models.SystemData - :ivar resources: - :vartype resources: str + :ivar principal_id: The service principal ID of the system assigned identity. This property + will only be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types + are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and + "SystemAssigned,UserAssigned". + :vartype type: str or ~azure.mgmt.redhatopenshift.models.ManagedServiceIdentityType + :ivar user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.redhatopenshift.models.UserAssignedIdentity] """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, + "type": {"required": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "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.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"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, } def __init__( - self, *, value: Optional[List["_models.MachinePool"]] = None, next_link: Optional[str] = None, **kwargs: Any + self, + *, + type: Union[str, "_models.ManagedServiceIdentityType"], + user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentity"]] = None, + **kwargs: Any ) -> None: """ - :keyword value: The list of Machine Pools. - :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 + :keyword type: Type of managed service identity (where both SystemAssigned and UserAssigned + types are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and + "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.redhatopenshift.models.ManagedServiceIdentityType + :keyword user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.redhatopenshift.models.UserAssignedIdentity] """ 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.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 ManagedOutboundIPs(_serialization.Model): - """ManagedOutboundIPs represents the desired managed outbound IPs for the cluster public load - balancer. - - :ivar count: Count represents the desired number of IPv4 outbound IPs created and managed by - Azure for the cluster public load balancer. Allowed values are in the range of 1 - 20. The - default value is 1. - :vartype count: int - """ - - _attribute_map = { - "count": {"key": "count", "type": "int"}, - } - - def __init__(self, *, count: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword count: Count represents the desired number of IPv4 outbound IPs created and managed by - Azure for the cluster public load balancer. Allowed values are in the range of 1 - 20. The - default value is 1. - :paramtype count: int - """ - super().__init__(**kwargs) - self.count = count + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None + self.type = type + self.user_assigned_identities = user_assigned_identities class MasterProfile(_serialization.Model): @@ -620,6 +530,47 @@ def __init__( self.preconfigured_nsg = preconfigured_nsg +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. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :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.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: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.system_data: Optional["_models.SystemData"] = None + + class TrackedResource(Resource): """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. @@ -628,8 +579,8 @@ class TrackedResource(Resource): 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 + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -662,7 +613,7 @@ class TrackedResource(Resource): "location": {"key": "location", "type": "str"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + def __init__(self, *, location: str, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -674,15 +625,15 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.location = location -class OpenShiftCluster(TrackedResource): # pylint: disable=too-many-instance-attributes +class OpenShiftCluster(TrackedResource): """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 + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -696,6 +647,9 @@ class OpenShiftCluster(TrackedResource): # pylint: disable=too-many-instance-at :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. :vartype location: str + :ivar identity: Identity stores information about the cluster MSI(s) in a workload identity + cluster. + :vartype identity: ~azure.mgmt.redhatopenshift.models.ManagedServiceIdentity :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.models.ProvisioningState @@ -705,6 +659,9 @@ class OpenShiftCluster(TrackedResource): # pylint: disable=too-many-instance-at :vartype console_profile: ~azure.mgmt.redhatopenshift.models.ConsoleProfile :ivar service_principal_profile: The cluster service principal profile. :vartype service_principal_profile: ~azure.mgmt.redhatopenshift.models.ServicePrincipalProfile + :ivar platform_workload_identity_profile: The workload identity profile. + :vartype platform_workload_identity_profile: + ~azure.mgmt.redhatopenshift.models.PlatformWorkloadIdentityProfile :ivar network_profile: The cluster network profile. :vartype network_profile: ~azure.mgmt.redhatopenshift.models.NetworkProfile :ivar master_profile: The cluster master profile. @@ -735,10 +692,15 @@ class OpenShiftCluster(TrackedResource): # pylint: disable=too-many-instance-at "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "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"}, + "platform_workload_identity_profile": { + "key": "properties.platformWorkloadIdentityProfile", + "type": "PlatformWorkloadIdentityProfile", + }, "network_profile": {"key": "properties.networkProfile", "type": "NetworkProfile"}, "master_profile": {"key": "properties.masterProfile", "type": "MasterProfile"}, "worker_profiles": {"key": "properties.workerProfiles", "type": "[WorkerProfile]"}, @@ -751,16 +713,18 @@ def __init__( self, *, location: str, - tags: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = 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, + platform_workload_identity_profile: Optional["_models.PlatformWorkloadIdentityProfile"] = None, network_profile: Optional["_models.NetworkProfile"] = None, master_profile: Optional["_models.MasterProfile"] = None, - worker_profiles: Optional[List["_models.WorkerProfile"]] = None, + worker_profiles: Optional[list["_models.WorkerProfile"]] = None, apiserver_profile: Optional["_models.APIServerProfile"] = None, - ingress_profiles: Optional[List["_models.IngressProfile"]] = None, + ingress_profiles: Optional[list["_models.IngressProfile"]] = None, **kwargs: Any ) -> None: """ @@ -768,6 +732,9 @@ def __init__( :paramtype tags: dict[str, str] :keyword location: The geo-location where the resource lives. Required. :paramtype location: str + :keyword identity: Identity stores information about the cluster MSI(s) in a workload identity + cluster. + :paramtype identity: ~azure.mgmt.redhatopenshift.models.ManagedServiceIdentity :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.models.ProvisioningState @@ -778,6 +745,9 @@ def __init__( :keyword service_principal_profile: The cluster service principal profile. :paramtype service_principal_profile: ~azure.mgmt.redhatopenshift.models.ServicePrincipalProfile + :keyword platform_workload_identity_profile: The workload identity profile. + :paramtype platform_workload_identity_profile: + ~azure.mgmt.redhatopenshift.models.PlatformWorkloadIdentityProfile :keyword network_profile: The cluster network profile. :paramtype network_profile: ~azure.mgmt.redhatopenshift.models.NetworkProfile :keyword master_profile: The cluster master profile. @@ -790,14 +760,16 @@ def __init__( :paramtype ingress_profiles: list[~azure.mgmt.redhatopenshift.models.IngressProfile] """ super().__init__(tags=tags, location=location, **kwargs) + self.identity = identity self.provisioning_state = provisioning_state self.cluster_profile = cluster_profile self.console_profile = console_profile self.service_principal_profile = service_principal_profile + self.platform_workload_identity_profile = platform_workload_identity_profile self.network_profile = network_profile self.master_profile = master_profile self.worker_profiles = worker_profiles - self.worker_profiles_status = None + self.worker_profiles_status: Optional[list["_models.WorkerProfile"]] = None self.apiserver_profile = apiserver_profile self.ingress_profiles = ingress_profiles @@ -867,7 +839,7 @@ class OpenShiftClusterList(_serialization.Model): def __init__( self, *, - value: Optional[List["_models.OpenShiftCluster"]] = None, + value: Optional[list["_models.OpenShiftCluster"]] = None, next_link: Optional[str] = None, **kwargs: Any ) -> None: @@ -882,15 +854,16 @@ def __init__( self.next_link = next_link -class OpenShiftClusterUpdate(_serialization.Model): # pylint: disable=too-many-instance-attributes +class OpenShiftClusterUpdate(_serialization.Model): """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.models.SystemData + :ivar identity: Identity stores information about the cluster MSI(s) in a workload identity + cluster. + :vartype identity: ~azure.mgmt.redhatopenshift.models.ManagedServiceIdentity :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.models.ProvisioningState @@ -900,6 +873,9 @@ class OpenShiftClusterUpdate(_serialization.Model): # pylint: disable=too-many- :vartype console_profile: ~azure.mgmt.redhatopenshift.models.ConsoleProfile :ivar service_principal_profile: The cluster service principal profile. :vartype service_principal_profile: ~azure.mgmt.redhatopenshift.models.ServicePrincipalProfile + :ivar platform_workload_identity_profile: The workload identity profile. + :vartype platform_workload_identity_profile: + ~azure.mgmt.redhatopenshift.models.PlatformWorkloadIdentityProfile :ivar network_profile: The cluster network profile. :vartype network_profile: ~azure.mgmt.redhatopenshift.models.NetworkProfile :ivar master_profile: The cluster master profile. @@ -915,17 +891,20 @@ class OpenShiftClusterUpdate(_serialization.Model): # pylint: disable=too-many- """ _validation = { - "system_data": {"readonly": True}, "worker_profiles_status": {"readonly": True}, } _attribute_map = { "tags": {"key": "tags", "type": "{str}"}, - "system_data": {"key": "systemData", "type": "SystemData"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "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"}, + "platform_workload_identity_profile": { + "key": "properties.platformWorkloadIdentityProfile", + "type": "PlatformWorkloadIdentityProfile", + }, "network_profile": {"key": "properties.networkProfile", "type": "NetworkProfile"}, "master_profile": {"key": "properties.masterProfile", "type": "MasterProfile"}, "worker_profiles": {"key": "properties.workerProfiles", "type": "[WorkerProfile]"}, @@ -937,21 +916,26 @@ class OpenShiftClusterUpdate(_serialization.Model): # pylint: disable=too-many- def __init__( self, *, - tags: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = 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, + platform_workload_identity_profile: Optional["_models.PlatformWorkloadIdentityProfile"] = None, network_profile: Optional["_models.NetworkProfile"] = None, master_profile: Optional["_models.MasterProfile"] = None, - worker_profiles: Optional[List["_models.WorkerProfile"]] = None, + worker_profiles: Optional[list["_models.WorkerProfile"]] = None, apiserver_profile: Optional["_models.APIServerProfile"] = None, - ingress_profiles: Optional[List["_models.IngressProfile"]] = None, + ingress_profiles: Optional[list["_models.IngressProfile"]] = None, **kwargs: Any ) -> None: """ :keyword tags: The resource tags. :paramtype tags: dict[str, str] + :keyword identity: Identity stores information about the cluster MSI(s) in a workload identity + cluster. + :paramtype identity: ~azure.mgmt.redhatopenshift.models.ManagedServiceIdentity :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.models.ProvisioningState @@ -962,6 +946,9 @@ def __init__( :keyword service_principal_profile: The cluster service principal profile. :paramtype service_principal_profile: ~azure.mgmt.redhatopenshift.models.ServicePrincipalProfile + :keyword platform_workload_identity_profile: The workload identity profile. + :paramtype platform_workload_identity_profile: + ~azure.mgmt.redhatopenshift.models.PlatformWorkloadIdentityProfile :keyword network_profile: The cluster network profile. :paramtype network_profile: ~azure.mgmt.redhatopenshift.models.NetworkProfile :keyword master_profile: The cluster master profile. @@ -975,26 +962,47 @@ def __init__( """ super().__init__(**kwargs) self.tags = tags - self.system_data = None + self.identity = identity self.provisioning_state = provisioning_state self.cluster_profile = cluster_profile self.console_profile = console_profile self.service_principal_profile = service_principal_profile + self.platform_workload_identity_profile = platform_workload_identity_profile self.network_profile = network_profile self.master_profile = master_profile self.worker_profiles = worker_profiles - self.worker_profiles_status = None + self.worker_profiles_status: Optional[list["_models.WorkerProfile"]] = None self.apiserver_profile = apiserver_profile self.ingress_profiles = ingress_profiles +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. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :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.models.SystemData + """ + + 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 + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1049,7 +1057,7 @@ class OpenShiftVersionList(_serialization.Model): def __init__( self, *, - value: Optional[List["_models.OpenShiftVersion"]] = None, + value: Optional[list["_models.OpenShiftVersion"]] = None, next_link: Optional[str] = None, **kwargs: Any ) -> None: @@ -1120,7 +1128,7 @@ class OperationList(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + 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. @@ -1133,247 +1141,128 @@ def __init__( self.next_link = next_link -class Secret(ProxyResource): - """Secret represents a secret. +class PlatformWorkloadIdentity(_serialization.Model): + """PlatformWorkloadIdentity stores information representing a single workload identity. 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.models.SystemData - :ivar secret_resources: The Secrets Resources. - :vartype secret_resources: str + :ivar resource_id: The resource ID of the PlatformWorkloadIdentity resource. + :vartype resource_id: str + :ivar client_id: The ClientID of the PlatformWorkloadIdentity resource. + :vartype client_id: str + :ivar object_id: The ObjectID of the PlatformWorkloadIdentity resource. + :vartype object_id: str """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, + "client_id": {"readonly": True}, + "object_id": {"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"}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } - def __init__(self, *, secret_resources: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, resource_id: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword secret_resources: The Secrets Resources. - :paramtype secret_resources: str + :keyword resource_id: The resource ID of the PlatformWorkloadIdentity resource. + :paramtype resource_id: str """ super().__init__(**kwargs) - self.secret_resources = secret_resources + self.resource_id = resource_id + self.client_id: Optional[str] = None + self.object_id: Optional[str] = None -class SecretList(_serialization.Model): - """SecretList represents a list of Secrets. +class PlatformWorkloadIdentityProfile(_serialization.Model): + """PlatformWorkloadIdentityProfile encapsulates all information that is specific to workload + identity clusters. - :ivar value: The list of secrets. - :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 + :ivar upgradeable_to: UpgradeableTo stores a single OpenShift version a workload identity + cluster can be upgraded to. + :vartype upgradeable_to: str + :ivar platform_workload_identities: Dictionary of :code:``. + :vartype platform_workload_identities: dict[str, + ~azure.mgmt.redhatopenshift.models.PlatformWorkloadIdentity] """ _attribute_map = { - "value": {"key": "value", "type": "[Secret]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "upgradeable_to": {"key": "upgradeableTo", "type": "str"}, + "platform_workload_identities": {"key": "platformWorkloadIdentities", "type": "{PlatformWorkloadIdentity}"}, } def __init__( - self, *, value: Optional[List["_models.Secret"]] = None, next_link: Optional[str] = None, **kwargs: Any + self, + *, + upgradeable_to: Optional[str] = None, + platform_workload_identities: Optional[dict[str, "_models.PlatformWorkloadIdentity"]] = None, + **kwargs: Any ) -> None: """ - :keyword value: The list of secrets. - :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 - """ - 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.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 + :keyword upgradeable_to: UpgradeableTo stores a single OpenShift version a workload identity + cluster can be upgraded to. + :paramtype upgradeable_to: str + :keyword platform_workload_identities: Dictionary of :code:``. + :paramtype platform_workload_identities: dict[str, + ~azure.mgmt.redhatopenshift.models.PlatformWorkloadIdentity] """ super().__init__(**kwargs) - self.system_data = None - self.secret_resources = secret_resources + self.upgradeable_to = upgradeable_to + self.platform_workload_identities = platform_workload_identities -class ServicePrincipalProfile(_serialization.Model): - """ServicePrincipalProfile represents a service principal profile. +class PlatformWorkloadIdentityRole(_serialization.Model): + """PlatformWorkloadIdentityRole represents a mapping from a particular OCP operator to the + built-in role that should be assigned to that operator's corresponding managed identity. - :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 + :ivar operator_name: OperatorName represents the name of the operator that this role is for. + :vartype operator_name: str + :ivar role_definition_name: RoleDefinitionName represents the name of the role. + :vartype role_definition_name: str + :ivar role_definition_id: RoleDefinitionID represents the resource ID of the role definition. + :vartype role_definition_id: 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.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.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"}, + "operator_name": {"key": "operatorName", "type": "str"}, + "role_definition_name": {"key": "roleDefinitionName", "type": "str"}, + "role_definition_id": {"key": "roleDefinitionId", "type": "str"}, } def __init__( self, *, - value: Optional[List["_models.SyncIdentityProvider"]] = None, - next_link: Optional[str] = None, + operator_name: Optional[str] = None, + role_definition_name: Optional[str] = None, + role_definition_id: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword value: The list of sync identity providers. - :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 + :keyword operator_name: OperatorName represents the name of the operator that this role is for. + :paramtype operator_name: str + :keyword role_definition_name: RoleDefinitionName represents the name of the role. + :paramtype role_definition_name: str + :keyword role_definition_id: RoleDefinitionID represents the resource ID of the role + definition. + :paramtype role_definition_id: str """ super().__init__(**kwargs) - self.value = value - self.next_link = next_link + self.operator_name = operator_name + self.role_definition_name = role_definition_name + self.role_definition_id = role_definition_id -class SyncIdentityProviderUpdate(_serialization.Model): - """SyncIdentityProvider represents a SyncIdentityProvider. +class PlatformWorkloadIdentityRoleSet(ProxyResource): + """PlatformWorkloadIdentityRoleSet represents a mapping from the names of OCP operators to the + built-in roles that should be assigned to those operator's corresponding managed identities for + a particular OCP version. 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.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 + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1383,8 +1272,13 @@ class SyncSet(ProxyResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.redhatopenshift.models.SystemData - :ivar resources: Resources represents the SyncSets configuration. - :vartype resources: str + :ivar open_shift_version: OpenShiftVersion represents the version associated with this set of + roles. + :vartype open_shift_version: str + :ivar platform_workload_identity_roles: PlatformWorkloadIdentityRoles represents the set of + roles associated with this version. + :vartype platform_workload_identity_roles: + list[~azure.mgmt.redhatopenshift.models.PlatformWorkloadIdentityRole] """ _validation = { @@ -1399,39 +1293,59 @@ class SyncSet(ProxyResource): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "resources": {"key": "properties.resources", "type": "str"}, + "open_shift_version": {"key": "properties.openShiftVersion", "type": "str"}, + "platform_workload_identity_roles": { + "key": "properties.platformWorkloadIdentityRoles", + "type": "[PlatformWorkloadIdentityRole]", + }, } - def __init__(self, *, resources: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + open_shift_version: Optional[str] = None, + platform_workload_identity_roles: Optional[list["_models.PlatformWorkloadIdentityRole"]] = None, + **kwargs: Any + ) -> None: """ - :keyword resources: Resources represents the SyncSets configuration. - :paramtype resources: str + :keyword open_shift_version: OpenShiftVersion represents the version associated with this set + of roles. + :paramtype open_shift_version: str + :keyword platform_workload_identity_roles: PlatformWorkloadIdentityRoles represents the set of + roles associated with this version. + :paramtype platform_workload_identity_roles: + list[~azure.mgmt.redhatopenshift.models.PlatformWorkloadIdentityRole] """ super().__init__(**kwargs) - self.resources = resources + self.open_shift_version = open_shift_version + self.platform_workload_identity_roles = platform_workload_identity_roles -class SyncSetList(_serialization.Model): - """SyncSetList represents a list of SyncSets. +class PlatformWorkloadIdentityRoleSetList(_serialization.Model): + """PlatformWorkloadIdentityRoleSetList represents a List of role sets. - :ivar value: The list of syncsets. - :vartype value: list[~azure.mgmt.redhatopenshift.models.SyncSet] - :ivar next_link: The link used to get the next page of operations. + :ivar value: The list of role sets. + :vartype value: list[~azure.mgmt.redhatopenshift.models.PlatformWorkloadIdentityRoleSet] + :ivar next_link: Next Link to next operation. :vartype next_link: str """ _attribute_map = { - "value": {"key": "value", "type": "[SyncSet]"}, + "value": {"key": "value", "type": "[PlatformWorkloadIdentityRoleSet]"}, "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, *, value: Optional[List["_models.SyncSet"]] = None, next_link: Optional[str] = None, **kwargs: Any + self, + *, + value: Optional[list["_models.PlatformWorkloadIdentityRoleSet"]] = None, + next_link: Optional[str] = None, + **kwargs: Any ) -> None: """ - :keyword value: The list of syncsets. - :paramtype value: list[~azure.mgmt.redhatopenshift.models.SyncSet] - :keyword next_link: The link used to get the next page of operations. + :keyword value: The list of role sets. + :paramtype value: list[~azure.mgmt.redhatopenshift.models.PlatformWorkloadIdentityRoleSet] + :keyword next_link: Next Link to next operation. :paramtype next_link: str """ super().__init__(**kwargs) @@ -1439,34 +1353,30 @@ def __init__( 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. +class ServicePrincipalProfile(_serialization.Model): + """ServicePrincipalProfile represents a service principal profile. - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.redhatopenshift.models.SystemData - :ivar resources: Resources represents the SyncSets configuration. - :vartype resources: str + :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 """ - _validation = { - "system_data": {"readonly": True}, - } - _attribute_map = { - "system_data": {"key": "systemData", "type": "SystemData"}, - "resources": {"key": "properties.resources", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "client_secret": {"key": "clientSecret", "type": "str"}, } - def __init__(self, *, resources: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, client_id: Optional[str] = None, client_secret: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword resources: Resources represents the SyncSets configuration. - :paramtype resources: str + :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.system_data = None - self.resources = resources + self.client_id = client_id + self.client_secret = client_secret class SystemData(_serialization.Model): @@ -1533,6 +1443,34 @@ def __init__( self.last_modified_at = last_modified_at +class UserAssignedIdentity(_serialization.Model): + """User assigned identity properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of the assigned identity. + :vartype principal_id: str + :ivar client_id: The client ID of the assigned identity. + :vartype client_id: str + """ + + _validation = { + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None + + class WorkerProfile(_serialization.Model): """WorkerProfile represents a worker profile. diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/__init__.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/__init__.py index f03257fe6903..0940c895da8b 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/__init__.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/__init__.py @@ -5,27 +5,29 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -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 typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._open_shift_versions_operations import OpenShiftVersionsOperations # type: ignore +from ._platform_workload_identity_role_sets_operations import PlatformWorkloadIdentityRoleSetsOperations # type: ignore +from ._platform_workload_identity_role_set_operations import PlatformWorkloadIdentityRoleSetOperations # type: ignore +from ._open_shift_clusters_operations import OpenShiftClustersOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ "Operations", "OpenShiftVersionsOperations", + "PlatformWorkloadIdentityRoleSetsOperations", + "PlatformWorkloadIdentityRoleSetOperations", "OpenShiftClustersOperations", - "MachinePoolsOperations", - "SecretsOperations", - "SyncIdentityProvidersOperations", - "SyncSetsOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_machine_pools_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_machine_pools_operations.py deleted file mode 100644 index 2f081db2d010..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_machine_pools_operations.py +++ /dev/null @@ -1,796 +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-11-22")) - 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-11-22")) - 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-11-22")) - 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-11-22")) - 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-11-22")) - 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.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") - - @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.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._config.api_version)) - 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._config.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.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._config.api_version)) - 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.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.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.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.models.MachinePool or IO[bytes] - :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.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._config.api_version)) - 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) - - 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._config.api_version)) - 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.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.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.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.models.MachinePoolUpdate or IO[bytes] - :return: MachinePool or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.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._config.api_version)) - 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/operations/_open_shift_clusters_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_open_shift_clusters_operations.py index 3827260193c8..aaf092831956 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_open_shift_clusters_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_open_shift_clusters_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,14 +32,12 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer +from .._configuration import AzureRedHatOpenShiftClientConfiguration +from .._utils.serialization import Deserializer, 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]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -48,15 +47,15 @@ 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-11-22")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-25")) 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), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -74,16 +73,16 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-22")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-25")) 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), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -104,16 +103,16 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-22")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-25")) 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), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -137,7 +136,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-22")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-25")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -145,9 +144,9 @@ def build_create_or_update_request( _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), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -173,16 +172,16 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-22")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-25")) 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), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -206,7 +205,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-22")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-25")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -214,9 +213,9 @@ def build_update_request( _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), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -242,16 +241,16 @@ def build_list_admin_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-22")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-25")) 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), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -275,16 +274,16 @@ def build_list_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-22")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-25")) 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), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -314,15 +313,17 @@ class OpenShiftClustersOperations: models = _models - def __init__(self, *args, **kwargs): + 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._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AzureRedHatOpenShiftClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.OpenShiftCluster"]: + def list(self, **kwargs: Any) -> ItemPaged["_models.OpenShiftCluster"]: """Lists OpenShift clusters in the specified subscription. The operation returns properties of each OpenShift cluster. @@ -337,7 +338,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.OpenShiftCluster"]: 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]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -398,7 +399,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.OpenShiftCluster"]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.OpenShiftCluster"]: """Lists OpenShift clusters in the specified subscription and resource group. The operation returns properties of each OpenShift cluster. @@ -416,7 +417,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite 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]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -492,7 +493,7 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.redhatopenshift.models.OpenShiftCluster :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -541,7 +542,7 @@ def _create_or_update_initial( parameters: Union[_models.OpenShiftCluster, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -736,7 +737,7 @@ def get_long_running_output(pipeline_response): ) def _delete_initial(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -845,7 +846,7 @@ def _update_initial( parameters: Union[_models.OpenShiftClusterUpdate, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -914,7 +915,8 @@ def begin_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.OpenShiftCluster]: - """Updates a OpenShift cluster with the specified subscription, resource group and resource name. + """Creates or updates a OpenShift cluster with the specified subscription, resource group and + resource name. The operation returns properties of a OpenShift cluster. @@ -944,7 +946,8 @@ def begin_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.OpenShiftCluster]: - """Updates a OpenShift cluster with the specified subscription, resource group and resource name. + """Creates or updates a OpenShift cluster with the specified subscription, resource group and + resource name. The operation returns properties of a OpenShift cluster. @@ -972,7 +975,8 @@ def begin_update( parameters: Union[_models.OpenShiftClusterUpdate, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.OpenShiftCluster]: - """Updates a OpenShift cluster with the specified subscription, resource group and resource name. + """Creates or updates a OpenShift cluster with the specified subscription, resource group and + resource name. The operation returns properties of a OpenShift cluster. @@ -1054,7 +1058,7 @@ def list_admin_credentials( :rtype: ~azure.mgmt.redhatopenshift.models.OpenShiftClusterAdminKubeconfig :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1114,7 +1118,7 @@ def list_credentials( :rtype: ~azure.mgmt.redhatopenshift.models.OpenShiftClusterCredentials :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_open_shift_versions_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_open_shift_versions_operations.py index 12d2e067cef5..21dce7374ad1 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_open_shift_versions_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_open_shift_versions_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +6,11 @@ # 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 +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,14 +27,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AzureRedHatOpenShiftClientConfiguration +from .._utils.serialization import Deserializer, 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]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -43,16 +42,16 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht _headers = case_insensitive_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-11-22")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-25")) 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 + "/subscriptions/{subscriptionId}/providers/Microsoft.RedHatOpenShift/locations/{location}/openShiftVersions", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str", min_length=1), } @@ -67,6 +66,42 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_get_request(location: str, open_shift_version: 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", "2025-07-25")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.RedHatOpenShift/locations/{location}/openShiftVersions/{openShiftVersion}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + "openShiftVersion": _SERIALIZER.url( + "open_shift_version", + open_shift_version, + "str", + max_length=63, + min_length=1, + pattern=r"^(\d+)\.(\d+)\.(\d+)(.*)", + ), + } + + _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:: @@ -79,20 +114,22 @@ class OpenShiftVersionsOperations: models = _models - def __init__(self, *args, **kwargs): + 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._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AzureRedHatOpenShiftClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, location: str, **kwargs: Any) -> Iterable["_models.OpenShiftVersion"]: + def list(self, location: str, **kwargs: Any) -> ItemPaged["_models.OpenShiftVersion"]: """Lists all OpenShift versions available to install in the specified location. - The operation returns the installable OpenShift versions as strings. + The operation returns the installable OpenShift versions as a string. - :param location: The name of Azure region. Required. + :param location: The name of the 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.models.OpenShiftVersion] @@ -104,7 +141,7 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.OpenShiftVersi 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]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -164,3 +201,60 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, location: str, open_shift_version: str, **kwargs: Any) -> _models.OpenShiftVersion: + """Gets an available OpenShift version to install in the specified location. + + This operation returns installable OpenShift version as a string. + + :param location: The name of the Azure region. Required. + :type location: str + :param open_shift_version: The desired version value of the OpenShiftVersion resource. + Required. + :type open_shift_version: str + :return: OpenShiftVersion or the result of cls(response) + :rtype: ~azure.mgmt.redhatopenshift.models.OpenShiftVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OpenShiftVersion] = kwargs.pop("cls", None) + + _request = build_get_request( + location=location, + open_shift_version=open_shift_version, + 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("OpenShiftVersion", 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/operations/_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_operations.py index 82b84ed4a039..207615d221d0 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_operations.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # 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 +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,14 +26,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AzureRedHatOpenShiftClientConfiguration +from .._utils.serialization import Deserializer, 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]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -43,7 +41,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-22")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-25")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -70,15 +68,17 @@ class Operations: models = _models - def __init__(self, *args, **kwargs): + 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._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AzureRedHatOpenShiftClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: + def list(self, **kwargs: Any) -> ItemPaged["_models.Operation"]: """Lists all of the available RP operations. The operation returns the RP operations. @@ -93,7 +93,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: 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]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_platform_workload_identity_role_set_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_platform_workload_identity_role_set_operations.py new file mode 100644 index 000000000000..ccc87a7e632e --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_platform_workload_identity_role_set_operations.py @@ -0,0 +1,154 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +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 .._configuration import AzureRedHatOpenShiftClientConfiguration +from .._utils.serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request(location: str, open_shift_minor_version: 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", "2025-07-25")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.RedHatOpenShift/locations/{location}/platformWorkloadIdentityRoleSets/{openShiftMinorVersion}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + "openShiftMinorVersion": _SERIALIZER.url( + "open_shift_minor_version", + open_shift_minor_version, + "str", + max_length=63, + min_length=1, + pattern=r"^(\d+)\.(\d+)", + ), + } + + _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 PlatformWorkloadIdentityRoleSetOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.redhatopenshift.AzureRedHatOpenShiftClient`'s + :attr:`platform_workload_identity_role_set` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AzureRedHatOpenShiftClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, location: str, open_shift_minor_version: str, **kwargs: Any + ) -> _models.PlatformWorkloadIdentityRoleSet: + """Gets a mapping of an OpenShift version to identity requirements, which includes operatorName, + roleDefinitionName, roleDefinitionId, and serviceAccounts. + + This operation returns Platform Workload Identity Role Set as a string. + + :param location: The name of the Azure region. Required. + :type location: str + :param open_shift_minor_version: The desired version value of the + PlatformWorkloadIdentityRoleSet resource. Required. + :type open_shift_minor_version: str + :return: PlatformWorkloadIdentityRoleSet or the result of cls(response) + :rtype: ~azure.mgmt.redhatopenshift.models.PlatformWorkloadIdentityRoleSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PlatformWorkloadIdentityRoleSet] = kwargs.pop("cls", None) + + _request = build_get_request( + location=location, + open_shift_minor_version=open_shift_minor_version, + 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("PlatformWorkloadIdentityRoleSet", 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/operations/_platform_workload_identity_role_sets_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_platform_workload_identity_role_sets_operations.py new file mode 100644 index 000000000000..4352ae6a58df --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_platform_workload_identity_role_sets_operations.py @@ -0,0 +1,170 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar +import urllib.parse + +from azure.core import PipelineClient +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 .._configuration import AzureRedHatOpenShiftClientConfiguration +from .._utils.serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list + +_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", "2025-07-25")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.RedHatOpenShift/locations/{location}/platformWorkloadIdentityRoleSets", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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 PlatformWorkloadIdentityRoleSetsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.redhatopenshift.AzureRedHatOpenShiftClient`'s + :attr:`platform_workload_identity_role_sets` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AzureRedHatOpenShiftClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, location: str, **kwargs: Any) -> ItemPaged["_models.PlatformWorkloadIdentityRoleSet"]: + """Lists a mapping of OpenShift versions to identity requirements, which include operatorName, + roleDefinitionName, roleDefinitionId, and serviceAccounts. + + This operation returns a list of Platform Workload Identity Role Sets as a string. + + :param location: The name of the Azure region. Required. + :type location: str + :return: An iterator like instance of either PlatformWorkloadIdentityRoleSet or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.models.PlatformWorkloadIdentityRoleSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PlatformWorkloadIdentityRoleSetList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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._config.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("PlatformWorkloadIdentityRoleSetList", 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/operations/_secrets_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_secrets_operations.py deleted file mode 100644 index 50d3ed02c9fc..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_secrets_operations.py +++ /dev/null @@ -1,792 +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-11-22")) - 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-11-22")) - 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-11-22")) - 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-11-22")) - 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-11-22")) - 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.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") - - @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.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._config.api_version)) - 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._config.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.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._config.api_version)) - 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.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.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.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.models.Secret or IO[bytes] - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.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._config.api_version)) - 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) - - 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._config.api_version)) - 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.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.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.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.models.SecretUpdate or IO[bytes] - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.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._config.api_version)) - 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/operations/_sync_identity_providers_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_sync_identity_providers_operations.py deleted file mode 100644 index a51a465de2cb..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_sync_identity_providers_operations.py +++ /dev/null @@ -1,803 +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-11-22")) - 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-11-22")) - 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-11-22")) - 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-11-22")) - 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-11-22")) - 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.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") - - @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.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._config.api_version)) - 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._config.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.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._config.api_version)) - 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.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.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.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.models.SyncIdentityProvider or IO[bytes] - :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.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._config.api_version)) - 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) - - 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._config.api_version)) - 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.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.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.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.models.SyncIdentityProviderUpdate or IO[bytes] - :return: SyncIdentityProvider or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.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._config.api_version)) - 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/operations/_sync_sets_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_sync_sets_operations.py deleted file mode 100644 index 940fc9c62cc3..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/operations/_sync_sets_operations.py +++ /dev/null @@ -1,793 +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-11-22")) - 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-11-22")) - 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-11-22")) - 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-11-22")) - 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-11-22")) - 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.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") - - @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.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._config.api_version)) - 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._config.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.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._config.api_version)) - 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.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.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.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.models.SyncSet or IO[bytes] - :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.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._config.api_version)) - 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) - - 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._config.api_version)) - 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.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.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.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.models.SyncSetUpdate or IO[bytes] - :return: SyncSet or the result of cls(response) - :rtype: ~azure.mgmt.redhatopenshift.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._config.api_version)) - 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/generated_samples/machine_pools_create_or_update.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/machine_pools_create_or_update.py deleted file mode 100644 index b1c40785811f..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/machine_pools_create_or_update.py +++ /dev/null @@ -1,48 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-redhatopenshift -# USAGE - python machine_pools_create_or_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureRedHatOpenShiftClient( - credential=DefaultAzureCredential(), - subscription_id="subscriptionId", - ) - - response = client.machine_pools.create_or_update( - resource_group_name="resourceGroup", - resource_name="resourceName", - child_resource_name="childResourceName", - parameters={ - "properties": { - "resources": "ewogICAgImFwaVZlcnNpb24iOiAiaGl2ZS5vcGVuc2hpZnQuaW8vdjEiLAogICAgImtpbmQiOiAiTWFjaGluZVBvb2wiLAogICAgIm1ldGFkYXRhIjogewogICAgICAgICJuYW1lIjogInRlc3QtY2x1c3Rlci13b3JrZXIiLAogICAgICAgICJuYW1lc3BhY2UiOiAiYXJvLWY2MGFlOGEyLWJjYTEtNDk4Ny05MDU2LVhYWFhYWFhYWFhYWCIKICAgIH0sCiAgICAic3BlYyI6IHsKICAgICAgICAiY2x1c3RlckRlcGxveW1lbnRSZWYiOiB7CiAgICAgICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIKICAgICAgICB9LAogICAgICAgICJuYW1lIjogIndvcmtlciIsCiAgICAgICAgInBsYXRmb3JtIjogewogICAgICAgICAgICAiYXdzIjogewogICAgICAgICAgICAgICAgInJvb3RWb2x1bWUiOiB7CiAgICAgICAgICAgICAgICAgICAgImlvcHMiOiAwLAogICAgICAgICAgICAgICAgICAgICJzaXplIjogMzAwLAogICAgICAgICAgICAgICAgICAgICJ0eXBlIjogImdwMyIKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAidHlwZSI6ICJtNS54bGFyZ2UiLAogICAgICAgICAgICAgICAgInpvbmVzIjogWwogICAgICAgICAgICAgICAgICAgICJ1cy1lYXN0LTFhIgogICAgICAgICAgICAgICAgXQogICAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICAicmVwbGljYXMiOiAyCiAgICB9LAogICAgInN0YXR1cyI6IHsKICAgICAgICAiY29uZGl0aW9ucyI6IFsKICAgICAgICBdCiAgICB9Cn0K" - } - }, - ) - print(response) - - -# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-11-22/examples/MachinePools_CreateOrUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/machine_pools_delete.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/machine_pools_delete.py deleted file mode 100644 index 807205d8a756..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/machine_pools_delete.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-redhatopenshift -# USAGE - python machine_pools_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureRedHatOpenShiftClient( - credential=DefaultAzureCredential(), - subscription_id="subscriptionId", - ) - - client.machine_pools.delete( - resource_group_name="resourceGroup", - resource_name="resourceName", - child_resource_name="childResourceName", - ) - - -# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-11-22/examples/MachinePools_Delete.json -if __name__ == "__main__": - main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/machine_pools_get.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/machine_pools_get.py deleted file mode 100644 index 5f25448afad3..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/machine_pools_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-redhatopenshift -# USAGE - python machine_pools_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureRedHatOpenShiftClient( - credential=DefaultAzureCredential(), - subscription_id="subscriptionId", - ) - - response = client.machine_pools.get( - resource_group_name="resourceGroup", - resource_name="resourceName", - child_resource_name="childResourceName", - ) - print(response) - - -# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-11-22/examples/MachinePools_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/machine_pools_list.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/machine_pools_list.py deleted file mode 100644 index e14ecd37cca0..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/machine_pools_list.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-redhatopenshift -# USAGE - python machine_pools_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureRedHatOpenShiftClient( - credential=DefaultAzureCredential(), - subscription_id="subscriptionId", - ) - - response = client.machine_pools.list( - resource_group_name="resourceGroup", - resource_name="resourceName", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-11-22/examples/MachinePools_List.json -if __name__ == "__main__": - main() 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 deleted file mode 100644 index b69db1b1a64b..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/machine_pools_update.py +++ /dev/null @@ -1,48 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-redhatopenshift -# USAGE - python machine_pools_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureRedHatOpenShiftClient( - credential=DefaultAzureCredential(), - subscription_id="subscriptionId", - ) - - response = client.machine_pools.update( - resource_group_name="resourceGroup", - resource_name="resourceName", - child_resource_name="childResourceName", - parameters={ - "properties": { - "resources": "ewogICAgImFwaVZlcnNpb24iOiAiaGl2ZS5vcGVuc2hpZnQuaW8vdjEiLAogICAgImtpbmQiOiAiTWFjaGluZVBvb2wiLAogICAgIm1ldGFkYXRhIjogewogICAgICAgICJuYW1lIjogInRlc3QtY2x1c3Rlci13b3JrZXIiLAogICAgICAgICJuYW1lc3BhY2UiOiAiYXJvLWY2MGFlOGEyLWJjYTEtNDk4Ny05MDU2LVhYWFhYWFhYWFhYWCIKICAgIH0sCiAgICAic3BlYyI6IHsKICAgICAgICAiY2x1c3RlckRlcGxveW1lbnRSZWYiOiB7CiAgICAgICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIKICAgICAgICB9LAogICAgICAgICJuYW1lIjogIndvcmtlciIsCiAgICAgICAgInBsYXRmb3JtIjogewogICAgICAgICAgICAiYXdzIjogewogICAgICAgICAgICAgICAgInJvb3RWb2x1bWUiOiB7CiAgICAgICAgICAgICAgICAgICAgImlvcHMiOiAwLAogICAgICAgICAgICAgICAgICAgICJzaXplIjogMzAwLAogICAgICAgICAgICAgICAgICAgICJ0eXBlIjogImdwMyIKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAidHlwZSI6ICJtNS54bGFyZ2UiLAogICAgICAgICAgICAgICAgInpvbmVzIjogWwogICAgICAgICAgICAgICAgICAgICJ1cy1lYXN0LTFhIgogICAgICAgICAgICAgICAgXQogICAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICAicmVwbGljYXMiOiAyCiAgICB9LAogICAgInN0YXR1cyI6IHsKICAgICAgICAiY29uZGl0aW9ucyI6IFsKICAgICAgICBdCiAgICB9Cn0K" - } - }, - ) - print(response) - - -# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-11-22/examples/MachinePools_Update.json -if __name__ == "__main__": - main() 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 97d2619267ca..cf1528fb4a55 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,13 +28,14 @@ def main(): client = AzureRedHatOpenShiftClient( credential=DefaultAzureCredential(), - subscription_id="subscriptionId", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.open_shift_clusters.begin_create_or_update( resource_group_name="resourceGroup", resource_name="resourceName", parameters={ + "identity": {"type": "UserAssigned", "userAssignedIdentities": {"": {}}}, "location": "location", "properties": { "apiserverProfile": {"visibility": "Public"}, @@ -41,13 +43,13 @@ def main(): "domain": "cluster.location.aroapp.io", "fipsValidatedModules": "Enabled", "pullSecret": '{"auths":{"registry.connect.redhat.com":{"auth":""},"registry.redhat.io":{"auth":""}}}', - "resourceGroupId": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup", + "resourceGroupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clusterResourceGroup", }, "consoleProfile": {}, "ingressProfiles": [{"name": "default", "visibility": "Public"}], "masterProfile": { "encryptionAtHost": "Enabled", - "subnetId": "/subscriptions/subscriptionId/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/master", + "subnetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/master", "vmSize": "Standard_D8s_v3", }, "networkProfile": { @@ -56,13 +58,14 @@ def main(): "preconfiguredNSG": "Disabled", "serviceCidr": "172.30.0.0/16", }, + "platformWorkloadIdentityProfile": {"platformWorkloadIdentities": {"": {}}}, "servicePrincipalProfile": {"clientId": "clientId", "clientSecret": "clientSecret"}, "workerProfiles": [ { "count": 3, "diskSizeGB": 128, "name": "worker", - "subnetId": "/subscriptions/subscriptionId/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/worker", + "subnetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/worker", "vmSize": "Standard_D2s_v3", } ], @@ -73,6 +76,6 @@ def main(): print(response) -# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-11-22/examples/OpenShiftClusters_CreateOrUpdate.json +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/OpenShiftClusters/stable/2025-07-25/examples/OpenShiftClusters_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_delete.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_delete.py index 1a1bf9eb0974..fc6dbd390b24 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_delete.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_delete.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = AzureRedHatOpenShiftClient( credential=DefaultAzureCredential(), - subscription_id="subscriptionId", + subscription_id="00000000-0000-0000-0000-000000000000", ) client.open_shift_clusters.begin_delete( @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-11-22/examples/OpenShiftClusters_Delete.json +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/OpenShiftClusters/stable/2025-07-25/examples/OpenShiftClusters_Delete.json if __name__ == "__main__": main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_get.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_get.py index 261689a870fd..078cf6e1c776 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_get.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_get.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = AzureRedHatOpenShiftClient( credential=DefaultAzureCredential(), - subscription_id="subscriptionId", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.open_shift_clusters.get( @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-11-22/examples/OpenShiftClusters_Get.json +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/OpenShiftClusters/stable/2025-07-25/examples/OpenShiftClusters_Get.json if __name__ == "__main__": main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_list.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_list.py index b308e3461dca..bd1b5b7f532c 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_list.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_list.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = AzureRedHatOpenShiftClient( credential=DefaultAzureCredential(), - subscription_id="subscriptionId", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.open_shift_clusters.list() @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-11-22/examples/OpenShiftClusters_List.json +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/OpenShiftClusters/stable/2025-07-25/examples/OpenShiftClusters_List.json if __name__ == "__main__": main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_list_admin_credentials.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_list_admin_credentials.py index bd9c72bd8d1f..2a399c8454e7 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_list_admin_credentials.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_list_admin_credentials.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = AzureRedHatOpenShiftClient( credential=DefaultAzureCredential(), - subscription_id="subscriptionId", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.open_shift_clusters.list_admin_credentials( @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-11-22/examples/OpenShiftClusters_ListAdminCredentials.json +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/OpenShiftClusters/stable/2025-07-25/examples/OpenShiftClusters_ListAdminCredentials.json if __name__ == "__main__": main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_list_by_resource_group.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_list_by_resource_group.py index 8819390c96b6..6a53e0eed0a3 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_list_by_resource_group.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_list_by_resource_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = AzureRedHatOpenShiftClient( credential=DefaultAzureCredential(), - subscription_id="subscriptionId", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.open_shift_clusters.list_by_resource_group( @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-11-22/examples/OpenShiftClusters_ListByResourceGroup.json +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/OpenShiftClusters/stable/2025-07-25/examples/OpenShiftClusters_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_list_credentials.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_list_credentials.py index 5baca2399d1e..4e97c6434292 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_list_credentials.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_clusters_list_credentials.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = AzureRedHatOpenShiftClient( credential=DefaultAzureCredential(), - subscription_id="subscriptionId", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.open_shift_clusters.list_credentials( @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-11-22/examples/OpenShiftClusters_ListCredentials.json +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/OpenShiftClusters/stable/2025-07-25/examples/OpenShiftClusters_ListCredentials.json if __name__ == "__main__": main() 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 b32be42cb3b1..984160e9eb43 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,26 +28,27 @@ def main(): client = AzureRedHatOpenShiftClient( credential=DefaultAzureCredential(), - subscription_id="subscriptionId", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.open_shift_clusters.begin_update( resource_group_name="resourceGroup", resource_name="resourceName", parameters={ + "identity": {"type": "UserAssigned", "userAssignedIdentities": {"": {}}}, "properties": { "apiserverProfile": {"visibility": "Public"}, "clusterProfile": { "domain": "cluster.location.aroapp.io", "fipsValidatedModules": "Enabled", "pullSecret": '{"auths":{"registry.connect.redhat.com":{"auth":""},"registry.redhat.io":{"auth":""}}}', - "resourceGroupId": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup", + "resourceGroupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clusterResourceGroup", }, "consoleProfile": {}, "ingressProfiles": [{"name": "default", "visibility": "Public"}], "masterProfile": { "encryptionAtHost": "Enabled", - "subnetId": "/subscriptions/subscriptionId/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/master", + "subnetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/master", "vmSize": "Standard_D8s_v3", }, "networkProfile": { @@ -55,13 +57,14 @@ def main(): "preconfiguredNSG": "Disabled", "serviceCidr": "172.30.0.0/16", }, + "platformWorkloadIdentityProfile": {"platformWorkloadIdentities": {"": {}}}, "servicePrincipalProfile": {"clientId": "clientId", "clientSecret": "clientSecret"}, "workerProfiles": [ { "count": 3, "diskSizeGB": 128, "name": "worker", - "subnetId": "/subscriptions/subscriptionId/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/worker", + "subnetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/worker", "vmSize": "Standard_D2s_v3", } ], @@ -72,6 +75,6 @@ def main(): print(response) -# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-11-22/examples/OpenShiftClusters_Update.json +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/OpenShiftClusters/stable/2025-07-25/examples/OpenShiftClusters_Update.json if __name__ == "__main__": main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_get.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_versions_get.py similarity index 77% rename from sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_get.py rename to sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_versions_get.py index 173b6298d253..22bd9075ac44 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_get.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_versions_get.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -15,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-redhatopenshift # USAGE - python secrets_get.py + python open_shift_versions_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -27,17 +28,16 @@ def main(): client = AzureRedHatOpenShiftClient( credential=DefaultAzureCredential(), - subscription_id="subscriptionId", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.secrets.get( - resource_group_name="resourceGroup", - resource_name="resourceName", - child_resource_name="childResourceName", + response = client.open_shift_versions.get( + location="location", + open_shift_version="4.14.40", ) print(response) -# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-11-22/examples/Secrets_Get.json +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/OpenShiftClusters/stable/2025-07-25/examples/OpenShiftVersions_Get.json if __name__ == "__main__": main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_versions_list.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_versions_list.py index f9e321c3feef..e2d28c2f1151 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_versions_list.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/open_shift_versions_list.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = AzureRedHatOpenShiftClient( credential=DefaultAzureCredential(), - subscription_id="subscriptionId", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.open_shift_versions.list( @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-11-22/examples/OpenShiftVersions_List.json +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/OpenShiftClusters/stable/2025-07-25/examples/OpenShiftVersions_List.json if __name__ == "__main__": main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/operations_list.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/operations_list.py index a7acf4aa02b7..5003da79296d 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/operations_list.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/operations_list.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-11-22/examples/Operations_List.json +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/OpenShiftClusters/stable/2025-07-25/examples/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_create_or_update.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/platform_workload_identity_role_set_get.py similarity index 75% rename from sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_create_or_update.py rename to sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/platform_workload_identity_role_set_get.py index a1ce2c852fe8..487d5c9d650b 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_create_or_update.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/platform_workload_identity_role_set_get.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -15,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-redhatopenshift # USAGE - python secrets_create_or_update.py + python platform_workload_identity_role_set_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -27,18 +28,16 @@ def main(): client = AzureRedHatOpenShiftClient( credential=DefaultAzureCredential(), - subscription_id="subscriptionId", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.secrets.create_or_update( - resource_group_name="resourceGroup", - resource_name="resourceName", - child_resource_name="childResourceName", - parameters={"properties": {}}, + response = client.platform_workload_identity_role_set.get( + location="location", + open_shift_minor_version="4.14", ) print(response) -# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-11-22/examples/Secrets_CreateOrUpdate.json +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/OpenShiftClusters/stable/2025-07-25/examples/PlatformWorkloadIdentityRoleSet_Get.json if __name__ == "__main__": main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_list.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/platform_workload_identity_role_sets_list.py similarity index 77% rename from sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_list.py rename to sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/platform_workload_identity_role_sets_list.py index 675f3b91894a..abf583ba80a6 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_list.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/platform_workload_identity_role_sets_list.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -15,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-redhatopenshift # USAGE - python secrets_list.py + python platform_workload_identity_role_sets_list.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -27,17 +28,16 @@ def main(): client = AzureRedHatOpenShiftClient( credential=DefaultAzureCredential(), - subscription_id="subscriptionId", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.secrets.list( - resource_group_name="resourceGroup", - resource_name="resourceName", + response = client.platform_workload_identity_role_sets.list( + location="location", ) for item in response: print(item) -# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-11-22/examples/Secrets_List.json +# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/OpenShiftClusters/stable/2025-07-25/examples/PlatformWorkloadIdentityRoleSets_List.json if __name__ == "__main__": main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_delete.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_delete.py deleted file mode 100644 index 1441da1a46eb..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_delete.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-redhatopenshift -# USAGE - python secrets_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureRedHatOpenShiftClient( - credential=DefaultAzureCredential(), - subscription_id="subscriptionId", - ) - - client.secrets.delete( - resource_group_name="resourceGroup", - resource_name="resourceName", - child_resource_name="childResourceName", - ) - - -# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-11-22/examples/Secrets_Delete.json -if __name__ == "__main__": - main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_update.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_update.py deleted file mode 100644 index 514139ce7c29..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/secrets_update.py +++ /dev/null @@ -1,44 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-redhatopenshift -# USAGE - python secrets_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureRedHatOpenShiftClient( - credential=DefaultAzureCredential(), - subscription_id="subscriptionId", - ) - - response = client.secrets.update( - resource_group_name="resourceGroup", - resource_name="resourceName", - child_resource_name="childResourceName", - parameters={"properties": {}}, - ) - print(response) - - -# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-11-22/examples/Secrets_Update.json -if __name__ == "__main__": - main() 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 deleted file mode 100644 index d5577a75815b..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_identity_providers_create_or_update.py +++ /dev/null @@ -1,48 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-redhatopenshift -# USAGE - python sync_identity_providers_create_or_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureRedHatOpenShiftClient( - credential=DefaultAzureCredential(), - subscription_id="subscriptionId", - ) - - response = client.sync_identity_providers.create_or_update( - resource_group_name="resourceGroup", - resource_name="resourceName", - child_resource_name="childResourceName", - parameters={ - "properties": { - "resources": "ewogICAgImFwaVZlcnNpb24iOiAiaGl2ZS5vcGVuc2hpZnQuaW8vdjEiLAogICAgImtpbmQiOiAiU3luY0lkZW50aXR5UHJvdmlkZXIiLAogICAgIm1ldGFkYXRhIjogewogICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIsCiAgICAgICAgIm5hbWVzcGFjZSI6ICJhcm8tZjYwYWU4YTItYmNhMS00OTg3LTkwNTYtWFhYWFhYWFhYWFhYIgogICAgfSwKICAgICJzcGVjIjogewogICAgICAgICJjbHVzdGVyRGVwbG95bWVudFJlZnMiOiBbCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIKICAgICAgICAgICAgfQogICAgICAgIF0sCiAgICAgICAgImlkZW50aXR5UHJvdmlkZXJzIjogWwogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAiaHRwYXNzd2QiOiB7CiAgICAgICAgICAgICAgICAgICAgImZpbGVEYXRhIjogewogICAgICAgICAgICAgICAgICAgICAgICAibmFtZSI6ICJodHBhc3N3ZC1zZWNyZXQiCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICJtYXBwaW5nTWV0aG9kIjogImNsYWltIiwKICAgICAgICAgICAgICAgICJuYW1lIjogIkhUUGFzc3dkIiwKICAgICAgICAgICAgICAgICJ0eXBlIjogIkhUUGFzc3dkIgogICAgICAgICAgICB9CiAgICAgICAgXQogICAgfSwKICAgICJzdGF0dXMiOiB7fQp9Cg==" - } - }, - ) - print(response) - - -# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-11-22/examples/SyncIdentityProviders_CreateOrUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_identity_providers_delete.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_identity_providers_delete.py deleted file mode 100644 index d07c664e48ab..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_identity_providers_delete.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-redhatopenshift -# USAGE - python sync_identity_providers_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureRedHatOpenShiftClient( - credential=DefaultAzureCredential(), - subscription_id="subscriptionId", - ) - - client.sync_identity_providers.delete( - resource_group_name="resourceGroup", - resource_name="resourceName", - child_resource_name="childResourceName", - ) - - -# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-11-22/examples/SyncIdentityProviders_Delete.json -if __name__ == "__main__": - main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_identity_providers_get.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_identity_providers_get.py deleted file mode 100644 index d13b706d6c32..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_identity_providers_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-redhatopenshift -# USAGE - python sync_identity_providers_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureRedHatOpenShiftClient( - credential=DefaultAzureCredential(), - subscription_id="subscriptionId", - ) - - response = client.sync_identity_providers.get( - resource_group_name="resourceGroup", - resource_name="resourceName", - child_resource_name="childResourceName", - ) - print(response) - - -# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-11-22/examples/SyncIdentityProviders_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_identity_providers_list.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_identity_providers_list.py deleted file mode 100644 index 850d42abcbb8..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_identity_providers_list.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-redhatopenshift -# USAGE - python sync_identity_providers_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureRedHatOpenShiftClient( - credential=DefaultAzureCredential(), - subscription_id="subscriptionId", - ) - - response = client.sync_identity_providers.list( - resource_group_name="resourceGroup", - resource_name="resourceName", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-11-22/examples/SyncIdentityProviders_List.json -if __name__ == "__main__": - main() 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 deleted file mode 100644 index a8637c4bc430..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_identity_providers_update.py +++ /dev/null @@ -1,48 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-redhatopenshift -# USAGE - python sync_identity_providers_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureRedHatOpenShiftClient( - credential=DefaultAzureCredential(), - subscription_id="subscriptionId", - ) - - response = client.sync_identity_providers.update( - resource_group_name="resourceGroup", - resource_name="resourceName", - child_resource_name="childResourceName", - parameters={ - "properties": { - "resources": "ewogICAgImFwaVZlcnNpb24iOiAiaGl2ZS5vcGVuc2hpZnQuaW8vdjEiLAogICAgImtpbmQiOiAiU3luY0lkZW50aXR5UHJvdmlkZXIiLAogICAgIm1ldGFkYXRhIjogewogICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIsCiAgICAgICAgIm5hbWVzcGFjZSI6ICJhcm8tZjYwYWU4YTItYmNhMS00OTg3LTkwNTYtWFhYWFhYWFhYWFhYIgogICAgfSwKICAgICJzcGVjIjogewogICAgICAgICJjbHVzdGVyRGVwbG95bWVudFJlZnMiOiBbCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIKICAgICAgICAgICAgfQogICAgICAgIF0sCiAgICAgICAgImlkZW50aXR5UHJvdmlkZXJzIjogWwogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAiaHRwYXNzd2QiOiB7CiAgICAgICAgICAgICAgICAgICAgImZpbGVEYXRhIjogewogICAgICAgICAgICAgICAgICAgICAgICAibmFtZSI6ICJodHBhc3N3ZC1zZWNyZXQiCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICJtYXBwaW5nTWV0aG9kIjogImNsYWltIiwKICAgICAgICAgICAgICAgICJuYW1lIjogIkhUUGFzc3dkIiwKICAgICAgICAgICAgICAgICJ0eXBlIjogIkhUUGFzc3dkIgogICAgICAgICAgICB9CiAgICAgICAgXQogICAgfSwKICAgICJzdGF0dXMiOiB7fQp9Cg==" - } - }, - ) - print(response) - - -# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-11-22/examples/SyncIdentityProviders_Update.json -if __name__ == "__main__": - main() 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 deleted file mode 100644 index 85d85667547b..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_sets_create_or_update.py +++ /dev/null @@ -1,48 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-redhatopenshift -# USAGE - python sync_sets_create_or_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureRedHatOpenShiftClient( - credential=DefaultAzureCredential(), - subscription_id="subscriptionId", - ) - - response = client.sync_sets.create_or_update( - resource_group_name="resourceGroup", - resource_name="resourceName", - child_resource_name="childResourceName", - parameters={ - "properties": { - "resources": "eyAKICAiYXBpVmVyc2lvbiI6ICJoaXZlLm9wZW5zaGlmdC5pby92MSIsCiAgImtpbmQiOiAiU3luY1NldCIsCiAgIm1ldGFkYXRhIjogewogICAgIm5hbWUiOiAic2FtcGxlIiwKICAgICJuYW1lc3BhY2UiOiAiYXJvLWY2MGFlOGEyLWJjYTEtNDk4Ny05MDU2LWYyZjZhMTgzN2NhYSIKICB9LAogICJzcGVjIjogewogICAgImNsdXN0ZXJEZXBsb3ltZW50UmVmcyI6IFtdLAogICAgInJlc291cmNlcyI6IFsKICAgICAgewogICAgICAgICJhcGlWZXJzaW9uIjogInYxIiwKICAgICAgICAia2luZCI6ICJDb25maWdNYXAiLAogICAgICAgICJtZXRhZGF0YSI6IHsKICAgICAgICAgICJuYW1lIjogIm15Y29uZmlnbWFwIgogICAgICAgIH0KICAgICAgfQogICAgXQogIH0KfQo=" - } - }, - ) - print(response) - - -# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-11-22/examples/SyncSets_CreateOrUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_sets_delete.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_sets_delete.py deleted file mode 100644 index a36c932c8361..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_sets_delete.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-redhatopenshift -# USAGE - python sync_sets_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureRedHatOpenShiftClient( - credential=DefaultAzureCredential(), - subscription_id="subscriptionId", - ) - - client.sync_sets.delete( - resource_group_name="resourceGroup", - resource_name="resourceName", - child_resource_name="childResourceName", - ) - - -# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-11-22/examples/SyncSets_Delete.json -if __name__ == "__main__": - main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_sets_get.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_sets_get.py deleted file mode 100644 index e2c1bb680ae5..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_sets_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-redhatopenshift -# USAGE - python sync_sets_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureRedHatOpenShiftClient( - credential=DefaultAzureCredential(), - subscription_id="subscriptionId", - ) - - response = client.sync_sets.get( - resource_group_name="resourceGroup", - resource_name="resourceName", - child_resource_name="childResourceName", - ) - print(response) - - -# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-11-22/examples/SyncSets_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_sets_list.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_sets_list.py deleted file mode 100644 index fd74ad342b78..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_sets_list.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-redhatopenshift -# USAGE - python sync_sets_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureRedHatOpenShiftClient( - credential=DefaultAzureCredential(), - subscription_id="subscriptionId", - ) - - response = client.sync_sets.list( - resource_group_name="resourceGroup", - resource_name="resourceName", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-11-22/examples/SyncSets_List.json -if __name__ == "__main__": - main() 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 deleted file mode 100644 index 0245456fcab3..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_samples/sync_sets_update.py +++ /dev/null @@ -1,48 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-redhatopenshift -# USAGE - python sync_sets_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureRedHatOpenShiftClient( - credential=DefaultAzureCredential(), - subscription_id="subscriptionId", - ) - - response = client.sync_sets.update( - resource_group_name="resourceGroup", - resource_name="resourceName", - child_resource_name="childResourceName", - parameters={ - "properties": { - "resources": "eyAKICAiYXBpVmVyc2lvbiI6ICJoaXZlLm9wZW5zaGlmdC5pby92MSIsCiAgImtpbmQiOiAiU3luY1NldCIsCiAgIm1ldGFkYXRhIjogewogICAgIm5hbWUiOiAic2FtcGxlIiwKICAgICJuYW1lc3BhY2UiOiAiYXJvLWY2MGFlOGEyLWJjYTEtNDk4Ny05MDU2LWYyZjZhMTgzN2NhYSIKICB9LAogICJzcGVjIjogewogICAgImNsdXN0ZXJEZXBsb3ltZW50UmVmcyI6IFtdLAogICAgInJlc291cmNlcyI6IFsKICAgICAgewogICAgICAgICJhcGlWZXJzaW9uIjogInYxIiwKICAgICAgICAia2luZCI6ICJDb25maWdNYXAiLAogICAgICAgICJtZXRhZGF0YSI6IHsKICAgICAgICAgICJuYW1lIjogIm15Y29uZmlnbWFwIgogICAgICAgIH0KICAgICAgfQogICAgXQogIH0KfQo=" - } - }, - ) - print(response) - - -# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-11-22/examples/SyncSets_Update.json -if __name__ == "__main__": - main() diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/conftest.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/conftest.py index 1d003dbdd652..4f728b9fae96 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/conftest.py +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/conftest.py @@ -18,7 +18,7 @@ load_dotenv() -# aovid record sensitive identity information in recordings +# For security, please avoid record sensitive identity information in recordings @pytest.fixture(scope="session", autouse=True) def add_sanitizers(test_proxy): azureredhatopenshift_subscription_id = os.environ.get( 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 4a277fa65254..4206536470e4 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 @@ -20,9 +20,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_open_shift_clusters_list(self, resource_group): response = self.client.open_shift_clusters.list( - api_version="2023-11-22", + api_version="2025-07-25", ) result = [r for r in response] # please add some check logic here by yourself @@ -30,10 +30,10 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_resource_group(self, resource_group): + def test_open_shift_clusters_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", + api_version="2025-07-25", ) result = [r for r in response] # please add some check logic here by yourself @@ -41,11 +41,11 @@ def test_list_by_resource_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_open_shift_clusters_get(self, resource_group): response = self.client.open_shift_clusters.get( resource_group_name=resource_group.name, resource_name="str", - api_version="2023-11-22", + api_version="2025-07-25", ) # please add some check logic here by yourself @@ -53,7 +53,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_or_update(self, resource_group): + def test_open_shift_clusters_begin_create_or_update(self, resource_group): response = self.client.open_shift_clusters.begin_create_or_update( resource_group_name=resource_group.name, resource_name="str", @@ -63,12 +63,19 @@ def test_begin_create_or_update(self, resource_group): "clusterProfile": { "domain": "str", "fipsValidatedModules": "str", + "oidcIssuer": "str", "pullSecret": "str", "resourceGroupId": "str", "version": "str", }, "consoleProfile": {"url": "str"}, "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "ingressProfiles": [{"ip": "str", "name": "str", "visibility": "str"}], "masterProfile": { "diskEncryptionSetId": "str", @@ -87,6 +94,10 @@ def test_begin_create_or_update(self, resource_group): "preconfiguredNSG": "str", "serviceCidr": "str", }, + "platformWorkloadIdentityProfile": { + "platformWorkloadIdentities": {"str": {"clientId": "str", "objectId": "str", "resourceId": "str"}}, + "upgradeableTo": "str", + }, "provisioningState": "str", "servicePrincipalProfile": {"clientId": "str", "clientSecret": "str"}, "systemData": { @@ -122,7 +133,7 @@ def test_begin_create_or_update(self, resource_group): } ], }, - api_version="2023-11-22", + api_version="2025-07-25", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -130,11 +141,11 @@ def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_open_shift_clusters_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-11-22", + api_version="2025-07-25", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -142,7 +153,7 @@ def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_update(self, resource_group): + def test_open_shift_clusters_begin_update(self, resource_group): response = self.client.open_shift_clusters.begin_update( resource_group_name=resource_group.name, resource_name="str", @@ -151,11 +162,18 @@ def test_begin_update(self, resource_group): "clusterProfile": { "domain": "str", "fipsValidatedModules": "str", + "oidcIssuer": "str", "pullSecret": "str", "resourceGroupId": "str", "version": "str", }, "consoleProfile": {"url": "str"}, + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "ingressProfiles": [{"ip": "str", "name": "str", "visibility": "str"}], "masterProfile": { "diskEncryptionSetId": "str", @@ -173,16 +191,12 @@ def test_begin_update(self, resource_group): "preconfiguredNSG": "str", "serviceCidr": "str", }, + "platformWorkloadIdentityProfile": { + "platformWorkloadIdentities": {"str": {"clientId": "str", "objectId": "str", "resourceId": "str"}}, + "upgradeableTo": "str", + }, "provisioningState": "str", "servicePrincipalProfile": {"clientId": "str", "clientSecret": "str"}, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, "tags": {"str": "str"}, "workerProfiles": [ { @@ -207,7 +221,7 @@ def test_begin_update(self, resource_group): } ], }, - api_version="2023-11-22", + api_version="2025-07-25", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -215,11 +229,11 @@ def test_begin_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_admin_credentials(self, resource_group): + def test_open_shift_clusters_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-11-22", + api_version="2025-07-25", ) # please add some check logic here by yourself @@ -227,11 +241,11 @@ def test_list_admin_credentials(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_credentials(self, resource_group): + def test_open_shift_clusters_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-11-22", + api_version="2025-07-25", ) # 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 8983ff4be505..cec3c2dd670b 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 @@ -21,9 +21,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_open_shift_clusters_list(self, resource_group): response = self.client.open_shift_clusters.list( - api_version="2023-11-22", + api_version="2025-07-25", ) result = [r async for r in response] # please add some check logic here by yourself @@ -31,10 +31,10 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_resource_group(self, resource_group): + async def test_open_shift_clusters_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", + api_version="2025-07-25", ) result = [r async for r in response] # please add some check logic here by yourself @@ -42,11 +42,11 @@ async def test_list_by_resource_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_open_shift_clusters_get(self, resource_group): response = await self.client.open_shift_clusters.get( resource_group_name=resource_group.name, resource_name="str", - api_version="2023-11-22", + api_version="2025-07-25", ) # please add some check logic here by yourself @@ -54,7 +54,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_or_update(self, resource_group): + async def test_open_shift_clusters_begin_create_or_update(self, resource_group): response = await ( await self.client.open_shift_clusters.begin_create_or_update( resource_group_name=resource_group.name, @@ -65,12 +65,19 @@ async def test_begin_create_or_update(self, resource_group): "clusterProfile": { "domain": "str", "fipsValidatedModules": "str", + "oidcIssuer": "str", "pullSecret": "str", "resourceGroupId": "str", "version": "str", }, "consoleProfile": {"url": "str"}, "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "ingressProfiles": [{"ip": "str", "name": "str", "visibility": "str"}], "masterProfile": { "diskEncryptionSetId": "str", @@ -89,6 +96,12 @@ async def test_begin_create_or_update(self, resource_group): "preconfiguredNSG": "str", "serviceCidr": "str", }, + "platformWorkloadIdentityProfile": { + "platformWorkloadIdentities": { + "str": {"clientId": "str", "objectId": "str", "resourceId": "str"} + }, + "upgradeableTo": "str", + }, "provisioningState": "str", "servicePrincipalProfile": {"clientId": "str", "clientSecret": "str"}, "systemData": { @@ -124,7 +137,7 @@ async def test_begin_create_or_update(self, resource_group): } ], }, - api_version="2023-11-22", + api_version="2025-07-25", ) ).result() # call '.result()' to poll until service return final result @@ -133,12 +146,12 @@ async def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_open_shift_clusters_begin_delete(self, resource_group): response = await ( await self.client.open_shift_clusters.begin_delete( resource_group_name=resource_group.name, resource_name="str", - api_version="2023-11-22", + api_version="2025-07-25", ) ).result() # call '.result()' to poll until service return final result @@ -147,7 +160,7 @@ async def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_update(self, resource_group): + async def test_open_shift_clusters_begin_update(self, resource_group): response = await ( await self.client.open_shift_clusters.begin_update( resource_group_name=resource_group.name, @@ -157,11 +170,18 @@ async def test_begin_update(self, resource_group): "clusterProfile": { "domain": "str", "fipsValidatedModules": "str", + "oidcIssuer": "str", "pullSecret": "str", "resourceGroupId": "str", "version": "str", }, "consoleProfile": {"url": "str"}, + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "ingressProfiles": [{"ip": "str", "name": "str", "visibility": "str"}], "masterProfile": { "diskEncryptionSetId": "str", @@ -179,16 +199,14 @@ async def test_begin_update(self, resource_group): "preconfiguredNSG": "str", "serviceCidr": "str", }, + "platformWorkloadIdentityProfile": { + "platformWorkloadIdentities": { + "str": {"clientId": "str", "objectId": "str", "resourceId": "str"} + }, + "upgradeableTo": "str", + }, "provisioningState": "str", "servicePrincipalProfile": {"clientId": "str", "clientSecret": "str"}, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, "tags": {"str": "str"}, "workerProfiles": [ { @@ -213,7 +231,7 @@ async def test_begin_update(self, resource_group): } ], }, - api_version="2023-11-22", + api_version="2025-07-25", ) ).result() # call '.result()' to poll until service return final result @@ -222,11 +240,11 @@ async def test_begin_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_admin_credentials(self, resource_group): + async def test_open_shift_clusters_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-11-22", + api_version="2025-07-25", ) # please add some check logic here by yourself @@ -234,11 +252,11 @@ async def test_list_admin_credentials(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_credentials(self, resource_group): + async def test_open_shift_clusters_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-11-22", + api_version="2025-07-25", ) # 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 cf56e7397727..9dca344b1f2b 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 @@ -20,11 +20,23 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_open_shift_versions_list(self, resource_group): response = self.client.open_shift_versions.list( location="str", - api_version="2023-11-22", + api_version="2025-07-25", ) result = [r for r in response] # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_open_shift_versions_get(self, resource_group): + response = self.client.open_shift_versions.get( + location="str", + open_shift_version="str", + api_version="2025-07-25", + ) + + # 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 f0a4299c977c..91fc0f1381ff 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 @@ -21,11 +21,23 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_open_shift_versions_list(self, resource_group): response = self.client.open_shift_versions.list( location="str", - api_version="2023-11-22", + api_version="2025-07-25", ) result = [r async for r in response] # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_open_shift_versions_get(self, resource_group): + response = await self.client.open_shift_versions.get( + location="str", + open_shift_version="str", + api_version="2025-07-25", + ) + + # 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 1b121b0a67d5..82fd8ffdb277 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 @@ -20,9 +20,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_operations_list(self, resource_group): response = self.client.operations.list( - api_version="2023-11-22", + api_version="2025-07-25", ) 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 3e3e3df01417..2e1d5e1d73e4 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 @@ -21,9 +21,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_operations_list(self, resource_group): response = self.client.operations.list( - api_version="2023-11-22", + api_version="2025-07-25", ) 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_platform_workload_identity_role_set_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_platform_workload_identity_role_set_operations.py new file mode 100644 index 000000000000..e4f26e15bb40 --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_platform_workload_identity_role_set_operations.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAzureRedHatOpenShiftPlatformWorkloadIdentityRoleSetOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureRedHatOpenShiftClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_platform_workload_identity_role_set_get(self, resource_group): + response = self.client.platform_workload_identity_role_set.get( + location="str", + open_shift_minor_version="str", + api_version="2025-07-25", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_platform_workload_identity_role_set_operations_async.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_platform_workload_identity_role_set_operations_async.py new file mode 100644 index 000000000000..a6237c0a6816 --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_platform_workload_identity_role_set_operations_async.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.redhatopenshift.aio import AzureRedHatOpenShiftClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAzureRedHatOpenShiftPlatformWorkloadIdentityRoleSetOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureRedHatOpenShiftClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_platform_workload_identity_role_set_get(self, resource_group): + response = await self.client.platform_workload_identity_role_set.get( + location="str", + open_shift_minor_version="str", + api_version="2025-07-25", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_platform_workload_identity_role_sets_operations.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_platform_workload_identity_role_sets_operations.py new file mode 100644 index 000000000000..2e7bc7acc6cd --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_platform_workload_identity_role_sets_operations.py @@ -0,0 +1,30 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.redhatopenshift import AzureRedHatOpenShiftClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAzureRedHatOpenShiftPlatformWorkloadIdentityRoleSetsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureRedHatOpenShiftClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_platform_workload_identity_role_sets_list(self, resource_group): + response = self.client.platform_workload_identity_role_sets.list( + location="str", + api_version="2025-07-25", + ) + 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_platform_workload_identity_role_sets_operations_async.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_platform_workload_identity_role_sets_operations_async.py new file mode 100644 index 000000000000..fc76eb71f1ae --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/generated_tests/test_azure_red_hat_open_shift_platform_workload_identity_role_sets_operations_async.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.redhatopenshift.aio import AzureRedHatOpenShiftClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAzureRedHatOpenShiftPlatformWorkloadIdentityRoleSetsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureRedHatOpenShiftClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_platform_workload_identity_role_sets_list(self, resource_group): + response = self.client.platform_workload_identity_role_sets.list( + location="str", + api_version="2025-07-25", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/pyproject.toml b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/pyproject.toml index 540da07d41af..1abaaeec3df6 100644 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/pyproject.toml +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/pyproject.toml @@ -1,6 +1,88 @@ +[build-system] +requires = [ + "setuptools>=77.0.3", + "wheel", +] +build-backend = "setuptools.build_meta" + +[project] +name = "azure-mgmt-redhatopenshift" +authors = [ + { name = "Microsoft Corporation", email = "azpysdkhelp@microsoft.com" }, +] +description = "Microsoft Azure Redhatopenshift Management Client Library for Python" +license = "MIT" +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", +] +requires-python = ">=3.9" +keywords = [ + "azure", + "azure sdk", +] +dependencies = [ + "isodate>=0.6.1", + "azure-mgmt-core>=1.6.0", + "typing-extensions>=4.6.0", +] +dynamic = [ + "version", + "readme", +] + +[project.urls] +repository = "https://github.com/Azure/azure-sdk-for-python" + +[tool.setuptools.dynamic.version] +attr = "azure.mgmt.redhatopenshift._version.VERSION" + +[tool.setuptools.dynamic.readme] +file = [ + "README.md", + "CHANGELOG.md", +] +content-type = "text/markdown" + +[tool.setuptools.packages.find] +exclude = [ + "tests*", + "generated_tests*", + "samples*", + "generated_samples*", + "doc*", + "azure", + "azure.mgmt", +] + +[tool.setuptools.package-data] +pytyped = [ + "py.typed", +] + [tool.azure-sdk-build] breaking = false mypy = false pyright = false type_check_samples = false verifytypes = false + +[packaging] +package_name = "azure-mgmt-redhatopenshift" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "Red Hat Openshift Management" +package_doc_id = "" +is_stable = true +is_arm = true +title = "AzureRedHatOpenShiftClient" +need_msrestazure = false +need_azuremgmtcore = true +sample_link = "" +exclude_folders = "" diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/sdk_packaging.toml b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/sdk_packaging.toml deleted file mode 100644 index 6a26b763158e..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/sdk_packaging.toml +++ /dev/null @@ -1,8 +0,0 @@ -[packaging] -package_name = "azure-mgmt-redhatopenshift" -package_nspkg = "azure-mgmt-nspkg" -package_pprint_name = "Red Hat Openshift Management" -package_doc_id = "" -is_stable = true -is_arm = true -title = "AzureRedHatOpenShiftClient" diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/setup.py b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/setup.py deleted file mode 100644 index 49d37ccedc5f..000000000000 --- a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/setup.py +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env python - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -import re -import os.path -from io import open -from setuptools import find_packages, setup - -# Change the PACKAGE_NAME only to change folder and different name -PACKAGE_NAME = "azure-mgmt-redhatopenshift" -PACKAGE_PPRINT_NAME = "Red Hat Openshift Management" - -# a-b-c => a/b/c -package_folder_path = PACKAGE_NAME.replace("-", "/") -# a-b-c => a.b.c -namespace_name = PACKAGE_NAME.replace("-", ".") - -# Version extraction inspired from 'requests' -with open( - ( - os.path.join(package_folder_path, "version.py") - if os.path.exists(os.path.join(package_folder_path, "version.py")) - else os.path.join(package_folder_path, "_version.py") - ), - "r", -) as fd: - version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) - -if not version: - raise RuntimeError("Cannot find version information") - -with open("README.md", encoding="utf-8") as f: - readme = f.read() -with open("CHANGELOG.md", encoding="utf-8") as f: - changelog = f.read() - -setup( - name=PACKAGE_NAME, - version=version, - description="Microsoft Azure {} Client Library for Python".format(PACKAGE_PPRINT_NAME), - long_description=readme + "\n\n" + changelog, - long_description_content_type="text/markdown", - license="MIT License", - author="Microsoft Corporation", - author_email="azpysdkhelp@microsoft.com", - url="https://github.com/Azure/azure-sdk-for-python", - keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Programming Language :: Python", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "License :: OSI Approved :: MIT License", - ], - zip_safe=False, - packages=find_packages( - exclude=[ - "tests", - # Exclude packages that will be covered by PEP420 or nspkg - "azure", - "azure.mgmt", - ] - ), - include_package_data=True, - package_data={ - "pytyped": ["py.typed"], - }, - install_requires=[ - "isodate>=0.6.1", - "typing-extensions>=4.6.0", - "azure-common>=1.1", - "azure-mgmt-core>=1.3.2", - ], - python_requires=">=3.8", -)