зеркало из
1
0
Форкнуть 0

[AutoRelease] t2-redhatopenshift-2022-12-12-13775(can only be merged by SDK owner) (#27907)

* code and test

* Update CHANGELOG.md

Co-authored-by: PythonSdkPipelines <PythonSdkPipelines>
Co-authored-by: Yuchao Yan <yuchaoyan@microsoft.com>
This commit is contained in:
Azure SDK Bot 2023-01-16 21:00:02 -08:00 коммит произвёл GitHub
Родитель 3961f7cd13
Коммит 6b4d70aecc
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
117 изменённых файлов: 18850 добавлений и 3865 удалений

Просмотреть файл

@ -1,5 +1,17 @@
# Release History
## 1.2.0 (2023-01-17)
### Features Added
- Added operation group MachinePoolsOperations
- Added operation group OpenShiftVersionsOperations
- Added operation group SecretsOperations
- Added operation group SyncIdentityProvidersOperations
- Added operation group SyncSetsOperations
- Model Resource has a new parameter system_data
- Model TrackedResource has a new parameter system_data
## 1.1.0 (2022-05-10)
**Features**

Просмотреть файл

@ -1,6 +1,8 @@
include _meta.json
recursive-include tests *.py *.yaml
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

Просмотреть файл

@ -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.6+.
This package has been tested with Python 3.7+.
For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all).
## _Disclaimer_
@ -12,8 +12,6 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For
To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt)
For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/)
Code samples for this package can be found at [Red Hat Openshift Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com.

Просмотреть файл

@ -1,11 +1,11 @@
{
"autorest": "3.7.2",
"use": [
"@autorest/python@5.13.0",
"@autorest/modelerfour@4.19.3"
],
"commit": "50ed15bd61ac79f2368d769df0c207a00b9e099f",
"commit": "9b3aa35e75751e751070a7af1f96518cb8820e44",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest_command": "autorest specification/redhatopenshift/resource-manager/readme.md --multiapi --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2",
"autorest": "3.9.2",
"use": [
"@autorest/python@6.2.7",
"@autorest/modelerfour@4.24.3"
],
"autorest_command": "autorest specification/redhatopenshift/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
"readme": "specification/redhatopenshift/resource-manager/readme.md"
}

Просмотреть файл

@ -14,3 +14,7 @@ try:
patch_sdk()
except ImportError:
pass
from ._version import VERSION
__version__ = VERSION

Просмотреть файл

@ -9,20 +9,17 @@
# regenerated.
# --------------------------------------------------------------------------
from typing import TYPE_CHECKING
from msrest import Deserializer, Serializer
from typing import Any, Optional, TYPE_CHECKING
from azure.mgmt.core import ARMPipelineClient
from azure.profiles import KnownProfiles, ProfileDefinition
from azure.profiles.multiapiclient import MultiApiClientMixin
from ._configuration import AzureRedHatOpenShiftClientConfiguration
from ._serialization import Deserializer, Serializer
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any, Optional
from azure.core.credentials import TokenCredential
class _SDKClient(object):
@ -43,9 +40,9 @@ class AzureRedHatOpenShiftClient(MultiApiClientMixin, _SDKClient):
The api-version parameter sets the default API version if the operation
group is not described in the profile.
:param credential: Credential needed for the client to connect to Azure.
: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.
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:param api_version: API version to use if no profile is provided, or if missing in profile.
:type api_version: str
@ -56,7 +53,7 @@ class AzureRedHatOpenShiftClient(MultiApiClientMixin, _SDKClient):
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
"""
DEFAULT_API_VERSION = '2022-04-01'
DEFAULT_API_VERSION = '2022-09-04'
_PROFILE_TAG = "azure.mgmt.redhatopenshift.AzureRedHatOpenShiftClient"
LATEST_PROFILE = ProfileDefinition({
_PROFILE_TAG: {
@ -67,12 +64,12 @@ class AzureRedHatOpenShiftClient(MultiApiClientMixin, _SDKClient):
def __init__(
self,
credential, # type: "TokenCredential"
subscription_id, # type: str
api_version=None, # type: Optional[str]
base_url="https://management.azure.com", # type: str
profile=KnownProfiles.default, # type: KnownProfiles
**kwargs # type: Any
credential: "TokenCredential",
subscription_id: str,
api_version: Optional[str]=None,
base_url: str = "https://management.azure.com",
profile: KnownProfiles=KnownProfiles.default,
**kwargs: Any
):
self._config = AzureRedHatOpenShiftClientConfiguration(credential, subscription_id, **kwargs)
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
@ -92,6 +89,7 @@ class AzureRedHatOpenShiftClient(MultiApiClientMixin, _SDKClient):
* 2020-04-30: :mod:`v2020_04_30.models<azure.mgmt.redhatopenshift.v2020_04_30.models>`
* 2021-09-01-preview: :mod:`v2021_09_01_preview.models<azure.mgmt.redhatopenshift.v2021_09_01_preview.models>`
* 2022-04-01: :mod:`v2022_04_01.models<azure.mgmt.redhatopenshift.v2022_04_01.models>`
* 2022-09-04: :mod:`v2022_09_04.models<azure.mgmt.redhatopenshift.v2022_09_04.models>`
"""
if api_version == '2020-04-30':
from .v2020_04_30 import models
@ -102,8 +100,25 @@ class AzureRedHatOpenShiftClient(MultiApiClientMixin, _SDKClient):
elif api_version == '2022-04-01':
from .v2022_04_01 import models
return models
elif api_version == '2022-09-04':
from .v2022_09_04 import models
return models
raise ValueError("API version {} is not available".format(api_version))
@property
def machine_pools(self):
"""Instance depends on the API version:
* 2022-09-04: :class:`MachinePoolsOperations<azure.mgmt.redhatopenshift.v2022_09_04.operations.MachinePoolsOperations>`
"""
api_version = self._get_api_version('machine_pools')
if api_version == '2022-09-04':
from .v2022_09_04.operations import MachinePoolsOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'machine_pools'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def open_shift_clusters(self):
"""Instance depends on the API version:
@ -111,6 +126,7 @@ class AzureRedHatOpenShiftClient(MultiApiClientMixin, _SDKClient):
* 2020-04-30: :class:`OpenShiftClustersOperations<azure.mgmt.redhatopenshift.v2020_04_30.operations.OpenShiftClustersOperations>`
* 2021-09-01-preview: :class:`OpenShiftClustersOperations<azure.mgmt.redhatopenshift.v2021_09_01_preview.operations.OpenShiftClustersOperations>`
* 2022-04-01: :class:`OpenShiftClustersOperations<azure.mgmt.redhatopenshift.v2022_04_01.operations.OpenShiftClustersOperations>`
* 2022-09-04: :class:`OpenShiftClustersOperations<azure.mgmt.redhatopenshift.v2022_09_04.operations.OpenShiftClustersOperations>`
"""
api_version = self._get_api_version('open_shift_clusters')
if api_version == '2020-04-30':
@ -119,8 +135,25 @@ class AzureRedHatOpenShiftClient(MultiApiClientMixin, _SDKClient):
from .v2021_09_01_preview.operations import OpenShiftClustersOperations as OperationClass
elif api_version == '2022-04-01':
from .v2022_04_01.operations import OpenShiftClustersOperations as OperationClass
elif api_version == '2022-09-04':
from .v2022_09_04.operations import OpenShiftClustersOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'open_shift_clusters'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def open_shift_versions(self):
"""Instance depends on the API version:
* 2022-09-04: :class:`OpenShiftVersionsOperations<azure.mgmt.redhatopenshift.v2022_09_04.operations.OpenShiftVersionsOperations>`
"""
api_version = self._get_api_version('open_shift_versions')
if api_version == '2022-09-04':
from .v2022_09_04.operations import OpenShiftVersionsOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'open_shift_versions'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
@ -130,6 +163,7 @@ class AzureRedHatOpenShiftClient(MultiApiClientMixin, _SDKClient):
* 2020-04-30: :class:`Operations<azure.mgmt.redhatopenshift.v2020_04_30.operations.Operations>`
* 2021-09-01-preview: :class:`Operations<azure.mgmt.redhatopenshift.v2021_09_01_preview.operations.Operations>`
* 2022-04-01: :class:`Operations<azure.mgmt.redhatopenshift.v2022_04_01.operations.Operations>`
* 2022-09-04: :class:`Operations<azure.mgmt.redhatopenshift.v2022_09_04.operations.Operations>`
"""
api_version = self._get_api_version('operations')
if api_version == '2020-04-30':
@ -138,8 +172,53 @@ class AzureRedHatOpenShiftClient(MultiApiClientMixin, _SDKClient):
from .v2021_09_01_preview.operations import Operations as OperationClass
elif api_version == '2022-04-01':
from .v2022_04_01.operations import Operations as OperationClass
elif api_version == '2022-09-04':
from .v2022_09_04.operations import Operations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'operations'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def secrets(self):
"""Instance depends on the API version:
* 2022-09-04: :class:`SecretsOperations<azure.mgmt.redhatopenshift.v2022_09_04.operations.SecretsOperations>`
"""
api_version = self._get_api_version('secrets')
if api_version == '2022-09-04':
from .v2022_09_04.operations import SecretsOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'secrets'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def sync_identity_providers(self):
"""Instance depends on the API version:
* 2022-09-04: :class:`SyncIdentityProvidersOperations<azure.mgmt.redhatopenshift.v2022_09_04.operations.SyncIdentityProvidersOperations>`
"""
api_version = self._get_api_version('sync_identity_providers')
if api_version == '2022-09-04':
from .v2022_09_04.operations import SyncIdentityProvidersOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'sync_identity_providers'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def sync_sets(self):
"""Instance depends on the API version:
* 2022-09-04: :class:`SyncSetsOperations<azure.mgmt.redhatopenshift.v2022_09_04.operations.SyncSetsOperations>`
"""
api_version = self._get_api_version('sync_sets')
if api_version == '2022-09-04':
from .v2022_09_04.operations import SyncSetsOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'sync_sets'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
def close(self):

Просмотреть файл

@ -8,7 +8,7 @@
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from typing import TYPE_CHECKING
from typing import Any, TYPE_CHECKING
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
@ -18,8 +18,6 @@ from ._version import VERSION
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any
from azure.core.credentials import TokenCredential
class AzureRedHatOpenShiftClientConfiguration(Configuration):
@ -28,19 +26,18 @@ class AzureRedHatOpenShiftClientConfiguration(Configuration):
Note that all parameters used to create this instance are saved as instance
attributes.
:param credential: Credential needed for the client to connect to Azure.
: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.
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
"""
def __init__(
self,
credential, # type: "TokenCredential"
subscription_id, # type: str
**kwargs # type: Any
credential: "TokenCredential",
subscription_id: str,
**kwargs: Any
):
# type: (...) -> None
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
@ -55,9 +52,8 @@ class AzureRedHatOpenShiftClientConfiguration(Configuration):
def _configure(
self,
**kwargs # type: Any
**kwargs: Any
):
# type: (...) -> None
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -6,5 +6,5 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
VERSION = "1.1.0"
VERSION = "1.2.0"

Просмотреть файл

@ -11,17 +11,15 @@
from typing import Any, Optional, TYPE_CHECKING
from msrest import Deserializer, Serializer
from azure.mgmt.core import AsyncARMPipelineClient
from azure.profiles import KnownProfiles, ProfileDefinition
from azure.profiles.multiapiclient import MultiApiClientMixin
from .._serialization import Deserializer, Serializer
from ._configuration import AzureRedHatOpenShiftClientConfiguration
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
from azure.core.credentials_async import AsyncTokenCredential
class _SDKClient(object):
@ -42,9 +40,9 @@ class AzureRedHatOpenShiftClient(MultiApiClientMixin, _SDKClient):
The api-version parameter sets the default API version if the operation
group is not described in the profile.
:param credential: Credential needed for the client to connect to Azure.
: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.
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:param api_version: API version to use if no profile is provided, or if missing in profile.
:type api_version: str
@ -55,7 +53,7 @@ class AzureRedHatOpenShiftClient(MultiApiClientMixin, _SDKClient):
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
"""
DEFAULT_API_VERSION = '2022-04-01'
DEFAULT_API_VERSION = '2022-09-04'
_PROFILE_TAG = "azure.mgmt.redhatopenshift.AzureRedHatOpenShiftClient"
LATEST_PROFILE = ProfileDefinition({
_PROFILE_TAG: {
@ -71,7 +69,7 @@ class AzureRedHatOpenShiftClient(MultiApiClientMixin, _SDKClient):
api_version: Optional[str] = None,
base_url: str = "https://management.azure.com",
profile: KnownProfiles = KnownProfiles.default,
**kwargs # type: Any
**kwargs: Any
) -> None:
self._config = AzureRedHatOpenShiftClientConfiguration(credential, subscription_id, **kwargs)
self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
@ -91,6 +89,7 @@ class AzureRedHatOpenShiftClient(MultiApiClientMixin, _SDKClient):
* 2020-04-30: :mod:`v2020_04_30.models<azure.mgmt.redhatopenshift.v2020_04_30.models>`
* 2021-09-01-preview: :mod:`v2021_09_01_preview.models<azure.mgmt.redhatopenshift.v2021_09_01_preview.models>`
* 2022-04-01: :mod:`v2022_04_01.models<azure.mgmt.redhatopenshift.v2022_04_01.models>`
* 2022-09-04: :mod:`v2022_09_04.models<azure.mgmt.redhatopenshift.v2022_09_04.models>`
"""
if api_version == '2020-04-30':
from ..v2020_04_30 import models
@ -101,8 +100,25 @@ class AzureRedHatOpenShiftClient(MultiApiClientMixin, _SDKClient):
elif api_version == '2022-04-01':
from ..v2022_04_01 import models
return models
elif api_version == '2022-09-04':
from ..v2022_09_04 import models
return models
raise ValueError("API version {} is not available".format(api_version))
@property
def machine_pools(self):
"""Instance depends on the API version:
* 2022-09-04: :class:`MachinePoolsOperations<azure.mgmt.redhatopenshift.v2022_09_04.aio.operations.MachinePoolsOperations>`
"""
api_version = self._get_api_version('machine_pools')
if api_version == '2022-09-04':
from ..v2022_09_04.aio.operations import MachinePoolsOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'machine_pools'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def open_shift_clusters(self):
"""Instance depends on the API version:
@ -110,6 +126,7 @@ class AzureRedHatOpenShiftClient(MultiApiClientMixin, _SDKClient):
* 2020-04-30: :class:`OpenShiftClustersOperations<azure.mgmt.redhatopenshift.v2020_04_30.aio.operations.OpenShiftClustersOperations>`
* 2021-09-01-preview: :class:`OpenShiftClustersOperations<azure.mgmt.redhatopenshift.v2021_09_01_preview.aio.operations.OpenShiftClustersOperations>`
* 2022-04-01: :class:`OpenShiftClustersOperations<azure.mgmt.redhatopenshift.v2022_04_01.aio.operations.OpenShiftClustersOperations>`
* 2022-09-04: :class:`OpenShiftClustersOperations<azure.mgmt.redhatopenshift.v2022_09_04.aio.operations.OpenShiftClustersOperations>`
"""
api_version = self._get_api_version('open_shift_clusters')
if api_version == '2020-04-30':
@ -118,8 +135,25 @@ class AzureRedHatOpenShiftClient(MultiApiClientMixin, _SDKClient):
from ..v2021_09_01_preview.aio.operations import OpenShiftClustersOperations as OperationClass
elif api_version == '2022-04-01':
from ..v2022_04_01.aio.operations import OpenShiftClustersOperations as OperationClass
elif api_version == '2022-09-04':
from ..v2022_09_04.aio.operations import OpenShiftClustersOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'open_shift_clusters'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def open_shift_versions(self):
"""Instance depends on the API version:
* 2022-09-04: :class:`OpenShiftVersionsOperations<azure.mgmt.redhatopenshift.v2022_09_04.aio.operations.OpenShiftVersionsOperations>`
"""
api_version = self._get_api_version('open_shift_versions')
if api_version == '2022-09-04':
from ..v2022_09_04.aio.operations import OpenShiftVersionsOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'open_shift_versions'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
@ -129,6 +163,7 @@ class AzureRedHatOpenShiftClient(MultiApiClientMixin, _SDKClient):
* 2020-04-30: :class:`Operations<azure.mgmt.redhatopenshift.v2020_04_30.aio.operations.Operations>`
* 2021-09-01-preview: :class:`Operations<azure.mgmt.redhatopenshift.v2021_09_01_preview.aio.operations.Operations>`
* 2022-04-01: :class:`Operations<azure.mgmt.redhatopenshift.v2022_04_01.aio.operations.Operations>`
* 2022-09-04: :class:`Operations<azure.mgmt.redhatopenshift.v2022_09_04.aio.operations.Operations>`
"""
api_version = self._get_api_version('operations')
if api_version == '2020-04-30':
@ -137,8 +172,53 @@ class AzureRedHatOpenShiftClient(MultiApiClientMixin, _SDKClient):
from ..v2021_09_01_preview.aio.operations import Operations as OperationClass
elif api_version == '2022-04-01':
from ..v2022_04_01.aio.operations import Operations as OperationClass
elif api_version == '2022-09-04':
from ..v2022_09_04.aio.operations import Operations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'operations'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def secrets(self):
"""Instance depends on the API version:
* 2022-09-04: :class:`SecretsOperations<azure.mgmt.redhatopenshift.v2022_09_04.aio.operations.SecretsOperations>`
"""
api_version = self._get_api_version('secrets')
if api_version == '2022-09-04':
from ..v2022_09_04.aio.operations import SecretsOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'secrets'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def sync_identity_providers(self):
"""Instance depends on the API version:
* 2022-09-04: :class:`SyncIdentityProvidersOperations<azure.mgmt.redhatopenshift.v2022_09_04.aio.operations.SyncIdentityProvidersOperations>`
"""
api_version = self._get_api_version('sync_identity_providers')
if api_version == '2022-09-04':
from ..v2022_09_04.aio.operations import SyncIdentityProvidersOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'sync_identity_providers'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def sync_sets(self):
"""Instance depends on the API version:
* 2022-09-04: :class:`SyncSetsOperations<azure.mgmt.redhatopenshift.v2022_09_04.aio.operations.SyncSetsOperations>`
"""
api_version = self._get_api_version('sync_sets')
if api_version == '2022-09-04':
from ..v2022_09_04.aio.operations import SyncSetsOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'sync_sets'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
async def close(self):

Просмотреть файл

@ -26,9 +26,9 @@ class AzureRedHatOpenShiftClientConfiguration(Configuration):
Note that all parameters used to create this instance are saved as instance
attributes.
:param credential: Credential needed for the client to connect to Azure.
: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.
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
"""
@ -36,7 +36,7 @@ class AzureRedHatOpenShiftClientConfiguration(Configuration):
self,
credential: "AsyncTokenCredential",
subscription_id: str,
**kwargs # type: Any
**kwargs: Any
) -> None:
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")

Просмотреть файл

@ -4,4 +4,4 @@
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
from .v2022_04_01.models import *
from .v2022_09_04.models import *

Просмотреть файл

@ -10,9 +10,17 @@ from ._azure_red_hat_open_shift4_client import AzureRedHatOpenShift4Client
from ._version import VERSION
__version__ = VERSION
__all__ = ['AzureRedHatOpenShift4Client']
# `._patch.py` is used for handwritten extensions to the generated code
# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
from ._patch import patch_sdk
patch_sdk()
try:
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
__all__ = [
"AzureRedHatOpenShift4Client",
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()

Просмотреть файл

@ -9,12 +9,11 @@
from copy import deepcopy
from typing import Any, TYPE_CHECKING
from msrest import Deserializer, Serializer
from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient
from . import models
from . import models as _models
from .._serialization import Deserializer, Serializer
from ._configuration import AzureRedHatOpenShift4ClientConfiguration
from .operations import OpenShiftClustersOperations, Operations
@ -22,7 +21,8 @@ if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
class AzureRedHatOpenShift4Client:
class AzureRedHatOpenShift4Client: # pylint: disable=client-accepts-api-version-keyword
"""Rest API for Azure Red Hat OpenShift 4.
:ivar operations: Operations operations
@ -30,9 +30,9 @@ class AzureRedHatOpenShift4Client:
:ivar open_shift_clusters: OpenShiftClustersOperations operations
:vartype open_shift_clusters:
azure.mgmt.redhatopenshift.v2020_04_30.operations.OpenShiftClustersOperations
:param credential: Credential needed for the client to connect to Azure.
: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.
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
@ -50,22 +50,21 @@ class AzureRedHatOpenShift4Client:
base_url: str = "https://management.azure.com",
**kwargs: Any
) -> None:
self._config = AzureRedHatOpenShift4ClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
self._config = AzureRedHatOpenShift4ClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
self.open_shift_clusters = OpenShiftClustersOperations(self._client, self._config, self._serialize, self._deserialize)
self.open_shift_clusters = OpenShiftClustersOperations(
self._client, self._config, self._serialize, self._deserialize
)
def _send_request(
self,
request: HttpRequest,
**kwargs: Any
) -> HttpResponse:
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
@ -74,7 +73,7 @@ class AzureRedHatOpenShift4Client:
>>> response = client._send_request(request)
<HttpResponse: 200 OK>
For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
:param request: The network request you want to make. Required.
:type request: ~azure.core.rest.HttpRequest
@ -87,15 +86,12 @@ class AzureRedHatOpenShift4Client:
request_copy.url = self._client.format_url(request_copy.url)
return self._client.send_request(request_copy, **kwargs)
def close(self):
# type: () -> None
def close(self) -> None:
self._client.close()
def __enter__(self):
# type: () -> AzureRedHatOpenShift4Client
def __enter__(self) -> "AzureRedHatOpenShift4Client":
self._client.__enter__()
return self
def __exit__(self, *exc_details):
# type: (Any) -> None
def __exit__(self, *exc_details) -> None:
self._client.__exit__(*exc_details)

Просмотреть файл

@ -6,6 +6,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import sys
from typing import Any, TYPE_CHECKING
from azure.core.configuration import Configuration
@ -14,6 +15,11 @@ from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLo
from ._version import VERSION
if sys.version_info >= (3, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
@ -25,23 +31,18 @@ class AzureRedHatOpenShift4ClientConfiguration(Configuration): # pylint: disabl
Note that all parameters used to create this instance are saved as instance
attributes.
:param credential: Credential needed for the client to connect to Azure.
: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.
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2020-04-30". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""
def __init__(
self,
credential: "TokenCredential",
subscription_id: str,
**kwargs: Any
) -> None:
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
super(AzureRedHatOpenShift4ClientConfiguration, self).__init__(**kwargs)
api_version = kwargs.pop('api_version', "2020-04-30") # type: str
api_version: Literal["2020-04-30"] = kwargs.pop("api_version", "2020-04-30")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
@ -51,23 +52,21 @@ class AzureRedHatOpenShift4ClientConfiguration(Configuration): # pylint: disabl
self.credential = credential
self.subscription_id = subscription_id
self.api_version = api_version
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-redhatopenshift/{}'.format(VERSION))
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-redhatopenshift/{}".format(VERSION))
self._configure(**kwargs)
def _configure(
self,
**kwargs # type: Any
):
# type: (...) -> None
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
def _configure(self, **kwargs: Any) -> None:
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)
self.authentication_policy = ARMChallengeAuthenticationPolicy(
self.credential, *self.credential_scopes, **kwargs
)

Просмотреть файл

@ -10,20 +10,20 @@
"azure_arm": true,
"has_lro_operations": true,
"client_side_validation": false,
"sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AzureRedHatOpenShift4ClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}",
"async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AzureRedHatOpenShift4ClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}"
"sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AzureRedHatOpenShift4ClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
"async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AzureRedHatOpenShift4ClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"global_parameters": {
"sync": {
"credential": {
"signature": "credential, # type: \"TokenCredential\"",
"description": "Credential needed for the client to connect to Azure.",
"signature": "credential: \"TokenCredential\",",
"description": "Credential needed for the client to connect to Azure. Required.",
"docstring_type": "~azure.core.credentials.TokenCredential",
"required": true
},
"subscription_id": {
"signature": "subscription_id, # type: str",
"description": "The ID of the target subscription.",
"signature": "subscription_id: str,",
"description": "The ID of the target subscription. Required.",
"docstring_type": "str",
"required": true
}
@ -31,13 +31,13 @@
"async": {
"credential": {
"signature": "credential: \"AsyncTokenCredential\",",
"description": "Credential needed for the client to connect to Azure.",
"description": "Credential needed for the client to connect to Azure. Required.",
"docstring_type": "~azure.core.credentials_async.AsyncTokenCredential",
"required": true
},
"subscription_id": {
"signature": "subscription_id: str,",
"description": "The ID of the target subscription.",
"description": "The ID of the target subscription. Required.",
"docstring_type": "str",
"required": true
}
@ -48,19 +48,19 @@
"service_client_specific": {
"sync": {
"api_version": {
"signature": "api_version=None, # type: Optional[str]",
"signature": "api_version: Optional[str]=None,",
"description": "API version to use if no profile is provided, or if missing in profile.",
"docstring_type": "str",
"required": false
},
"base_url": {
"signature": "base_url=\"https://management.azure.com\", # type: str",
"signature": "base_url: str = \"https://management.azure.com\",",
"description": "Service URL",
"docstring_type": "str",
"required": false
},
"profile": {
"signature": "profile=KnownProfiles.default, # type: KnownProfiles",
"signature": "profile: KnownProfiles=KnownProfiles.default,",
"description": "A profile definition, from KnownProfiles to dict.",
"docstring_type": "azure.profiles.KnownProfiles",
"required": false
@ -100,4 +100,4 @@
"operations": "Operations",
"open_shift_clusters": "OpenShiftClustersOperations"
}
}
}

Просмотреть файл

@ -28,4 +28,4 @@
# This file is used for handwritten extensions to the generated code. Example:
# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
def patch_sdk():
pass
pass

Просмотреть файл

@ -7,6 +7,7 @@
from azure.core.pipeline.transport import HttpRequest
def _convert_request(request, files=None):
data = request.content if not files else None
request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data)
@ -14,6 +15,7 @@ def _convert_request(request, files=None):
request.set_formdata_body(files)
return request
def _format_url_section(template, **kwargs):
components = template.split("/")
while components:
@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs):
return template.format(**kwargs)
except KeyError as key:
formatted_components = template.split("/")
components = [
c for c in formatted_components if "{}".format(key.args[0]) not in c
]
components = [c for c in formatted_components if "{}".format(key.args[0]) not in c]
template = "/".join(components)

Просмотреть файл

@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
VERSION = "1.1.0"
VERSION = "1.2.0"

Просмотреть файл

@ -7,9 +7,17 @@
# --------------------------------------------------------------------------
from ._azure_red_hat_open_shift4_client import AzureRedHatOpenShift4Client
__all__ = ['AzureRedHatOpenShift4Client']
# `._patch.py` is used for handwritten extensions to the generated code
# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
from ._patch import patch_sdk
patch_sdk()
try:
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
__all__ = [
"AzureRedHatOpenShift4Client",
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()

Просмотреть файл

@ -9,12 +9,11 @@
from copy import deepcopy
from typing import Any, Awaitable, TYPE_CHECKING
from msrest import Deserializer, Serializer
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.mgmt.core import AsyncARMPipelineClient
from .. import models
from .. import models as _models
from ..._serialization import Deserializer, Serializer
from ._configuration import AzureRedHatOpenShift4ClientConfiguration
from .operations import OpenShiftClustersOperations, Operations
@ -22,7 +21,8 @@ if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
class AzureRedHatOpenShift4Client:
class AzureRedHatOpenShift4Client: # pylint: disable=client-accepts-api-version-keyword
"""Rest API for Azure Red Hat OpenShift 4.
:ivar operations: Operations operations
@ -30,9 +30,9 @@ class AzureRedHatOpenShift4Client:
:ivar open_shift_clusters: OpenShiftClustersOperations operations
:vartype open_shift_clusters:
azure.mgmt.redhatopenshift.v2020_04_30.aio.operations.OpenShiftClustersOperations
:param credential: Credential needed for the client to connect to Azure.
: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.
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
@ -50,22 +50,21 @@ class AzureRedHatOpenShift4Client:
base_url: str = "https://management.azure.com",
**kwargs: Any
) -> None:
self._config = AzureRedHatOpenShift4ClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
self._config = AzureRedHatOpenShift4ClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
self.open_shift_clusters = OpenShiftClustersOperations(self._client, self._config, self._serialize, self._deserialize)
self.open_shift_clusters = OpenShiftClustersOperations(
self._client, self._config, self._serialize, self._deserialize
)
def _send_request(
self,
request: HttpRequest,
**kwargs: Any
) -> Awaitable[AsyncHttpResponse]:
def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
@ -74,7 +73,7 @@ class AzureRedHatOpenShift4Client:
>>> response = await client._send_request(request)
<AsyncHttpResponse: 200 OK>
For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
:param request: The network request you want to make. Required.
:type request: ~azure.core.rest.HttpRequest

Просмотреть файл

@ -6,6 +6,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import sys
from typing import Any, TYPE_CHECKING
from azure.core.configuration import Configuration
@ -14,6 +15,11 @@ from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuth
from .._version import VERSION
if sys.version_info >= (3, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
@ -25,23 +31,18 @@ class AzureRedHatOpenShift4ClientConfiguration(Configuration): # pylint: disabl
Note that all parameters used to create this instance are saved as instance
attributes.
:param credential: Credential needed for the client to connect to Azure.
: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.
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2020-04-30". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""
def __init__(
self,
credential: "AsyncTokenCredential",
subscription_id: str,
**kwargs: Any
) -> None:
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
super(AzureRedHatOpenShift4ClientConfiguration, self).__init__(**kwargs)
api_version = kwargs.pop('api_version', "2020-04-30") # type: str
api_version: Literal["2020-04-30"] = kwargs.pop("api_version", "2020-04-30")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
@ -51,22 +52,21 @@ class AzureRedHatOpenShift4ClientConfiguration(Configuration): # pylint: disabl
self.credential = credential
self.subscription_id = subscription_id
self.api_version = api_version
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-redhatopenshift/{}'.format(VERSION))
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-redhatopenshift/{}".format(VERSION))
self._configure(**kwargs)
def _configure(
self,
**kwargs: Any
) -> None:
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
def _configure(self, **kwargs: Any) -> None:
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)
self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(
self.credential, *self.credential_scopes, **kwargs
)

Просмотреть файл

@ -28,4 +28,4 @@
# This file is used for handwritten extensions to the generated code. Example:
# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
def patch_sdk():
pass
pass

Просмотреть файл

@ -9,7 +9,13 @@
from ._operations import Operations
from ._open_shift_clusters_operations import OpenShiftClustersOperations
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
from ._patch import patch_sdk as _patch_sdk
__all__ = [
'Operations',
'OpenShiftClustersOperations',
"Operations",
"OpenShiftClustersOperations",
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()

Просмотреть файл

@ -6,81 +6,107 @@
# 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, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import 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 ..._vendor import _convert_request
from ...operations._operations import build_list_request
T = TypeVar('T')
if sys.version_info >= (3, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class Operations:
"""Operations async operations.
"""
.. warning::
**DO NOT** instantiate this class directly.
You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
:ivar models: Alias to model classes used in this operation group.
:type models: ~azure.mgmt.redhatopenshift.v2020_04_30.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
Instead, you should access the following operations through
:class:`~azure.mgmt.redhatopenshift.v2020_04_30.aio.AzureRedHatOpenShift4Client`'s
:attr:`operations` attribute.
"""
models = _models
def __init__(self, client, config, serializer, deserializer) -> None:
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config
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,
**kwargs: Any
) -> AsyncIterable["_models.OperationList"]:
def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]:
"""Lists all of the available RP operations.
The operation returns the RP operations.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either OperationList or the result of cls(response)
:return: An iterator like instance of either Operation or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2020_04_30.models.OperationList]
:raises: ~azure.core.exceptions.HttpResponseError
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2020_04_30.models.Operation]
:raises ~azure.core.exceptions.HttpResponseError:
"""
api_version = kwargs.pop('api_version', "2020-04-30") # type: str
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: Literal["2020-04-30"] = kwargs.pop("api_version", _params.pop("api-version", "2020-04-30"))
cls: ClsType[_models.OperationList] = kwargs.pop("cls", None)
cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationList"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop('error_map', {}))
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
api_version=api_version,
template_url=self.list.metadata['url'],
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
request = build_list_request(
api_version=api_version,
template_url=next_link,
# 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 = _convert_request(request)
request.url = self._client.format_url(request.url)
@ -91,16 +117,14 @@ class Operations:
deserialized = self._deserialize("OperationList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
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)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
@ -110,8 +134,6 @@ class Operations:
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
return AsyncItemPaged(
get_next, extract_data
)
list.metadata = {'url': "/providers/Microsoft.RedHatOpenShift/operations"} # type: ignore
list.metadata = {"url": "/providers/Microsoft.RedHatOpenShift/operations"}

Просмотреть файл

@ -0,0 +1,20 @@
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
"""Customize generated code here.
Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
"""
from typing import List
__all__: List[str] = [] # Add all objects you want publicly available to users at this package level
def patch_sdk():
"""Do not remove from this file.
`patch_sdk` is a last resort escape hatch that allows you to do customizations
you can't accomplish using the techniques described in
https://aka.ms/azsdk/python/dpcodegen/python/customize
"""

Просмотреть файл

@ -25,33 +25,35 @@ from ._models_py3 import ServicePrincipalProfile
from ._models_py3 import TrackedResource
from ._models_py3 import WorkerProfile
from ._azure_red_hat_open_shift4_client_enums import (
ProvisioningState,
VMSize,
Visibility,
)
from ._azure_red_hat_open_shift4_client_enums import ProvisioningState
from ._azure_red_hat_open_shift4_client_enums import VMSize
from ._azure_red_hat_open_shift4_client_enums import Visibility
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
from ._patch import patch_sdk as _patch_sdk
__all__ = [
'APIServerProfile',
'CloudErrorBody',
'ClusterProfile',
'ConsoleProfile',
'Display',
'IngressProfile',
'MasterProfile',
'NetworkProfile',
'OpenShiftCluster',
'OpenShiftClusterCredentials',
'OpenShiftClusterList',
'OpenShiftClusterUpdate',
'Operation',
'OperationList',
'Resource',
'ServicePrincipalProfile',
'TrackedResource',
'WorkerProfile',
'ProvisioningState',
'VMSize',
'Visibility',
"APIServerProfile",
"CloudErrorBody",
"ClusterProfile",
"ConsoleProfile",
"Display",
"IngressProfile",
"MasterProfile",
"NetworkProfile",
"OpenShiftCluster",
"OpenShiftClusterCredentials",
"OpenShiftClusterList",
"OpenShiftClusterUpdate",
"Operation",
"OperationList",
"Resource",
"ServicePrincipalProfile",
"TrackedResource",
"WorkerProfile",
"ProvisioningState",
"VMSize",
"Visibility",
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()

Просмотреть файл

@ -7,13 +7,11 @@
# --------------------------------------------------------------------------
from enum import Enum
from six import with_metaclass
from azure.core import CaseInsensitiveEnumMeta
class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
"""ProvisioningState represents a provisioning state.
"""
class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""ProvisioningState represents a provisioning state."""
ADMIN_UPDATING = "AdminUpdating"
CREATING = "Creating"
@ -22,16 +20,16 @@ class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
SUCCEEDED = "Succeeded"
UPDATING = "Updating"
class Visibility(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
"""Visibility represents visibility.
"""
class Visibility(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Visibility represents visibility."""
PRIVATE = "Private"
PUBLIC = "Public"
class VMSize(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
"""VMSize represents a VM size.
"""
class VMSize(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""VMSize represents a VM size."""
STANDARD_D2_S_V3 = "Standard_D2s_v3"
STANDARD_D4_S_V3 = "Standard_D4s_v3"

Просмотреть файл

@ -1,4 +1,5 @@
# 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.
@ -6,18 +7,19 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Dict, List, Optional, Union
from typing import Dict, List, Optional, TYPE_CHECKING, Union
import msrest.serialization
from ... import _serialization
from ._azure_red_hat_open_shift4_client_enums import *
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
class APIServerProfile(msrest.serialization.Model):
class APIServerProfile(_serialization.Model):
"""APIServerProfile represents an API server profile.
:ivar visibility: API server visibility (immutable). Possible values include: "Private",
"Public".
:ivar visibility: API server visibility (immutable). Known values are: "Private" and "Public".
:vartype visibility: str or ~azure.mgmt.redhatopenshift.v2020_04_30.models.Visibility
:ivar url: The URL to access the cluster API server (immutable).
:vartype url: str
@ -26,21 +28,21 @@ class APIServerProfile(msrest.serialization.Model):
"""
_attribute_map = {
'visibility': {'key': 'visibility', 'type': 'str'},
'url': {'key': 'url', 'type': 'str'},
'ip': {'key': 'ip', 'type': 'str'},
"visibility": {"key": "visibility", "type": "str"},
"url": {"key": "url", "type": "str"},
"ip": {"key": "ip", "type": "str"},
}
def __init__(
self,
*,
visibility: Optional[Union[str, "Visibility"]] = None,
visibility: Optional[Union[str, "_models.Visibility"]] = None,
url: Optional[str] = None,
ip: Optional[str] = None,
**kwargs
):
"""
:keyword visibility: API server visibility (immutable). Possible values include: "Private",
:keyword visibility: API server visibility (immutable). Known values are: "Private" and
"Public".
:paramtype visibility: str or ~azure.mgmt.redhatopenshift.v2020_04_30.models.Visibility
:keyword url: The URL to access the cluster API server (immutable).
@ -48,13 +50,13 @@ class APIServerProfile(msrest.serialization.Model):
:keyword ip: The IP of the cluster API server (immutable).
:paramtype ip: str
"""
super(APIServerProfile, self).__init__(**kwargs)
super().__init__(**kwargs)
self.visibility = visibility
self.url = url
self.ip = ip
class CloudErrorBody(msrest.serialization.Model):
class CloudErrorBody(_serialization.Model):
"""CloudErrorBody represents the body of a cloud error.
:ivar code: An identifier for the error. Codes are invariant and are intended to be consumed
@ -71,10 +73,10 @@ class CloudErrorBody(msrest.serialization.Model):
"""
_attribute_map = {
'code': {'key': 'code', 'type': 'str'},
'message': {'key': 'message', 'type': 'str'},
'target': {'key': 'target', 'type': 'str'},
'details': {'key': 'details', 'type': '[CloudErrorBody]'},
"code": {"key": "code", "type": "str"},
"message": {"key": "message", "type": "str"},
"target": {"key": "target", "type": "str"},
"details": {"key": "details", "type": "[CloudErrorBody]"},
}
def __init__(
@ -83,7 +85,7 @@ class CloudErrorBody(msrest.serialization.Model):
code: Optional[str] = None,
message: Optional[str] = None,
target: Optional[str] = None,
details: Optional[List["CloudErrorBody"]] = None,
details: Optional[List["_models.CloudErrorBody"]] = None,
**kwargs
):
"""
@ -99,14 +101,14 @@ class CloudErrorBody(msrest.serialization.Model):
:keyword details: A list of additional details about the error.
:paramtype details: list[~azure.mgmt.redhatopenshift.v2020_04_30.models.CloudErrorBody]
"""
super(CloudErrorBody, self).__init__(**kwargs)
super().__init__(**kwargs)
self.code = code
self.message = message
self.target = target
self.details = details
class ClusterProfile(msrest.serialization.Model):
class ClusterProfile(_serialization.Model):
"""ClusterProfile represents a cluster profile.
:ivar pull_secret: The pull secret for the cluster (immutable).
@ -120,10 +122,10 @@ class ClusterProfile(msrest.serialization.Model):
"""
_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'},
"pull_secret": {"key": "pullSecret", "type": "str"},
"domain": {"key": "domain", "type": "str"},
"version": {"key": "version", "type": "str"},
"resource_group_id": {"key": "resourceGroupId", "type": "str"},
}
def __init__(
@ -145,14 +147,14 @@ class ClusterProfile(msrest.serialization.Model):
:keyword resource_group_id: The ID of the cluster resource group (immutable).
:paramtype resource_group_id: str
"""
super(ClusterProfile, self).__init__(**kwargs)
super().__init__(**kwargs)
self.pull_secret = pull_secret
self.domain = domain
self.version = version
self.resource_group_id = resource_group_id
class ConsoleProfile(msrest.serialization.Model):
class ConsoleProfile(_serialization.Model):
"""ConsoleProfile represents a console profile.
:ivar url: The URL to access the cluster console (immutable).
@ -160,24 +162,19 @@ class ConsoleProfile(msrest.serialization.Model):
"""
_attribute_map = {
'url': {'key': 'url', 'type': 'str'},
"url": {"key": "url", "type": "str"},
}
def __init__(
self,
*,
url: Optional[str] = None,
**kwargs
):
def __init__(self, *, url: Optional[str] = None, **kwargs):
"""
:keyword url: The URL to access the cluster console (immutable).
:paramtype url: str
"""
super(ConsoleProfile, self).__init__(**kwargs)
super().__init__(**kwargs)
self.url = url
class Display(msrest.serialization.Model):
class Display(_serialization.Model):
"""Display represents the display details of an operation.
:ivar provider: Friendly name of the resource provider.
@ -191,10 +188,10 @@ class Display(msrest.serialization.Model):
"""
_attribute_map = {
'provider': {'key': 'provider', 'type': 'str'},
'resource': {'key': 'resource', 'type': 'str'},
'operation': {'key': 'operation', 'type': 'str'},
'description': {'key': 'description', 'type': 'str'},
"provider": {"key": "provider", "type": "str"},
"resource": {"key": "resource", "type": "str"},
"operation": {"key": "operation", "type": "str"},
"description": {"key": "description", "type": "str"},
}
def __init__(
@ -216,88 +213,83 @@ class Display(msrest.serialization.Model):
:keyword description: Friendly name of the operation.
:paramtype description: str
"""
super(Display, self).__init__(**kwargs)
super().__init__(**kwargs)
self.provider = provider
self.resource = resource
self.operation = operation
self.description = description
class IngressProfile(msrest.serialization.Model):
class IngressProfile(_serialization.Model):
"""IngressProfile represents an ingress profile.
:ivar name: The ingress profile name. Must be "default" (immutable).
:vartype name: str
:ivar visibility: Ingress visibility (immutable). Possible values include: "Private", "Public".
:ivar visibility: Ingress visibility (immutable). Known values are: "Private" and "Public".
:vartype visibility: str or ~azure.mgmt.redhatopenshift.v2020_04_30.models.Visibility
:ivar ip: The IP of the ingress (immutable).
:vartype ip: str
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'visibility': {'key': 'visibility', 'type': 'str'},
'ip': {'key': 'ip', 'type': 'str'},
"name": {"key": "name", "type": "str"},
"visibility": {"key": "visibility", "type": "str"},
"ip": {"key": "ip", "type": "str"},
}
def __init__(
self,
*,
name: Optional[str] = None,
visibility: Optional[Union[str, "Visibility"]] = None,
visibility: Optional[Union[str, "_models.Visibility"]] = None,
ip: Optional[str] = None,
**kwargs
):
"""
:keyword name: The ingress profile name. Must be "default" (immutable).
:paramtype name: str
:keyword visibility: Ingress visibility (immutable). Possible values include: "Private",
"Public".
:keyword visibility: Ingress visibility (immutable). Known values are: "Private" and "Public".
:paramtype visibility: str or ~azure.mgmt.redhatopenshift.v2020_04_30.models.Visibility
:keyword ip: The IP of the ingress (immutable).
:paramtype ip: str
"""
super(IngressProfile, self).__init__(**kwargs)
super().__init__(**kwargs)
self.name = name
self.visibility = visibility
self.ip = ip
class MasterProfile(msrest.serialization.Model):
class MasterProfile(_serialization.Model):
"""MasterProfile represents a master profile.
:ivar vm_size: The size of the master VMs (immutable). Possible values include:
"Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3".
:ivar vm_size: The size of the master VMs (immutable). Known values are: "Standard_D2s_v3",
"Standard_D4s_v3", and "Standard_D8s_v3".
:vartype vm_size: str or ~azure.mgmt.redhatopenshift.v2020_04_30.models.VMSize
:ivar subnet_id: The Azure resource ID of the master subnet (immutable).
:vartype subnet_id: str
"""
_attribute_map = {
'vm_size': {'key': 'vmSize', 'type': 'str'},
'subnet_id': {'key': 'subnetId', 'type': 'str'},
"vm_size": {"key": "vmSize", "type": "str"},
"subnet_id": {"key": "subnetId", "type": "str"},
}
def __init__(
self,
*,
vm_size: Optional[Union[str, "VMSize"]] = None,
subnet_id: Optional[str] = None,
**kwargs
self, *, vm_size: Optional[Union[str, "_models.VMSize"]] = None, subnet_id: Optional[str] = None, **kwargs
):
"""
:keyword vm_size: The size of the master VMs (immutable). Possible values include:
"Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3".
:keyword vm_size: The size of the master VMs (immutable). Known values are: "Standard_D2s_v3",
"Standard_D4s_v3", and "Standard_D8s_v3".
:paramtype vm_size: str or ~azure.mgmt.redhatopenshift.v2020_04_30.models.VMSize
:keyword subnet_id: The Azure resource ID of the master subnet (immutable).
:paramtype subnet_id: str
"""
super(MasterProfile, self).__init__(**kwargs)
super().__init__(**kwargs)
self.vm_size = vm_size
self.subnet_id = subnet_id
class NetworkProfile(msrest.serialization.Model):
class NetworkProfile(_serialization.Model):
"""NetworkProfile represents a network profile.
:ivar pod_cidr: The CIDR used for OpenShift/Kubernetes Pods (immutable).
@ -307,29 +299,23 @@ class NetworkProfile(msrest.serialization.Model):
"""
_attribute_map = {
'pod_cidr': {'key': 'podCidr', 'type': 'str'},
'service_cidr': {'key': 'serviceCidr', 'type': 'str'},
"pod_cidr": {"key": "podCidr", "type": "str"},
"service_cidr": {"key": "serviceCidr", "type": "str"},
}
def __init__(
self,
*,
pod_cidr: Optional[str] = None,
service_cidr: Optional[str] = None,
**kwargs
):
def __init__(self, *, pod_cidr: Optional[str] = None, service_cidr: Optional[str] = None, **kwargs):
"""
:keyword pod_cidr: The CIDR used for OpenShift/Kubernetes Pods (immutable).
:paramtype pod_cidr: str
:keyword service_cidr: The CIDR used for OpenShift/Kubernetes Services (immutable).
:paramtype service_cidr: str
"""
super(NetworkProfile, self).__init__(**kwargs)
super().__init__(**kwargs)
self.pod_cidr = pod_cidr
self.service_cidr = service_cidr
class Resource(msrest.serialization.Model):
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.
@ -345,24 +331,20 @@ class Resource(msrest.serialization.Model):
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
}
def __init__(
self,
**kwargs
):
"""
"""
super(Resource, self).__init__(**kwargs)
def __init__(self, **kwargs):
""" """
super().__init__(**kwargs)
self.id = None
self.name = None
self.type = None
@ -383,46 +365,40 @@ class TrackedResource(Resource):
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
"Microsoft.Storage/storageAccounts".
:vartype type: str
:ivar tags: A set of tags. Resource tags.
:ivar tags: Resource tags.
:vartype tags: dict[str, str]
:ivar location: Required. The geo-location where the resource lives.
:ivar location: The geo-location where the resource lives. Required.
:vartype location: str
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'location': {'required': True},
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"location": {"required": True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'location': {'key': 'location', 'type': 'str'},
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"tags": {"key": "tags", "type": "{str}"},
"location": {"key": "location", "type": "str"},
}
def __init__(
self,
*,
location: str,
tags: Optional[Dict[str, str]] = None,
**kwargs
):
def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs):
"""
:keyword tags: A set of tags. Resource tags.
:keyword tags: Resource tags.
:paramtype tags: dict[str, str]
:keyword location: Required. The geo-location where the resource lives.
:keyword location: The geo-location where the resource lives. Required.
:paramtype location: str
"""
super(TrackedResource, self).__init__(**kwargs)
super().__init__(**kwargs)
self.tags = tags
self.location = location
class OpenShiftCluster(TrackedResource):
class OpenShiftCluster(TrackedResource): # pylint: disable=too-many-instance-attributes
"""OpenShiftCluster represents an Azure Red Hat OpenShift cluster.
Variables are only populated by the server, and will be ignored when sending a request.
@ -437,12 +413,12 @@ class OpenShiftCluster(TrackedResource):
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
"Microsoft.Storage/storageAccounts".
:vartype type: str
:ivar tags: A set of tags. Resource tags.
:ivar tags: Resource tags.
:vartype tags: dict[str, str]
:ivar location: Required. The geo-location where the resource lives.
:ivar location: The geo-location where the resource lives. Required.
:vartype location: str
:ivar provisioning_state: The cluster provisioning state (immutable). Possible values include:
"AdminUpdating", "Creating", "Deleting", "Failed", "Succeeded", "Updating".
:ivar provisioning_state: The cluster provisioning state (immutable). Known values are:
"AdminUpdating", "Creating", "Deleting", "Failed", "Succeeded", and "Updating".
:vartype provisioning_state: str or
~azure.mgmt.redhatopenshift.v2020_04_30.models.ProvisioningState
:ivar cluster_profile: The cluster profile.
@ -465,27 +441,27 @@ class OpenShiftCluster(TrackedResource):
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'location': {'required': True},
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"location": {"required": True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'location': {'key': 'location', 'type': 'str'},
'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
'cluster_profile': {'key': 'properties.clusterProfile', 'type': 'ClusterProfile'},
'console_profile': {'key': 'properties.consoleProfile', 'type': 'ConsoleProfile'},
'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ServicePrincipalProfile'},
'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'},
'master_profile': {'key': 'properties.masterProfile', 'type': 'MasterProfile'},
'worker_profiles': {'key': 'properties.workerProfiles', 'type': '[WorkerProfile]'},
'apiserver_profile': {'key': 'properties.apiserverProfile', 'type': 'APIServerProfile'},
'ingress_profiles': {'key': 'properties.ingressProfiles', 'type': '[IngressProfile]'},
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"tags": {"key": "tags", "type": "{str}"},
"location": {"key": "location", "type": "str"},
"provisioning_state": {"key": "properties.provisioningState", "type": "str"},
"cluster_profile": {"key": "properties.clusterProfile", "type": "ClusterProfile"},
"console_profile": {"key": "properties.consoleProfile", "type": "ConsoleProfile"},
"service_principal_profile": {"key": "properties.servicePrincipalProfile", "type": "ServicePrincipalProfile"},
"network_profile": {"key": "properties.networkProfile", "type": "NetworkProfile"},
"master_profile": {"key": "properties.masterProfile", "type": "MasterProfile"},
"worker_profiles": {"key": "properties.workerProfiles", "type": "[WorkerProfile]"},
"apiserver_profile": {"key": "properties.apiserverProfile", "type": "APIServerProfile"},
"ingress_profiles": {"key": "properties.ingressProfiles", "type": "[IngressProfile]"},
}
def __init__(
@ -493,24 +469,24 @@ class OpenShiftCluster(TrackedResource):
*,
location: str,
tags: Optional[Dict[str, str]] = None,
provisioning_state: Optional[Union[str, "ProvisioningState"]] = None,
cluster_profile: Optional["ClusterProfile"] = None,
console_profile: Optional["ConsoleProfile"] = None,
service_principal_profile: Optional["ServicePrincipalProfile"] = None,
network_profile: Optional["NetworkProfile"] = None,
master_profile: Optional["MasterProfile"] = None,
worker_profiles: Optional[List["WorkerProfile"]] = None,
apiserver_profile: Optional["APIServerProfile"] = None,
ingress_profiles: Optional[List["IngressProfile"]] = None,
provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None,
cluster_profile: Optional["_models.ClusterProfile"] = None,
console_profile: Optional["_models.ConsoleProfile"] = None,
service_principal_profile: Optional["_models.ServicePrincipalProfile"] = None,
network_profile: Optional["_models.NetworkProfile"] = None,
master_profile: Optional["_models.MasterProfile"] = None,
worker_profiles: Optional[List["_models.WorkerProfile"]] = None,
apiserver_profile: Optional["_models.APIServerProfile"] = None,
ingress_profiles: Optional[List["_models.IngressProfile"]] = None,
**kwargs
):
"""
:keyword tags: A set of tags. Resource tags.
:keyword tags: Resource tags.
:paramtype tags: dict[str, str]
:keyword location: Required. The geo-location where the resource lives.
:keyword location: The geo-location where the resource lives. Required.
:paramtype location: str
:keyword provisioning_state: The cluster provisioning state (immutable). Possible values
include: "AdminUpdating", "Creating", "Deleting", "Failed", "Succeeded", "Updating".
:keyword provisioning_state: The cluster provisioning state (immutable). Known values are:
"AdminUpdating", "Creating", "Deleting", "Failed", "Succeeded", and "Updating".
:paramtype provisioning_state: str or
~azure.mgmt.redhatopenshift.v2020_04_30.models.ProvisioningState
:keyword cluster_profile: The cluster profile.
@ -532,7 +508,7 @@ class OpenShiftCluster(TrackedResource):
:paramtype ingress_profiles:
list[~azure.mgmt.redhatopenshift.v2020_04_30.models.IngressProfile]
"""
super(OpenShiftCluster, self).__init__(tags=tags, location=location, **kwargs)
super().__init__(tags=tags, location=location, **kwargs)
self.provisioning_state = provisioning_state
self.cluster_profile = cluster_profile
self.console_profile = console_profile
@ -544,7 +520,7 @@ class OpenShiftCluster(TrackedResource):
self.ingress_profiles = ingress_profiles
class OpenShiftClusterCredentials(msrest.serialization.Model):
class OpenShiftClusterCredentials(_serialization.Model):
"""OpenShiftClusterCredentials represents an OpenShift cluster's credentials.
:ivar kubeadmin_username: The username for the kubeadmin user.
@ -554,29 +530,23 @@ class OpenShiftClusterCredentials(msrest.serialization.Model):
"""
_attribute_map = {
'kubeadmin_username': {'key': 'kubeadminUsername', 'type': 'str'},
'kubeadmin_password': {'key': 'kubeadminPassword', 'type': 'str'},
"kubeadmin_username": {"key": "kubeadminUsername", "type": "str"},
"kubeadmin_password": {"key": "kubeadminPassword", "type": "str"},
}
def __init__(
self,
*,
kubeadmin_username: Optional[str] = None,
kubeadmin_password: Optional[str] = None,
**kwargs
):
def __init__(self, *, kubeadmin_username: Optional[str] = None, kubeadmin_password: Optional[str] = None, **kwargs):
"""
:keyword kubeadmin_username: The username for the kubeadmin user.
:paramtype kubeadmin_username: str
:keyword kubeadmin_password: The password for the kubeadmin user.
:paramtype kubeadmin_password: str
"""
super(OpenShiftClusterCredentials, self).__init__(**kwargs)
super().__init__(**kwargs)
self.kubeadmin_username = kubeadmin_username
self.kubeadmin_password = kubeadmin_password
class OpenShiftClusterList(msrest.serialization.Model):
class OpenShiftClusterList(_serialization.Model):
"""OpenShiftClusterList represents a list of OpenShift clusters.
:ivar value: The list of OpenShift clusters.
@ -586,16 +556,12 @@ class OpenShiftClusterList(msrest.serialization.Model):
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[OpenShiftCluster]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
"value": {"key": "value", "type": "[OpenShiftCluster]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(
self,
*,
value: Optional[List["OpenShiftCluster"]] = None,
next_link: Optional[str] = None,
**kwargs
self, *, value: Optional[List["_models.OpenShiftCluster"]] = None, next_link: Optional[str] = None, **kwargs
):
"""
:keyword value: The list of OpenShift clusters.
@ -603,18 +569,18 @@ class OpenShiftClusterList(msrest.serialization.Model):
:keyword next_link: The link used to get the next page of operations.
:paramtype next_link: str
"""
super(OpenShiftClusterList, self).__init__(**kwargs)
super().__init__(**kwargs)
self.value = value
self.next_link = next_link
class OpenShiftClusterUpdate(msrest.serialization.Model):
class OpenShiftClusterUpdate(_serialization.Model):
"""OpenShiftCluster represents an Azure Red Hat OpenShift cluster.
:ivar tags: A set of tags. The resource tags.
:ivar tags: The resource tags.
:vartype tags: dict[str, str]
:ivar provisioning_state: The cluster provisioning state (immutable). Possible values include:
"AdminUpdating", "Creating", "Deleting", "Failed", "Succeeded", "Updating".
:ivar provisioning_state: The cluster provisioning state (immutable). Known values are:
"AdminUpdating", "Creating", "Deleting", "Failed", "Succeeded", and "Updating".
:vartype provisioning_state: str or
~azure.mgmt.redhatopenshift.v2020_04_30.models.ProvisioningState
:ivar cluster_profile: The cluster profile.
@ -637,38 +603,38 @@ class OpenShiftClusterUpdate(msrest.serialization.Model):
"""
_attribute_map = {
'tags': {'key': 'tags', 'type': '{str}'},
'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
'cluster_profile': {'key': 'properties.clusterProfile', 'type': 'ClusterProfile'},
'console_profile': {'key': 'properties.consoleProfile', 'type': 'ConsoleProfile'},
'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ServicePrincipalProfile'},
'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'},
'master_profile': {'key': 'properties.masterProfile', 'type': 'MasterProfile'},
'worker_profiles': {'key': 'properties.workerProfiles', 'type': '[WorkerProfile]'},
'apiserver_profile': {'key': 'properties.apiserverProfile', 'type': 'APIServerProfile'},
'ingress_profiles': {'key': 'properties.ingressProfiles', 'type': '[IngressProfile]'},
"tags": {"key": "tags", "type": "{str}"},
"provisioning_state": {"key": "properties.provisioningState", "type": "str"},
"cluster_profile": {"key": "properties.clusterProfile", "type": "ClusterProfile"},
"console_profile": {"key": "properties.consoleProfile", "type": "ConsoleProfile"},
"service_principal_profile": {"key": "properties.servicePrincipalProfile", "type": "ServicePrincipalProfile"},
"network_profile": {"key": "properties.networkProfile", "type": "NetworkProfile"},
"master_profile": {"key": "properties.masterProfile", "type": "MasterProfile"},
"worker_profiles": {"key": "properties.workerProfiles", "type": "[WorkerProfile]"},
"apiserver_profile": {"key": "properties.apiserverProfile", "type": "APIServerProfile"},
"ingress_profiles": {"key": "properties.ingressProfiles", "type": "[IngressProfile]"},
}
def __init__(
self,
*,
tags: Optional[Dict[str, str]] = None,
provisioning_state: Optional[Union[str, "ProvisioningState"]] = None,
cluster_profile: Optional["ClusterProfile"] = None,
console_profile: Optional["ConsoleProfile"] = None,
service_principal_profile: Optional["ServicePrincipalProfile"] = None,
network_profile: Optional["NetworkProfile"] = None,
master_profile: Optional["MasterProfile"] = None,
worker_profiles: Optional[List["WorkerProfile"]] = None,
apiserver_profile: Optional["APIServerProfile"] = None,
ingress_profiles: Optional[List["IngressProfile"]] = None,
provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None,
cluster_profile: Optional["_models.ClusterProfile"] = None,
console_profile: Optional["_models.ConsoleProfile"] = None,
service_principal_profile: Optional["_models.ServicePrincipalProfile"] = None,
network_profile: Optional["_models.NetworkProfile"] = None,
master_profile: Optional["_models.MasterProfile"] = None,
worker_profiles: Optional[List["_models.WorkerProfile"]] = None,
apiserver_profile: Optional["_models.APIServerProfile"] = None,
ingress_profiles: Optional[List["_models.IngressProfile"]] = None,
**kwargs
):
"""
:keyword tags: A set of tags. The resource tags.
:keyword tags: The resource tags.
:paramtype tags: dict[str, str]
:keyword provisioning_state: The cluster provisioning state (immutable). Possible values
include: "AdminUpdating", "Creating", "Deleting", "Failed", "Succeeded", "Updating".
:keyword provisioning_state: The cluster provisioning state (immutable). Known values are:
"AdminUpdating", "Creating", "Deleting", "Failed", "Succeeded", and "Updating".
:paramtype provisioning_state: str or
~azure.mgmt.redhatopenshift.v2020_04_30.models.ProvisioningState
:keyword cluster_profile: The cluster profile.
@ -690,7 +656,7 @@ class OpenShiftClusterUpdate(msrest.serialization.Model):
:paramtype ingress_profiles:
list[~azure.mgmt.redhatopenshift.v2020_04_30.models.IngressProfile]
"""
super(OpenShiftClusterUpdate, self).__init__(**kwargs)
super().__init__(**kwargs)
self.tags = tags
self.provisioning_state = provisioning_state
self.cluster_profile = cluster_profile
@ -703,7 +669,7 @@ class OpenShiftClusterUpdate(msrest.serialization.Model):
self.ingress_profiles = ingress_profiles
class Operation(msrest.serialization.Model):
class Operation(_serialization.Model):
"""Operation represents an RP operation.
:ivar name: Operation name: {provider}/{resource}/{operation}.
@ -716,16 +682,16 @@ class Operation(msrest.serialization.Model):
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'display': {'key': 'display', 'type': 'Display'},
'origin': {'key': 'origin', 'type': 'str'},
"name": {"key": "name", "type": "str"},
"display": {"key": "display", "type": "Display"},
"origin": {"key": "origin", "type": "str"},
}
def __init__(
self,
*,
name: Optional[str] = None,
display: Optional["Display"] = None,
display: Optional["_models.Display"] = None,
origin: Optional[str] = None,
**kwargs
):
@ -738,13 +704,13 @@ class Operation(msrest.serialization.Model):
user or system, e.g. "user,system".
:paramtype origin: str
"""
super(Operation, self).__init__(**kwargs)
super().__init__(**kwargs)
self.name = name
self.display = display
self.origin = origin
class OperationList(msrest.serialization.Model):
class OperationList(_serialization.Model):
"""OperationList represents an RP operation list.
:ivar value: List of operations supported by the resource provider.
@ -754,29 +720,23 @@ class OperationList(msrest.serialization.Model):
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[Operation]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
"value": {"key": "value", "type": "[Operation]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(
self,
*,
value: Optional[List["Operation"]] = None,
next_link: Optional[str] = None,
**kwargs
):
def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs):
"""
:keyword value: List of operations supported by the resource provider.
:paramtype value: list[~azure.mgmt.redhatopenshift.v2020_04_30.models.Operation]
:keyword next_link: The link used to get the next page of operations.
:paramtype next_link: str
"""
super(OperationList, self).__init__(**kwargs)
super().__init__(**kwargs)
self.value = value
self.next_link = next_link
class ServicePrincipalProfile(msrest.serialization.Model):
class ServicePrincipalProfile(_serialization.Model):
"""ServicePrincipalProfile represents a service principal profile.
:ivar client_id: The client ID used for the cluster (immutable).
@ -786,35 +746,29 @@ class ServicePrincipalProfile(msrest.serialization.Model):
"""
_attribute_map = {
'client_id': {'key': 'clientId', 'type': 'str'},
'client_secret': {'key': 'clientSecret', 'type': 'str'},
"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
):
def __init__(self, *, client_id: Optional[str] = None, client_secret: Optional[str] = None, **kwargs):
"""
:keyword client_id: The client ID used for the cluster (immutable).
:paramtype client_id: str
:keyword client_secret: The client secret used for the cluster (immutable).
:paramtype client_secret: str
"""
super(ServicePrincipalProfile, self).__init__(**kwargs)
super().__init__(**kwargs)
self.client_id = client_id
self.client_secret = client_secret
class WorkerProfile(msrest.serialization.Model):
class WorkerProfile(_serialization.Model):
"""WorkerProfile represents a worker profile.
:ivar name: The worker profile name. Must be "worker" (immutable).
:vartype name: str
:ivar vm_size: The size of the worker VMs (immutable). Possible values include:
"Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3".
:ivar vm_size: The size of the worker VMs (immutable). Known values are: "Standard_D2s_v3",
"Standard_D4s_v3", and "Standard_D8s_v3".
:vartype vm_size: str or ~azure.mgmt.redhatopenshift.v2020_04_30.models.VMSize
:ivar disk_size_gb: The disk size of the worker VMs. Must be 128 or greater (immutable).
:vartype disk_size_gb: int
@ -825,18 +779,18 @@ class WorkerProfile(msrest.serialization.Model):
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'vm_size': {'key': 'vmSize', 'type': 'str'},
'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'},
'subnet_id': {'key': 'subnetId', 'type': 'str'},
'count': {'key': 'count', 'type': 'int'},
"name": {"key": "name", "type": "str"},
"vm_size": {"key": "vmSize", "type": "str"},
"disk_size_gb": {"key": "diskSizeGB", "type": "int"},
"subnet_id": {"key": "subnetId", "type": "str"},
"count": {"key": "count", "type": "int"},
}
def __init__(
self,
*,
name: Optional[str] = None,
vm_size: Optional[Union[str, "VMSize"]] = None,
vm_size: Optional[Union[str, "_models.VMSize"]] = None,
disk_size_gb: Optional[int] = None,
subnet_id: Optional[str] = None,
count: Optional[int] = None,
@ -845,8 +799,8 @@ class WorkerProfile(msrest.serialization.Model):
"""
:keyword name: The worker profile name. Must be "worker" (immutable).
:paramtype name: str
:keyword vm_size: The size of the worker VMs (immutable). Possible values include:
"Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3".
:keyword vm_size: The size of the worker VMs (immutable). Known values are: "Standard_D2s_v3",
"Standard_D4s_v3", and "Standard_D8s_v3".
:paramtype vm_size: str or ~azure.mgmt.redhatopenshift.v2020_04_30.models.VMSize
:keyword disk_size_gb: The disk size of the worker VMs. Must be 128 or greater (immutable).
:paramtype disk_size_gb: int
@ -855,7 +809,7 @@ class WorkerProfile(msrest.serialization.Model):
:keyword count: The number of worker VMs. Must be between 3 and 20 (immutable).
:paramtype count: int
"""
super(WorkerProfile, self).__init__(**kwargs)
super().__init__(**kwargs)
self.name = name
self.vm_size = vm_size
self.disk_size_gb = disk_size_gb

Просмотреть файл

@ -0,0 +1,20 @@
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
"""Customize generated code here.
Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
"""
from typing import List
__all__: List[str] = [] # Add all objects you want publicly available to users at this package level
def patch_sdk():
"""Do not remove from this file.
`patch_sdk` is a last resort escape hatch that allows you to do customizations
you can't accomplish using the techniques described in
https://aka.ms/azsdk/python/dpcodegen/python/customize
"""

Просмотреть файл

@ -9,7 +9,13 @@
from ._operations import Operations
from ._open_shift_clusters_operations import OpenShiftClustersOperations
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
from ._patch import patch_sdk as _patch_sdk
__all__ = [
'Operations',
'OpenShiftClustersOperations',
"Operations",
"OpenShiftClustersOperations",
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()

Просмотреть файл

@ -6,110 +6,128 @@
# 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, TypeVar
import urllib.parse
from msrest import Serializer
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
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.pipeline.transport import HttpResponse
from azure.core.rest import 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 ..._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar('T')
if sys.version_info >= (3, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_request(
**kwargs: Any
) -> HttpRequest:
api_version = kwargs.pop('api_version', "2020-04-30") # type: str
accept = "application/json"
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: Literal["2020-04-30"] = kwargs.pop("api_version", _params.pop("api-version", "2020-04-30"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop("template_url", "/providers/Microsoft.RedHatOpenShift/operations")
# Construct parameters
_query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any]
_query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str')
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any]
_header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(
method="GET",
url=_url,
params=_query_parameters,
headers=_header_parameters,
**kwargs
)
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
class Operations(object):
"""Operations operations.
You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
class Operations:
"""
.. warning::
**DO NOT** instantiate this class directly.
:ivar models: Alias to model classes used in this operation group.
:type models: ~azure.mgmt.redhatopenshift.v2020_04_30.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
Instead, you should access the following operations through
:class:`~azure.mgmt.redhatopenshift.v2020_04_30.AzureRedHatOpenShift4Client`'s
:attr:`operations` attribute.
"""
models = _models
def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config
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,
**kwargs: Any
) -> Iterable["_models.OperationList"]:
def list(self, **kwargs: Any) -> Iterable["_models.Operation"]:
"""Lists all of the available RP operations.
The operation returns the RP operations.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either OperationList or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2020_04_30.models.OperationList]
:raises: ~azure.core.exceptions.HttpResponseError
:return: An iterator like instance of either Operation or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2020_04_30.models.Operation]
:raises ~azure.core.exceptions.HttpResponseError:
"""
api_version = kwargs.pop('api_version', "2020-04-30") # type: str
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: Literal["2020-04-30"] = kwargs.pop("api_version", _params.pop("api-version", "2020-04-30"))
cls: ClsType[_models.OperationList] = kwargs.pop("cls", None)
cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationList"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop('error_map', {}))
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
api_version=api_version,
template_url=self.list.metadata['url'],
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
request = build_list_request(
api_version=api_version,
template_url=next_link,
# 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 = _convert_request(request)
request.url = self._client.format_url(request.url)
@ -120,16 +138,14 @@ class Operations(object):
deserialized = self._deserialize("OperationList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
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)
pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
@ -139,8 +155,6 @@ class Operations(object):
return pipeline_response
return ItemPaged(get_next, extract_data)
return ItemPaged(
get_next, extract_data
)
list.metadata = {'url': "/providers/Microsoft.RedHatOpenShift/operations"} # type: ignore
list.metadata = {"url": "/providers/Microsoft.RedHatOpenShift/operations"}

Просмотреть файл

@ -0,0 +1,20 @@
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
"""Customize generated code here.
Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
"""
from typing import List
__all__: List[str] = [] # Add all objects you want publicly available to users at this package level
def patch_sdk():
"""Do not remove from this file.
`patch_sdk` is a last resort escape hatch that allows you to do customizations
you can't accomplish using the techniques described in
https://aka.ms/azsdk/python/dpcodegen/python/customize
"""

Просмотреть файл

@ -10,9 +10,17 @@ from ._azure_red_hat_open_shift_client import AzureRedHatOpenShiftClient
from ._version import VERSION
__version__ = VERSION
__all__ = ['AzureRedHatOpenShiftClient']
# `._patch.py` is used for handwritten extensions to the generated code
# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
from ._patch import patch_sdk
patch_sdk()
try:
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
__all__ = [
"AzureRedHatOpenShiftClient",
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()

Просмотреть файл

@ -9,12 +9,11 @@
from copy import deepcopy
from typing import Any, TYPE_CHECKING
from msrest import Deserializer, Serializer
from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient
from . import models
from . import models as _models
from .._serialization import Deserializer, Serializer
from ._configuration import AzureRedHatOpenShiftClientConfiguration
from .operations import OpenShiftClustersOperations, Operations
@ -22,7 +21,8 @@ if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
class AzureRedHatOpenShiftClient:
class AzureRedHatOpenShiftClient: # pylint: disable=client-accepts-api-version-keyword
"""Rest API for Azure Red Hat OpenShift 4.
:ivar operations: Operations operations
@ -30,9 +30,9 @@ class AzureRedHatOpenShiftClient:
:ivar open_shift_clusters: OpenShiftClustersOperations operations
:vartype open_shift_clusters:
azure.mgmt.redhatopenshift.v2021_09_01_preview.operations.OpenShiftClustersOperations
:param credential: Credential needed for the client to connect to Azure.
: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.
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
@ -50,22 +50,21 @@ class AzureRedHatOpenShiftClient:
base_url: str = "https://management.azure.com",
**kwargs: Any
) -> None:
self._config = AzureRedHatOpenShiftClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
self._config = AzureRedHatOpenShiftClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
self.open_shift_clusters = OpenShiftClustersOperations(self._client, self._config, self._serialize, self._deserialize)
self.open_shift_clusters = OpenShiftClustersOperations(
self._client, self._config, self._serialize, self._deserialize
)
def _send_request(
self,
request: HttpRequest,
**kwargs: Any
) -> HttpResponse:
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
@ -74,7 +73,7 @@ class AzureRedHatOpenShiftClient:
>>> response = client._send_request(request)
<HttpResponse: 200 OK>
For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
:param request: The network request you want to make. Required.
:type request: ~azure.core.rest.HttpRequest
@ -87,15 +86,12 @@ class AzureRedHatOpenShiftClient:
request_copy.url = self._client.format_url(request_copy.url)
return self._client.send_request(request_copy, **kwargs)
def close(self):
# type: () -> None
def close(self) -> None:
self._client.close()
def __enter__(self):
# type: () -> AzureRedHatOpenShiftClient
def __enter__(self) -> "AzureRedHatOpenShiftClient":
self._client.__enter__()
return self
def __exit__(self, *exc_details):
# type: (Any) -> None
def __exit__(self, *exc_details) -> None:
self._client.__exit__(*exc_details)

Просмотреть файл

@ -6,6 +6,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import sys
from typing import Any, TYPE_CHECKING
from azure.core.configuration import Configuration
@ -14,6 +15,11 @@ from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLo
from ._version import VERSION
if sys.version_info >= (3, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
@ -25,23 +31,18 @@ class AzureRedHatOpenShiftClientConfiguration(Configuration): # pylint: disable
Note that all parameters used to create this instance are saved as instance
attributes.
:param credential: Credential needed for the client to connect to Azure.
: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.
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2021-09-01-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
"""
def __init__(
self,
credential: "TokenCredential",
subscription_id: str,
**kwargs: Any
) -> None:
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
super(AzureRedHatOpenShiftClientConfiguration, self).__init__(**kwargs)
api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str
api_version: Literal["2021-09-01-preview"] = kwargs.pop("api_version", "2021-09-01-preview")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
@ -51,23 +52,21 @@ class AzureRedHatOpenShiftClientConfiguration(Configuration): # pylint: disable
self.credential = credential
self.subscription_id = subscription_id
self.api_version = api_version
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-redhatopenshift/{}'.format(VERSION))
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-redhatopenshift/{}".format(VERSION))
self._configure(**kwargs)
def _configure(
self,
**kwargs # type: Any
):
# type: (...) -> None
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
def _configure(self, **kwargs: Any) -> None:
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)
self.authentication_policy = ARMChallengeAuthenticationPolicy(
self.credential, *self.credential_scopes, **kwargs
)

Просмотреть файл

@ -10,20 +10,20 @@
"azure_arm": true,
"has_lro_operations": true,
"client_side_validation": false,
"sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AzureRedHatOpenShiftClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}",
"async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AzureRedHatOpenShiftClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}"
"sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AzureRedHatOpenShiftClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
"async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AzureRedHatOpenShiftClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"global_parameters": {
"sync": {
"credential": {
"signature": "credential, # type: \"TokenCredential\"",
"description": "Credential needed for the client to connect to Azure.",
"signature": "credential: \"TokenCredential\",",
"description": "Credential needed for the client to connect to Azure. Required.",
"docstring_type": "~azure.core.credentials.TokenCredential",
"required": true
},
"subscription_id": {
"signature": "subscription_id, # type: str",
"description": "The ID of the target subscription.",
"signature": "subscription_id: str,",
"description": "The ID of the target subscription. Required.",
"docstring_type": "str",
"required": true
}
@ -31,13 +31,13 @@
"async": {
"credential": {
"signature": "credential: \"AsyncTokenCredential\",",
"description": "Credential needed for the client to connect to Azure.",
"description": "Credential needed for the client to connect to Azure. Required.",
"docstring_type": "~azure.core.credentials_async.AsyncTokenCredential",
"required": true
},
"subscription_id": {
"signature": "subscription_id: str,",
"description": "The ID of the target subscription.",
"description": "The ID of the target subscription. Required.",
"docstring_type": "str",
"required": true
}
@ -48,19 +48,19 @@
"service_client_specific": {
"sync": {
"api_version": {
"signature": "api_version=None, # type: Optional[str]",
"signature": "api_version: Optional[str]=None,",
"description": "API version to use if no profile is provided, or if missing in profile.",
"docstring_type": "str",
"required": false
},
"base_url": {
"signature": "base_url=\"https://management.azure.com\", # type: str",
"signature": "base_url: str = \"https://management.azure.com\",",
"description": "Service URL",
"docstring_type": "str",
"required": false
},
"profile": {
"signature": "profile=KnownProfiles.default, # type: KnownProfiles",
"signature": "profile: KnownProfiles=KnownProfiles.default,",
"description": "A profile definition, from KnownProfiles to dict.",
"docstring_type": "azure.profiles.KnownProfiles",
"required": false
@ -100,4 +100,4 @@
"operations": "Operations",
"open_shift_clusters": "OpenShiftClustersOperations"
}
}
}

Просмотреть файл

@ -28,4 +28,4 @@
# This file is used for handwritten extensions to the generated code. Example:
# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
def patch_sdk():
pass
pass

Просмотреть файл

@ -7,6 +7,7 @@
from azure.core.pipeline.transport import HttpRequest
def _convert_request(request, files=None):
data = request.content if not files else None
request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data)
@ -14,6 +15,7 @@ def _convert_request(request, files=None):
request.set_formdata_body(files)
return request
def _format_url_section(template, **kwargs):
components = template.split("/")
while components:
@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs):
return template.format(**kwargs)
except KeyError as key:
formatted_components = template.split("/")
components = [
c for c in formatted_components if "{}".format(key.args[0]) not in c
]
components = [c for c in formatted_components if "{}".format(key.args[0]) not in c]
template = "/".join(components)

Просмотреть файл

@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
VERSION = "1.1.0"
VERSION = "1.2.0"

Просмотреть файл

@ -7,9 +7,17 @@
# --------------------------------------------------------------------------
from ._azure_red_hat_open_shift_client import AzureRedHatOpenShiftClient
__all__ = ['AzureRedHatOpenShiftClient']
# `._patch.py` is used for handwritten extensions to the generated code
# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
from ._patch import patch_sdk
patch_sdk()
try:
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
__all__ = [
"AzureRedHatOpenShiftClient",
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()

Просмотреть файл

@ -9,12 +9,11 @@
from copy import deepcopy
from typing import Any, Awaitable, TYPE_CHECKING
from msrest import Deserializer, Serializer
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.mgmt.core import AsyncARMPipelineClient
from .. import models
from .. import models as _models
from ..._serialization import Deserializer, Serializer
from ._configuration import AzureRedHatOpenShiftClientConfiguration
from .operations import OpenShiftClustersOperations, Operations
@ -22,7 +21,8 @@ if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
class AzureRedHatOpenShiftClient:
class AzureRedHatOpenShiftClient: # pylint: disable=client-accepts-api-version-keyword
"""Rest API for Azure Red Hat OpenShift 4.
:ivar operations: Operations operations
@ -30,9 +30,9 @@ class AzureRedHatOpenShiftClient:
:ivar open_shift_clusters: OpenShiftClustersOperations operations
:vartype open_shift_clusters:
azure.mgmt.redhatopenshift.v2021_09_01_preview.aio.operations.OpenShiftClustersOperations
:param credential: Credential needed for the client to connect to Azure.
: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.
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
@ -50,22 +50,21 @@ class AzureRedHatOpenShiftClient:
base_url: str = "https://management.azure.com",
**kwargs: Any
) -> None:
self._config = AzureRedHatOpenShiftClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
self._config = AzureRedHatOpenShiftClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
self.open_shift_clusters = OpenShiftClustersOperations(self._client, self._config, self._serialize, self._deserialize)
self.open_shift_clusters = OpenShiftClustersOperations(
self._client, self._config, self._serialize, self._deserialize
)
def _send_request(
self,
request: HttpRequest,
**kwargs: Any
) -> Awaitable[AsyncHttpResponse]:
def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
@ -74,7 +73,7 @@ class AzureRedHatOpenShiftClient:
>>> response = await client._send_request(request)
<AsyncHttpResponse: 200 OK>
For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
:param request: The network request you want to make. Required.
:type request: ~azure.core.rest.HttpRequest

Просмотреть файл

@ -6,6 +6,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import sys
from typing import Any, TYPE_CHECKING
from azure.core.configuration import Configuration
@ -14,6 +15,11 @@ from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuth
from .._version import VERSION
if sys.version_info >= (3, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
@ -25,23 +31,18 @@ class AzureRedHatOpenShiftClientConfiguration(Configuration): # pylint: disable
Note that all parameters used to create this instance are saved as instance
attributes.
:param credential: Credential needed for the client to connect to Azure.
: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.
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2021-09-01-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
"""
def __init__(
self,
credential: "AsyncTokenCredential",
subscription_id: str,
**kwargs: Any
) -> None:
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
super(AzureRedHatOpenShiftClientConfiguration, self).__init__(**kwargs)
api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str
api_version: Literal["2021-09-01-preview"] = kwargs.pop("api_version", "2021-09-01-preview")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
@ -51,22 +52,21 @@ class AzureRedHatOpenShiftClientConfiguration(Configuration): # pylint: disable
self.credential = credential
self.subscription_id = subscription_id
self.api_version = api_version
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-redhatopenshift/{}'.format(VERSION))
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-redhatopenshift/{}".format(VERSION))
self._configure(**kwargs)
def _configure(
self,
**kwargs: Any
) -> None:
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
def _configure(self, **kwargs: Any) -> None:
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)
self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(
self.credential, *self.credential_scopes, **kwargs
)

Просмотреть файл

@ -28,4 +28,4 @@
# This file is used for handwritten extensions to the generated code. Example:
# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
def patch_sdk():
pass
pass

Просмотреть файл

@ -9,7 +9,13 @@
from ._operations import Operations
from ._open_shift_clusters_operations import OpenShiftClustersOperations
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
from ._patch import patch_sdk as _patch_sdk
__all__ = [
'Operations',
'OpenShiftClustersOperations',
"Operations",
"OpenShiftClustersOperations",
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()

Просмотреть файл

@ -6,81 +6,109 @@
# 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, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import 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 ..._vendor import _convert_request
from ...operations._operations import build_list_request
T = TypeVar('T')
if sys.version_info >= (3, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class Operations:
"""Operations async operations.
"""
.. warning::
**DO NOT** instantiate this class directly.
You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
:ivar models: Alias to model classes used in this operation group.
:type models: ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
Instead, you should access the following operations through
:class:`~azure.mgmt.redhatopenshift.v2021_09_01_preview.aio.AzureRedHatOpenShiftClient`'s
:attr:`operations` attribute.
"""
models = _models
def __init__(self, client, config, serializer, deserializer) -> None:
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config
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,
**kwargs: Any
) -> AsyncIterable["_models.OperationList"]:
def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]:
"""Lists all of the available RP operations.
The operation returns the RP operations.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either OperationList or the result of cls(response)
:return: An iterator like instance of either Operation or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OperationList]
:raises: ~azure.core.exceptions.HttpResponseError
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.Operation]
:raises ~azure.core.exceptions.HttpResponseError:
"""
api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: Literal["2021-09-01-preview"] = kwargs.pop(
"api_version", _params.pop("api-version", "2021-09-01-preview")
)
cls: ClsType[_models.OperationList] = kwargs.pop("cls", None)
cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationList"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop('error_map', {}))
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
api_version=api_version,
template_url=self.list.metadata['url'],
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
request = build_list_request(
api_version=api_version,
template_url=next_link,
# 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 = _convert_request(request)
request.url = self._client.format_url(request.url)
@ -91,16 +119,14 @@ class Operations:
deserialized = self._deserialize("OperationList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
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)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
@ -110,8 +136,6 @@ class Operations:
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
return AsyncItemPaged(
get_next, extract_data
)
list.metadata = {'url': "/providers/Microsoft.RedHatOpenShift/operations"} # type: ignore
list.metadata = {"url": "/providers/Microsoft.RedHatOpenShift/operations"}

Просмотреть файл

@ -0,0 +1,20 @@
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
"""Customize generated code here.
Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
"""
from typing import List
__all__: List[str] = [] # Add all objects you want publicly available to users at this package level
def patch_sdk():
"""Do not remove from this file.
`patch_sdk` is a last resort escape hatch that allows you to do customizations
you can't accomplish using the techniques described in
https://aka.ms/azsdk/python/dpcodegen/python/customize
"""

Просмотреть файл

@ -27,41 +27,43 @@ from ._models_py3 import SystemData
from ._models_py3 import TrackedResource
from ._models_py3 import WorkerProfile
from ._azure_red_hat_open_shift_client_enums import (
CreatedByType,
EncryptionAtHost,
ProvisioningState,
SoftwareDefinedNetwork,
VMSize,
Visibility,
)
from ._azure_red_hat_open_shift_client_enums import CreatedByType
from ._azure_red_hat_open_shift_client_enums import EncryptionAtHost
from ._azure_red_hat_open_shift_client_enums import ProvisioningState
from ._azure_red_hat_open_shift_client_enums import SoftwareDefinedNetwork
from ._azure_red_hat_open_shift_client_enums import VMSize
from ._azure_red_hat_open_shift_client_enums import Visibility
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
from ._patch import patch_sdk as _patch_sdk
__all__ = [
'APIServerProfile',
'CloudErrorBody',
'ClusterProfile',
'ConsoleProfile',
'Display',
'IngressProfile',
'MasterProfile',
'NetworkProfile',
'OpenShiftCluster',
'OpenShiftClusterAdminKubeconfig',
'OpenShiftClusterCredentials',
'OpenShiftClusterList',
'OpenShiftClusterUpdate',
'Operation',
'OperationList',
'Resource',
'ServicePrincipalProfile',
'SystemData',
'TrackedResource',
'WorkerProfile',
'CreatedByType',
'EncryptionAtHost',
'ProvisioningState',
'SoftwareDefinedNetwork',
'VMSize',
'Visibility',
"APIServerProfile",
"CloudErrorBody",
"ClusterProfile",
"ConsoleProfile",
"Display",
"IngressProfile",
"MasterProfile",
"NetworkProfile",
"OpenShiftCluster",
"OpenShiftClusterAdminKubeconfig",
"OpenShiftClusterCredentials",
"OpenShiftClusterList",
"OpenShiftClusterUpdate",
"Operation",
"OperationList",
"Resource",
"ServicePrincipalProfile",
"SystemData",
"TrackedResource",
"WorkerProfile",
"CreatedByType",
"EncryptionAtHost",
"ProvisioningState",
"SoftwareDefinedNetwork",
"VMSize",
"Visibility",
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()

Просмотреть файл

@ -7,29 +7,27 @@
# --------------------------------------------------------------------------
from enum import Enum
from six import with_metaclass
from azure.core import CaseInsensitiveEnumMeta
class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
"""The type of identity that created the resource.
"""
class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The type of identity that created the resource."""
USER = "User"
APPLICATION = "Application"
MANAGED_IDENTITY = "ManagedIdentity"
KEY = "Key"
class EncryptionAtHost(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
"""EncryptionAtHost represents encryption at host state
"""
class EncryptionAtHost(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""EncryptionAtHost represents encryption at host state."""
DISABLED = "Disabled"
ENABLED = "Enabled"
class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
"""ProvisioningState represents a provisioning state.
"""
class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""ProvisioningState represents a provisioning state."""
ADMIN_UPDATING = "AdminUpdating"
CREATING = "Creating"
@ -38,23 +36,23 @@ class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
SUCCEEDED = "Succeeded"
UPDATING = "Updating"
class SoftwareDefinedNetwork(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
"""SoftwareDefinedNetwork constants.
"""
class SoftwareDefinedNetwork(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""SoftwareDefinedNetwork constants."""
OVN_KUBERNETES = "OVNKubernetes"
OPEN_SHIFT_SDN = "OpenShiftSDN"
class Visibility(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
"""Visibility represents visibility.
"""
class Visibility(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Visibility represents visibility."""
PRIVATE = "Private"
PUBLIC = "Public"
class VMSize(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
"""VMSize represents a VM size.
"""
class VMSize(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""VMSize represents a VM size."""
STANDARD_D16_AS_V4 = "Standard_D16as_v4"
STANDARD_D16_S_V3 = "Standard_D16s_v3"

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,20 @@
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
"""Customize generated code here.
Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
"""
from typing import List
__all__: List[str] = [] # Add all objects you want publicly available to users at this package level
def patch_sdk():
"""Do not remove from this file.
`patch_sdk` is a last resort escape hatch that allows you to do customizations
you can't accomplish using the techniques described in
https://aka.ms/azsdk/python/dpcodegen/python/customize
"""

Просмотреть файл

@ -9,7 +9,13 @@
from ._operations import Operations
from ._open_shift_clusters_operations import OpenShiftClustersOperations
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
from ._patch import patch_sdk as _patch_sdk
__all__ = [
'Operations',
'OpenShiftClustersOperations',
"Operations",
"OpenShiftClustersOperations",
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()

Просмотреть файл

@ -6,110 +6,133 @@
# 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, TypeVar
import urllib.parse
from msrest import Serializer
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
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.pipeline.transport import HttpResponse
from azure.core.rest import 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 ..._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar('T')
if sys.version_info >= (3, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_request(
**kwargs: Any
) -> HttpRequest:
api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str
accept = "application/json"
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: Literal["2021-09-01-preview"] = kwargs.pop(
"api_version", _params.pop("api-version", "2021-09-01-preview")
)
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop("template_url", "/providers/Microsoft.RedHatOpenShift/operations")
# Construct parameters
_query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any]
_query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str')
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any]
_header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(
method="GET",
url=_url,
params=_query_parameters,
headers=_header_parameters,
**kwargs
)
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
class Operations(object):
"""Operations operations.
You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
class Operations:
"""
.. warning::
**DO NOT** instantiate this class directly.
:ivar models: Alias to model classes used in this operation group.
:type models: ~azure.mgmt.redhatopenshift.v2021_09_01_preview.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
Instead, you should access the following operations through
:class:`~azure.mgmt.redhatopenshift.v2021_09_01_preview.AzureRedHatOpenShiftClient`'s
:attr:`operations` attribute.
"""
models = _models
def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config
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,
**kwargs: Any
) -> Iterable["_models.OperationList"]:
def list(self, **kwargs: Any) -> Iterable["_models.Operation"]:
"""Lists all of the available RP operations.
The operation returns the RP operations.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either OperationList or the result of cls(response)
:return: An iterator like instance of either Operation or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.OperationList]
:raises: ~azure.core.exceptions.HttpResponseError
~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2021_09_01_preview.models.Operation]
:raises ~azure.core.exceptions.HttpResponseError:
"""
api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: Literal["2021-09-01-preview"] = kwargs.pop(
"api_version", _params.pop("api-version", "2021-09-01-preview")
)
cls: ClsType[_models.OperationList] = kwargs.pop("cls", None)
cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationList"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop('error_map', {}))
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
api_version=api_version,
template_url=self.list.metadata['url'],
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
request = build_list_request(
api_version=api_version,
template_url=next_link,
# 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 = _convert_request(request)
request.url = self._client.format_url(request.url)
@ -120,16 +143,14 @@ class Operations(object):
deserialized = self._deserialize("OperationList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
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)
pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
@ -139,8 +160,6 @@ class Operations(object):
return pipeline_response
return ItemPaged(get_next, extract_data)
return ItemPaged(
get_next, extract_data
)
list.metadata = {'url': "/providers/Microsoft.RedHatOpenShift/operations"} # type: ignore
list.metadata = {"url": "/providers/Microsoft.RedHatOpenShift/operations"}

Просмотреть файл

@ -0,0 +1,20 @@
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
"""Customize generated code here.
Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
"""
from typing import List
__all__: List[str] = [] # Add all objects you want publicly available to users at this package level
def patch_sdk():
"""Do not remove from this file.
`patch_sdk` is a last resort escape hatch that allows you to do customizations
you can't accomplish using the techniques described in
https://aka.ms/azsdk/python/dpcodegen/python/customize
"""

Просмотреть файл

@ -10,9 +10,17 @@ from ._azure_red_hat_open_shift_client import AzureRedHatOpenShiftClient
from ._version import VERSION
__version__ = VERSION
__all__ = ['AzureRedHatOpenShiftClient']
# `._patch.py` is used for handwritten extensions to the generated code
# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
from ._patch import patch_sdk
patch_sdk()
try:
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
__all__ = [
"AzureRedHatOpenShiftClient",
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()

Просмотреть файл

@ -9,12 +9,11 @@
from copy import deepcopy
from typing import Any, TYPE_CHECKING
from msrest import Deserializer, Serializer
from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient
from . import models
from . import models as _models
from .._serialization import Deserializer, Serializer
from ._configuration import AzureRedHatOpenShiftClientConfiguration
from .operations import OpenShiftClustersOperations, Operations
@ -22,7 +21,8 @@ if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
class AzureRedHatOpenShiftClient:
class AzureRedHatOpenShiftClient: # pylint: disable=client-accepts-api-version-keyword
"""Rest API for Azure Red Hat OpenShift 4.
:ivar operations: Operations operations
@ -30,9 +30,9 @@ class AzureRedHatOpenShiftClient:
:ivar open_shift_clusters: OpenShiftClustersOperations operations
:vartype open_shift_clusters:
azure.mgmt.redhatopenshift.v2022_04_01.operations.OpenShiftClustersOperations
:param credential: Credential needed for the client to connect to Azure.
: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.
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
@ -50,22 +50,21 @@ class AzureRedHatOpenShiftClient:
base_url: str = "https://management.azure.com",
**kwargs: Any
) -> None:
self._config = AzureRedHatOpenShiftClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
self._config = AzureRedHatOpenShiftClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
self.open_shift_clusters = OpenShiftClustersOperations(self._client, self._config, self._serialize, self._deserialize)
self.open_shift_clusters = OpenShiftClustersOperations(
self._client, self._config, self._serialize, self._deserialize
)
def _send_request(
self,
request: HttpRequest,
**kwargs: Any
) -> HttpResponse:
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
@ -74,7 +73,7 @@ class AzureRedHatOpenShiftClient:
>>> response = client._send_request(request)
<HttpResponse: 200 OK>
For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
:param request: The network request you want to make. Required.
:type request: ~azure.core.rest.HttpRequest
@ -87,15 +86,12 @@ class AzureRedHatOpenShiftClient:
request_copy.url = self._client.format_url(request_copy.url)
return self._client.send_request(request_copy, **kwargs)
def close(self):
# type: () -> None
def close(self) -> None:
self._client.close()
def __enter__(self):
# type: () -> AzureRedHatOpenShiftClient
def __enter__(self) -> "AzureRedHatOpenShiftClient":
self._client.__enter__()
return self
def __exit__(self, *exc_details):
# type: (Any) -> None
def __exit__(self, *exc_details) -> None:
self._client.__exit__(*exc_details)

Просмотреть файл

@ -6,6 +6,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import sys
from typing import Any, TYPE_CHECKING
from azure.core.configuration import Configuration
@ -14,6 +15,11 @@ from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLo
from ._version import VERSION
if sys.version_info >= (3, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
@ -25,23 +31,18 @@ class AzureRedHatOpenShiftClientConfiguration(Configuration): # pylint: disable
Note that all parameters used to create this instance are saved as instance
attributes.
:param credential: Credential needed for the client to connect to Azure.
: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.
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2022-04-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""
def __init__(
self,
credential: "TokenCredential",
subscription_id: str,
**kwargs: Any
) -> None:
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
super(AzureRedHatOpenShiftClientConfiguration, self).__init__(**kwargs)
api_version = kwargs.pop('api_version', "2022-04-01") # type: str
api_version: Literal["2022-04-01"] = kwargs.pop("api_version", "2022-04-01")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
@ -51,23 +52,21 @@ class AzureRedHatOpenShiftClientConfiguration(Configuration): # pylint: disable
self.credential = credential
self.subscription_id = subscription_id
self.api_version = api_version
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-redhatopenshift/{}'.format(VERSION))
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-redhatopenshift/{}".format(VERSION))
self._configure(**kwargs)
def _configure(
self,
**kwargs # type: Any
):
# type: (...) -> None
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
def _configure(self, **kwargs: Any) -> None:
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)
self.authentication_policy = ARMChallengeAuthenticationPolicy(
self.credential, *self.credential_scopes, **kwargs
)

Просмотреть файл

@ -10,20 +10,20 @@
"azure_arm": true,
"has_lro_operations": true,
"client_side_validation": false,
"sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AzureRedHatOpenShiftClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}",
"async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AzureRedHatOpenShiftClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}"
"sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AzureRedHatOpenShiftClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
"async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AzureRedHatOpenShiftClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"global_parameters": {
"sync": {
"credential": {
"signature": "credential, # type: \"TokenCredential\"",
"description": "Credential needed for the client to connect to Azure.",
"signature": "credential: \"TokenCredential\",",
"description": "Credential needed for the client to connect to Azure. Required.",
"docstring_type": "~azure.core.credentials.TokenCredential",
"required": true
},
"subscription_id": {
"signature": "subscription_id, # type: str",
"description": "The ID of the target subscription.",
"signature": "subscription_id: str,",
"description": "The ID of the target subscription. Required.",
"docstring_type": "str",
"required": true
}
@ -31,13 +31,13 @@
"async": {
"credential": {
"signature": "credential: \"AsyncTokenCredential\",",
"description": "Credential needed for the client to connect to Azure.",
"description": "Credential needed for the client to connect to Azure. Required.",
"docstring_type": "~azure.core.credentials_async.AsyncTokenCredential",
"required": true
},
"subscription_id": {
"signature": "subscription_id: str,",
"description": "The ID of the target subscription.",
"description": "The ID of the target subscription. Required.",
"docstring_type": "str",
"required": true
}
@ -48,19 +48,19 @@
"service_client_specific": {
"sync": {
"api_version": {
"signature": "api_version=None, # type: Optional[str]",
"signature": "api_version: Optional[str]=None,",
"description": "API version to use if no profile is provided, or if missing in profile.",
"docstring_type": "str",
"required": false
},
"base_url": {
"signature": "base_url=\"https://management.azure.com\", # type: str",
"signature": "base_url: str = \"https://management.azure.com\",",
"description": "Service URL",
"docstring_type": "str",
"required": false
},
"profile": {
"signature": "profile=KnownProfiles.default, # type: KnownProfiles",
"signature": "profile: KnownProfiles=KnownProfiles.default,",
"description": "A profile definition, from KnownProfiles to dict.",
"docstring_type": "azure.profiles.KnownProfiles",
"required": false
@ -100,4 +100,4 @@
"operations": "Operations",
"open_shift_clusters": "OpenShiftClustersOperations"
}
}
}

Просмотреть файл

@ -28,4 +28,4 @@
# This file is used for handwritten extensions to the generated code. Example:
# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
def patch_sdk():
pass
pass

Просмотреть файл

@ -7,6 +7,7 @@
from azure.core.pipeline.transport import HttpRequest
def _convert_request(request, files=None):
data = request.content if not files else None
request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data)
@ -14,6 +15,7 @@ def _convert_request(request, files=None):
request.set_formdata_body(files)
return request
def _format_url_section(template, **kwargs):
components = template.split("/")
while components:
@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs):
return template.format(**kwargs)
except KeyError as key:
formatted_components = template.split("/")
components = [
c for c in formatted_components if "{}".format(key.args[0]) not in c
]
components = [c for c in formatted_components if "{}".format(key.args[0]) not in c]
template = "/".join(components)

Просмотреть файл

@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
VERSION = "1.1.0"
VERSION = "1.2.0"

Просмотреть файл

@ -7,9 +7,17 @@
# --------------------------------------------------------------------------
from ._azure_red_hat_open_shift_client import AzureRedHatOpenShiftClient
__all__ = ['AzureRedHatOpenShiftClient']
# `._patch.py` is used for handwritten extensions to the generated code
# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
from ._patch import patch_sdk
patch_sdk()
try:
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
__all__ = [
"AzureRedHatOpenShiftClient",
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()

Просмотреть файл

@ -9,12 +9,11 @@
from copy import deepcopy
from typing import Any, Awaitable, TYPE_CHECKING
from msrest import Deserializer, Serializer
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.mgmt.core import AsyncARMPipelineClient
from .. import models
from .. import models as _models
from ..._serialization import Deserializer, Serializer
from ._configuration import AzureRedHatOpenShiftClientConfiguration
from .operations import OpenShiftClustersOperations, Operations
@ -22,7 +21,8 @@ if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
class AzureRedHatOpenShiftClient:
class AzureRedHatOpenShiftClient: # pylint: disable=client-accepts-api-version-keyword
"""Rest API for Azure Red Hat OpenShift 4.
:ivar operations: Operations operations
@ -30,9 +30,9 @@ class AzureRedHatOpenShiftClient:
:ivar open_shift_clusters: OpenShiftClustersOperations operations
:vartype open_shift_clusters:
azure.mgmt.redhatopenshift.v2022_04_01.aio.operations.OpenShiftClustersOperations
:param credential: Credential needed for the client to connect to Azure.
: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.
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
@ -50,22 +50,21 @@ class AzureRedHatOpenShiftClient:
base_url: str = "https://management.azure.com",
**kwargs: Any
) -> None:
self._config = AzureRedHatOpenShiftClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
self._config = AzureRedHatOpenShiftClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
self.open_shift_clusters = OpenShiftClustersOperations(self._client, self._config, self._serialize, self._deserialize)
self.open_shift_clusters = OpenShiftClustersOperations(
self._client, self._config, self._serialize, self._deserialize
)
def _send_request(
self,
request: HttpRequest,
**kwargs: Any
) -> Awaitable[AsyncHttpResponse]:
def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
@ -74,7 +73,7 @@ class AzureRedHatOpenShiftClient:
>>> response = await client._send_request(request)
<AsyncHttpResponse: 200 OK>
For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
:param request: The network request you want to make. Required.
:type request: ~azure.core.rest.HttpRequest

Просмотреть файл

@ -6,6 +6,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import sys
from typing import Any, TYPE_CHECKING
from azure.core.configuration import Configuration
@ -14,6 +15,11 @@ from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuth
from .._version import VERSION
if sys.version_info >= (3, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
@ -25,23 +31,18 @@ class AzureRedHatOpenShiftClientConfiguration(Configuration): # pylint: disable
Note that all parameters used to create this instance are saved as instance
attributes.
:param credential: Credential needed for the client to connect to Azure.
: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.
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2022-04-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""
def __init__(
self,
credential: "AsyncTokenCredential",
subscription_id: str,
**kwargs: Any
) -> None:
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
super(AzureRedHatOpenShiftClientConfiguration, self).__init__(**kwargs)
api_version = kwargs.pop('api_version', "2022-04-01") # type: str
api_version: Literal["2022-04-01"] = kwargs.pop("api_version", "2022-04-01")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
@ -51,22 +52,21 @@ class AzureRedHatOpenShiftClientConfiguration(Configuration): # pylint: disable
self.credential = credential
self.subscription_id = subscription_id
self.api_version = api_version
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-redhatopenshift/{}'.format(VERSION))
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-redhatopenshift/{}".format(VERSION))
self._configure(**kwargs)
def _configure(
self,
**kwargs: Any
) -> None:
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
def _configure(self, **kwargs: Any) -> None:
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)
self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(
self.credential, *self.credential_scopes, **kwargs
)

Просмотреть файл

@ -28,4 +28,4 @@
# This file is used for handwritten extensions to the generated code. Example:
# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
def patch_sdk():
pass
pass

Просмотреть файл

@ -9,7 +9,13 @@
from ._operations import Operations
from ._open_shift_clusters_operations import OpenShiftClustersOperations
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
from ._patch import patch_sdk as _patch_sdk
__all__ = [
'Operations',
'OpenShiftClustersOperations',
"Operations",
"OpenShiftClustersOperations",
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()

Просмотреть файл

@ -6,81 +6,107 @@
# 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, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import 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 ..._vendor import _convert_request
from ...operations._operations import build_list_request
T = TypeVar('T')
if sys.version_info >= (3, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class Operations:
"""Operations async operations.
"""
.. warning::
**DO NOT** instantiate this class directly.
You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
:ivar models: Alias to model classes used in this operation group.
:type models: ~azure.mgmt.redhatopenshift.v2022_04_01.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
Instead, you should access the following operations through
:class:`~azure.mgmt.redhatopenshift.v2022_04_01.aio.AzureRedHatOpenShiftClient`'s
:attr:`operations` attribute.
"""
models = _models
def __init__(self, client, config, serializer, deserializer) -> None:
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config
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,
**kwargs: Any
) -> AsyncIterable["_models.OperationList"]:
def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]:
"""Lists all of the available RP operations.
The operation returns the RP operations.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either OperationList or the result of cls(response)
:return: An iterator like instance of either Operation or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2022_04_01.models.OperationList]
:raises: ~azure.core.exceptions.HttpResponseError
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2022_04_01.models.Operation]
:raises ~azure.core.exceptions.HttpResponseError:
"""
api_version = kwargs.pop('api_version', "2022-04-01") # type: str
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01"))
cls: ClsType[_models.OperationList] = kwargs.pop("cls", None)
cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationList"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop('error_map', {}))
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
api_version=api_version,
template_url=self.list.metadata['url'],
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
request = build_list_request(
api_version=api_version,
template_url=next_link,
# 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 = _convert_request(request)
request.url = self._client.format_url(request.url)
@ -91,16 +117,14 @@ class Operations:
deserialized = self._deserialize("OperationList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
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)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
@ -110,8 +134,6 @@ class Operations:
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
return AsyncItemPaged(
get_next, extract_data
)
list.metadata = {'url': "/providers/Microsoft.RedHatOpenShift/operations"} # type: ignore
list.metadata = {"url": "/providers/Microsoft.RedHatOpenShift/operations"}

Просмотреть файл

@ -0,0 +1,20 @@
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
"""Customize generated code here.
Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
"""
from typing import List
__all__: List[str] = [] # Add all objects you want publicly available to users at this package level
def patch_sdk():
"""Do not remove from this file.
`patch_sdk` is a last resort escape hatch that allows you to do customizations
you can't accomplish using the techniques described in
https://aka.ms/azsdk/python/dpcodegen/python/customize
"""

Просмотреть файл

@ -27,39 +27,41 @@ from ._models_py3 import SystemData
from ._models_py3 import TrackedResource
from ._models_py3 import WorkerProfile
from ._azure_red_hat_open_shift_client_enums import (
CreatedByType,
EncryptionAtHost,
FipsValidatedModules,
ProvisioningState,
Visibility,
)
from ._azure_red_hat_open_shift_client_enums import CreatedByType
from ._azure_red_hat_open_shift_client_enums import EncryptionAtHost
from ._azure_red_hat_open_shift_client_enums import FipsValidatedModules
from ._azure_red_hat_open_shift_client_enums import ProvisioningState
from ._azure_red_hat_open_shift_client_enums import Visibility
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
from ._patch import patch_sdk as _patch_sdk
__all__ = [
'APIServerProfile',
'CloudErrorBody',
'ClusterProfile',
'ConsoleProfile',
'Display',
'IngressProfile',
'MasterProfile',
'NetworkProfile',
'OpenShiftCluster',
'OpenShiftClusterAdminKubeconfig',
'OpenShiftClusterCredentials',
'OpenShiftClusterList',
'OpenShiftClusterUpdate',
'Operation',
'OperationList',
'Resource',
'ServicePrincipalProfile',
'SystemData',
'TrackedResource',
'WorkerProfile',
'CreatedByType',
'EncryptionAtHost',
'FipsValidatedModules',
'ProvisioningState',
'Visibility',
"APIServerProfile",
"CloudErrorBody",
"ClusterProfile",
"ConsoleProfile",
"Display",
"IngressProfile",
"MasterProfile",
"NetworkProfile",
"OpenShiftCluster",
"OpenShiftClusterAdminKubeconfig",
"OpenShiftClusterCredentials",
"OpenShiftClusterList",
"OpenShiftClusterUpdate",
"Operation",
"OperationList",
"Resource",
"ServicePrincipalProfile",
"SystemData",
"TrackedResource",
"WorkerProfile",
"CreatedByType",
"EncryptionAtHost",
"FipsValidatedModules",
"ProvisioningState",
"Visibility",
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()

Просмотреть файл

@ -7,36 +7,34 @@
# --------------------------------------------------------------------------
from enum import Enum
from six import with_metaclass
from azure.core import CaseInsensitiveEnumMeta
class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
"""The type of identity that created the resource.
"""
class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The type of identity that created the resource."""
USER = "User"
APPLICATION = "Application"
MANAGED_IDENTITY = "ManagedIdentity"
KEY = "Key"
class EncryptionAtHost(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
"""EncryptionAtHost represents encryption at host state
"""
class EncryptionAtHost(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""EncryptionAtHost represents encryption at host state."""
DISABLED = "Disabled"
ENABLED = "Enabled"
class FipsValidatedModules(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
"""FipsValidatedModules determines if FIPS is used.
"""
class FipsValidatedModules(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""FipsValidatedModules determines if FIPS is used."""
DISABLED = "Disabled"
ENABLED = "Enabled"
class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
"""ProvisioningState represents a provisioning state.
"""
class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""ProvisioningState represents a provisioning state."""
ADMIN_UPDATING = "AdminUpdating"
CREATING = "Creating"
@ -45,9 +43,9 @@ class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
SUCCEEDED = "Succeeded"
UPDATING = "Updating"
class Visibility(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
"""Visibility represents visibility.
"""
class Visibility(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Visibility represents visibility."""
PRIVATE = "Private"
PUBLIC = "Public"

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,20 @@
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
"""Customize generated code here.
Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
"""
from typing import List
__all__: List[str] = [] # Add all objects you want publicly available to users at this package level
def patch_sdk():
"""Do not remove from this file.
`patch_sdk` is a last resort escape hatch that allows you to do customizations
you can't accomplish using the techniques described in
https://aka.ms/azsdk/python/dpcodegen/python/customize
"""

Просмотреть файл

@ -9,7 +9,13 @@
from ._operations import Operations
from ._open_shift_clusters_operations import OpenShiftClustersOperations
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
from ._patch import patch_sdk as _patch_sdk
__all__ = [
'Operations',
'OpenShiftClustersOperations',
"Operations",
"OpenShiftClustersOperations",
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()

Просмотреть файл

@ -6,110 +6,128 @@
# 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, TypeVar
import urllib.parse
from msrest import Serializer
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
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.pipeline.transport import HttpResponse
from azure.core.rest import 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 ..._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar('T')
if sys.version_info >= (3, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_request(
**kwargs: Any
) -> HttpRequest:
api_version = kwargs.pop('api_version', "2022-04-01") # type: str
accept = "application/json"
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: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop("template_url", "/providers/Microsoft.RedHatOpenShift/operations")
# Construct parameters
_query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any]
_query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str')
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any]
_header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(
method="GET",
url=_url,
params=_query_parameters,
headers=_header_parameters,
**kwargs
)
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
class Operations(object):
"""Operations operations.
You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
class Operations:
"""
.. warning::
**DO NOT** instantiate this class directly.
:ivar models: Alias to model classes used in this operation group.
:type models: ~azure.mgmt.redhatopenshift.v2022_04_01.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
Instead, you should access the following operations through
:class:`~azure.mgmt.redhatopenshift.v2022_04_01.AzureRedHatOpenShiftClient`'s
:attr:`operations` attribute.
"""
models = _models
def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config
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,
**kwargs: Any
) -> Iterable["_models.OperationList"]:
def list(self, **kwargs: Any) -> Iterable["_models.Operation"]:
"""Lists all of the available RP operations.
The operation returns the RP operations.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either OperationList or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2022_04_01.models.OperationList]
:raises: ~azure.core.exceptions.HttpResponseError
:return: An iterator like instance of either Operation or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2022_04_01.models.Operation]
:raises ~azure.core.exceptions.HttpResponseError:
"""
api_version = kwargs.pop('api_version', "2022-04-01") # type: str
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: Literal["2022-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01"))
cls: ClsType[_models.OperationList] = kwargs.pop("cls", None)
cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationList"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop('error_map', {}))
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
api_version=api_version,
template_url=self.list.metadata['url'],
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
request = build_list_request(
api_version=api_version,
template_url=next_link,
# 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 = _convert_request(request)
request.url = self._client.format_url(request.url)
@ -120,16 +138,14 @@ class Operations(object):
deserialized = self._deserialize("OperationList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
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)
pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
@ -139,8 +155,6 @@ class Operations(object):
return pipeline_response
return ItemPaged(get_next, extract_data)
return ItemPaged(
get_next, extract_data
)
list.metadata = {'url': "/providers/Microsoft.RedHatOpenShift/operations"} # type: ignore
list.metadata = {"url": "/providers/Microsoft.RedHatOpenShift/operations"}

Просмотреть файл

@ -0,0 +1,20 @@
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
"""Customize generated code here.
Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
"""
from typing import List
__all__: List[str] = [] # Add all objects you want publicly available to users at this package level
def patch_sdk():
"""Do not remove from this file.
`patch_sdk` is a last resort escape hatch that allows you to do customizations
you can't accomplish using the techniques described in
https://aka.ms/azsdk/python/dpcodegen/python/customize
"""

Просмотреть файл

@ -0,0 +1,26 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from ._azure_red_hat_open_shift_client import AzureRedHatOpenShiftClient
from ._version import VERSION
__version__ = VERSION
try:
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
__all__ = [
"AzureRedHatOpenShiftClient",
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()

Просмотреть файл

@ -0,0 +1,127 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from copy import deepcopy
from typing import Any, TYPE_CHECKING
from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient
from . import models as _models
from .._serialization import Deserializer, Serializer
from ._configuration import AzureRedHatOpenShiftClientConfiguration
from .operations import (
MachinePoolsOperations,
OpenShiftClustersOperations,
OpenShiftVersionsOperations,
Operations,
SecretsOperations,
SyncIdentityProvidersOperations,
SyncSetsOperations,
)
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
class AzureRedHatOpenShiftClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
"""Rest API for Azure Red Hat OpenShift 4.
:ivar operations: Operations operations
:vartype operations: azure.mgmt.redhatopenshift.v2022_09_04.operations.Operations
:ivar open_shift_versions: OpenShiftVersionsOperations operations
:vartype open_shift_versions:
azure.mgmt.redhatopenshift.v2022_09_04.operations.OpenShiftVersionsOperations
:ivar open_shift_clusters: OpenShiftClustersOperations operations
:vartype open_shift_clusters:
azure.mgmt.redhatopenshift.v2022_09_04.operations.OpenShiftClustersOperations
:ivar machine_pools: MachinePoolsOperations operations
:vartype machine_pools:
azure.mgmt.redhatopenshift.v2022_09_04.operations.MachinePoolsOperations
:ivar secrets: SecretsOperations operations
:vartype secrets: azure.mgmt.redhatopenshift.v2022_09_04.operations.SecretsOperations
:ivar sync_identity_providers: SyncIdentityProvidersOperations operations
:vartype sync_identity_providers:
azure.mgmt.redhatopenshift.v2022_09_04.operations.SyncIdentityProvidersOperations
:ivar sync_sets: SyncSetsOperations operations
:vartype sync_sets: azure.mgmt.redhatopenshift.v2022_09_04.operations.SyncSetsOperations
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: Api Version. Default value is "2022-09-04". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
"""
def __init__(
self,
credential: "TokenCredential",
subscription_id: str,
base_url: str = "https://management.azure.com",
**kwargs: Any
) -> None:
self._config = AzureRedHatOpenShiftClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
self.open_shift_versions = OpenShiftVersionsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.open_shift_clusters = OpenShiftClustersOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.machine_pools = MachinePoolsOperations(self._client, self._config, self._serialize, self._deserialize)
self.secrets = SecretsOperations(self._client, self._config, self._serialize, self._deserialize)
self.sync_identity_providers = SyncIdentityProvidersOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.sync_sets = SyncSetsOperations(self._client, self._config, self._serialize, self._deserialize)
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = client._send_request(request)
<HttpResponse: 200 OK>
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
:param request: The network request you want to make. Required.
:type request: ~azure.core.rest.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.rest.HttpResponse
"""
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
return self._client.send_request(request_copy, **kwargs)
def close(self) -> None:
self._client.close()
def __enter__(self) -> "AzureRedHatOpenShiftClient":
self._client.__enter__()
return self
def __exit__(self, *exc_details) -> None:
self._client.__exit__(*exc_details)

Просмотреть файл

@ -0,0 +1,72 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import sys
from typing import Any, TYPE_CHECKING
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
from ._version import VERSION
if sys.version_info >= (3, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
class AzureRedHatOpenShiftClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
"""Configuration for AzureRedHatOpenShiftClient.
Note that all parameters used to create this instance are saved as instance
attributes.
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2022-09-04". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
super(AzureRedHatOpenShiftClientConfiguration, self).__init__(**kwargs)
api_version: Literal["2022-09-04"] = kwargs.pop("api_version", "2022-09-04")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
self.credential = credential
self.subscription_id = subscription_id
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-redhatopenshift/{}".format(VERSION))
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = ARMChallengeAuthenticationPolicy(
self.credential, *self.credential_scopes, **kwargs
)

Просмотреть файл

@ -0,0 +1,108 @@
{
"chosen_version": "2022-09-04",
"total_api_version_list": ["2022-09-04"],
"client": {
"name": "AzureRedHatOpenShiftClient",
"filename": "_azure_red_hat_open_shift_client",
"description": "Rest API for Azure Red Hat OpenShift 4.",
"host_value": "\"https://management.azure.com\"",
"parameterized_host_template": null,
"azure_arm": true,
"has_lro_operations": true,
"client_side_validation": false,
"sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AzureRedHatOpenShiftClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
"async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AzureRedHatOpenShiftClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"global_parameters": {
"sync": {
"credential": {
"signature": "credential: \"TokenCredential\",",
"description": "Credential needed for the client to connect to Azure. Required.",
"docstring_type": "~azure.core.credentials.TokenCredential",
"required": true
},
"subscription_id": {
"signature": "subscription_id: str,",
"description": "The ID of the target subscription. Required.",
"docstring_type": "str",
"required": true
}
},
"async": {
"credential": {
"signature": "credential: \"AsyncTokenCredential\",",
"description": "Credential needed for the client to connect to Azure. Required.",
"docstring_type": "~azure.core.credentials_async.AsyncTokenCredential",
"required": true
},
"subscription_id": {
"signature": "subscription_id: str,",
"description": "The ID of the target subscription. Required.",
"docstring_type": "str",
"required": true
}
},
"constant": {
},
"call": "credential, subscription_id",
"service_client_specific": {
"sync": {
"api_version": {
"signature": "api_version: Optional[str]=None,",
"description": "API version to use if no profile is provided, or if missing in profile.",
"docstring_type": "str",
"required": false
},
"base_url": {
"signature": "base_url: str = \"https://management.azure.com\",",
"description": "Service URL",
"docstring_type": "str",
"required": false
},
"profile": {
"signature": "profile: KnownProfiles=KnownProfiles.default,",
"description": "A profile definition, from KnownProfiles to dict.",
"docstring_type": "azure.profiles.KnownProfiles",
"required": false
}
},
"async": {
"api_version": {
"signature": "api_version: Optional[str] = None,",
"description": "API version to use if no profile is provided, or if missing in profile.",
"docstring_type": "str",
"required": false
},
"base_url": {
"signature": "base_url: str = \"https://management.azure.com\",",
"description": "Service URL",
"docstring_type": "str",
"required": false
},
"profile": {
"signature": "profile: KnownProfiles = KnownProfiles.default,",
"description": "A profile definition, from KnownProfiles to dict.",
"docstring_type": "azure.profiles.KnownProfiles",
"required": false
}
}
}
},
"config": {
"credential": true,
"credential_scopes": ["https://management.azure.com/.default"],
"credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)",
"credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)",
"sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
"async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"operation_groups": {
"operations": "Operations",
"open_shift_versions": "OpenShiftVersionsOperations",
"open_shift_clusters": "OpenShiftClustersOperations",
"machine_pools": "MachinePoolsOperations",
"secrets": "SecretsOperations",
"sync_identity_providers": "SyncIdentityProvidersOperations",
"sync_sets": "SyncSetsOperations"
}
}

Просмотреть файл

@ -0,0 +1,20 @@
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
"""Customize generated code here.
Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
"""
from typing import List
__all__: List[str] = [] # Add all objects you want publicly available to users at this package level
def patch_sdk():
"""Do not remove from this file.
`patch_sdk` is a last resort escape hatch that allows you to do customizations
you can't accomplish using the techniques described in
https://aka.ms/azsdk/python/dpcodegen/python/customize
"""

Просмотреть файл

@ -0,0 +1,27 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from azure.core.pipeline.transport import HttpRequest
def _convert_request(request, files=None):
data = request.content if not files else None
request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data)
if files:
request.set_formdata_body(files)
return request
def _format_url_section(template, **kwargs):
components = template.split("/")
while components:
try:
return template.format(**kwargs)
except KeyError as key:
formatted_components = template.split("/")
components = [c for c in formatted_components if "{}".format(key.args[0]) not in c]
template = "/".join(components)

Просмотреть файл

@ -0,0 +1,9 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
VERSION = "1.2.0"

Просмотреть файл

@ -0,0 +1,23 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from ._azure_red_hat_open_shift_client import AzureRedHatOpenShiftClient
try:
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
__all__ = [
"AzureRedHatOpenShiftClient",
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()

Просмотреть файл

@ -0,0 +1,127 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from copy import deepcopy
from typing import Any, Awaitable, TYPE_CHECKING
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.mgmt.core import AsyncARMPipelineClient
from .. import models as _models
from ..._serialization import Deserializer, Serializer
from ._configuration import AzureRedHatOpenShiftClientConfiguration
from .operations import (
MachinePoolsOperations,
OpenShiftClustersOperations,
OpenShiftVersionsOperations,
Operations,
SecretsOperations,
SyncIdentityProvidersOperations,
SyncSetsOperations,
)
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
class AzureRedHatOpenShiftClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
"""Rest API for Azure Red Hat OpenShift 4.
:ivar operations: Operations operations
:vartype operations: azure.mgmt.redhatopenshift.v2022_09_04.aio.operations.Operations
:ivar open_shift_versions: OpenShiftVersionsOperations operations
:vartype open_shift_versions:
azure.mgmt.redhatopenshift.v2022_09_04.aio.operations.OpenShiftVersionsOperations
:ivar open_shift_clusters: OpenShiftClustersOperations operations
:vartype open_shift_clusters:
azure.mgmt.redhatopenshift.v2022_09_04.aio.operations.OpenShiftClustersOperations
:ivar machine_pools: MachinePoolsOperations operations
:vartype machine_pools:
azure.mgmt.redhatopenshift.v2022_09_04.aio.operations.MachinePoolsOperations
:ivar secrets: SecretsOperations operations
:vartype secrets: azure.mgmt.redhatopenshift.v2022_09_04.aio.operations.SecretsOperations
:ivar sync_identity_providers: SyncIdentityProvidersOperations operations
:vartype sync_identity_providers:
azure.mgmt.redhatopenshift.v2022_09_04.aio.operations.SyncIdentityProvidersOperations
:ivar sync_sets: SyncSetsOperations operations
:vartype sync_sets: azure.mgmt.redhatopenshift.v2022_09_04.aio.operations.SyncSetsOperations
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: Api Version. Default value is "2022-09-04". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
"""
def __init__(
self,
credential: "AsyncTokenCredential",
subscription_id: str,
base_url: str = "https://management.azure.com",
**kwargs: Any
) -> None:
self._config = AzureRedHatOpenShiftClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
self.open_shift_versions = OpenShiftVersionsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.open_shift_clusters = OpenShiftClustersOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.machine_pools = MachinePoolsOperations(self._client, self._config, self._serialize, self._deserialize)
self.secrets = SecretsOperations(self._client, self._config, self._serialize, self._deserialize)
self.sync_identity_providers = SyncIdentityProvidersOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.sync_sets = SyncSetsOperations(self._client, self._config, self._serialize, self._deserialize)
def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = await client._send_request(request)
<AsyncHttpResponse: 200 OK>
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
:param request: The network request you want to make. Required.
:type request: ~azure.core.rest.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.rest.AsyncHttpResponse
"""
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
return self._client.send_request(request_copy, **kwargs)
async def close(self) -> None:
await self._client.close()
async def __aenter__(self) -> "AzureRedHatOpenShiftClient":
await self._client.__aenter__()
return self
async def __aexit__(self, *exc_details) -> None:
await self._client.__aexit__(*exc_details)

Просмотреть файл

@ -0,0 +1,72 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import sys
from typing import Any, TYPE_CHECKING
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy
from .._version import VERSION
if sys.version_info >= (3, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
class AzureRedHatOpenShiftClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
"""Configuration for AzureRedHatOpenShiftClient.
Note that all parameters used to create this instance are saved as instance
attributes.
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2022-09-04". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
super(AzureRedHatOpenShiftClientConfiguration, self).__init__(**kwargs)
api_version: Literal["2022-09-04"] = kwargs.pop("api_version", "2022-09-04")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
self.credential = credential
self.subscription_id = subscription_id
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-redhatopenshift/{}".format(VERSION))
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(
self.credential, *self.credential_scopes, **kwargs
)

Просмотреть файл

@ -0,0 +1,20 @@
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
"""Customize generated code here.
Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
"""
from typing import List
__all__: List[str] = [] # Add all objects you want publicly available to users at this package level
def patch_sdk():
"""Do not remove from this file.
`patch_sdk` is a last resort escape hatch that allows you to do customizations
you can't accomplish using the techniques described in
https://aka.ms/azsdk/python/dpcodegen/python/customize
"""

Просмотреть файл

@ -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.
# --------------------------------------------------------------------------
from ._operations import Operations
from ._open_shift_versions_operations import OpenShiftVersionsOperations
from ._open_shift_clusters_operations import OpenShiftClustersOperations
from ._machine_pools_operations import MachinePoolsOperations
from ._secrets_operations import SecretsOperations
from ._sync_identity_providers_operations import SyncIdentityProvidersOperations
from ._sync_sets_operations import SyncSetsOperations
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
from ._patch import patch_sdk as _patch_sdk
__all__ = [
"Operations",
"OpenShiftVersionsOperations",
"OpenShiftClustersOperations",
"MachinePoolsOperations",
"SecretsOperations",
"SyncIdentityProvidersOperations",
"SyncSetsOperations",
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()

Просмотреть файл

@ -0,0 +1,607 @@
# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import sys
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, 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.pipeline.transport import AsyncHttpResponse
from azure.core.rest import 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 ..._vendor import _convert_request
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, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class MachinePoolsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.redhatopenshift.v2022_09_04.aio.AzureRedHatOpenShiftClient`'s
:attr:`machine_pools` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@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
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either MachinePool or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: Literal["2022-09-04"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-04"))
cls: ClsType[_models.MachinePoolList] = kwargs.pop("cls", None)
error_map = {
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,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
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 = _convert_request(request)
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)
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/machinePools"
}
@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
:keyword callable cls: A custom type or function that will be passed the direct response
:return: MachinePool or the result of cls(response)
:rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: Literal["2022-09-04"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-04"))
cls: ClsType[_models.MachinePool] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
resource_name=resource_name,
child_resource_name=child_resource_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("MachinePool", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}"
}
@overload
async def create_or_update(
self,
resource_group_name: str,
resource_name: str,
child_resource_name: str,
parameters: _models.MachinePool,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.MachinePool:
"""Creates or updates a MachinePool with the specified subscription, resource group and resource
name.
The operation returns properties of a MachinePool.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param resource_name: The name of the OpenShift cluster resource. Required.
:type resource_name: str
:param child_resource_name: The name of the MachinePool resource. Required.
:type child_resource_name: str
:param parameters: The MachinePool resource. Required.
:type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: MachinePool or the result of cls(response)
:rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def create_or_update(
self,
resource_group_name: str,
resource_name: str,
child_resource_name: str,
parameters: IO,
*,
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
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: MachinePool or the result of cls(response)
:rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def create_or_update(
self,
resource_group_name: str,
resource_name: str,
child_resource_name: str,
parameters: Union[_models.MachinePool, IO],
**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 model type or a IO type. Required.
:type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: MachinePool or the result of cls(response)
:rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: Literal["2022-09-04"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-04"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.MachinePool] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(parameters, (IO, 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,
template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("MachinePool", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("MachinePool", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}"
}
@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
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: Literal["2022-09-04"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-04"))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
resource_name=resource_name,
child_resource_name=child_resource_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **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, {})
delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}"
}
@overload
async def update(
self,
resource_group_name: str,
resource_name: str,
child_resource_name: str,
parameters: _models.MachinePoolUpdate,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.MachinePool:
"""Updates a MachinePool with the specified subscription, resource group and resource name.
The operation returns properties of a MachinePool.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param resource_name: The name of the OpenShift cluster resource. Required.
:type resource_name: str
:param child_resource_name: The name of the MachinePool resource. Required.
:type child_resource_name: str
:param parameters: The MachinePool resource. Required.
:type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePoolUpdate
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: MachinePool or the result of cls(response)
:rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def update(
self,
resource_group_name: str,
resource_name: str,
child_resource_name: str,
parameters: IO,
*,
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
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: MachinePool or the result of cls(response)
:rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def update(
self,
resource_group_name: str,
resource_name: str,
child_resource_name: str,
parameters: Union[_models.MachinePoolUpdate, IO],
**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 model type or a IO type. Required.
:type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePoolUpdate or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: MachinePool or the result of cls(response)
:rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: Literal["2022-09-04"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-04"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.MachinePool] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(parameters, (IO, 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,
template_url=self.update.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("MachinePool", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}"
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,145 @@
# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import 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 ..._vendor import _convert_request
from ...operations._open_shift_versions_operations import build_list_request
if sys.version_info >= (3, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class OpenShiftVersionsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.redhatopenshift.v2022_09_04.aio.AzureRedHatOpenShiftClient`'s
:attr:`open_shift_versions` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.OpenShiftVersion"]:
"""Lists all OpenShift versions available to install in the specified location.
The operation returns the installable OpenShift versions as strings.
:param location: The name of Azure region. Required.
:type location: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either OpenShiftVersion or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.OpenShiftVersion]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: Literal["2022-09-04"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-04"))
cls: ClsType[_models.OpenShiftVersionList] = kwargs.pop("cls", None)
error_map = {
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,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
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 = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("OpenShiftVersionList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/providers/Microsoft.RedHatOpenShift/locations/{location}/openshiftversions"
}

Просмотреть файл

@ -0,0 +1,139 @@
# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import 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 ..._vendor import _convert_request
from ...operations._operations import build_list_request
if sys.version_info >= (3, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class Operations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.redhatopenshift.v2022_09_04.aio.AzureRedHatOpenShiftClient`'s
:attr:`operations` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]:
"""Lists all of the available RP operations.
The operation returns the RP operations.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Operation or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.Operation]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: Literal["2022-09-04"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-04"))
cls: ClsType[_models.OperationList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
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 = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("OperationList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {"url": "/providers/Microsoft.RedHatOpenShift/operations"}

Просмотреть файл

@ -0,0 +1,20 @@
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
"""Customize generated code here.
Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
"""
from typing import List
__all__: List[str] = [] # Add all objects you want publicly available to users at this package level
def patch_sdk():
"""Do not remove from this file.
`patch_sdk` is a last resort escape hatch that allows you to do customizations
you can't accomplish using the techniques described in
https://aka.ms/azsdk/python/dpcodegen/python/customize
"""

Просмотреть файл

@ -0,0 +1,604 @@
# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import sys
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, 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.pipeline.transport import AsyncHttpResponse
from azure.core.rest import 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 ..._vendor import _convert_request
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, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class SecretsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.redhatopenshift.v2022_09_04.aio.AzureRedHatOpenShiftClient`'s
:attr:`secrets` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@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
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Secret or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: Literal["2022-09-04"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-04"))
cls: ClsType[_models.SecretList] = kwargs.pop("cls", None)
error_map = {
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,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
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 = _convert_request(request)
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)
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/secrets"
}
@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
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Secret or the result of cls(response)
:rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: Literal["2022-09-04"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-04"))
cls: ClsType[_models.Secret] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
resource_name=resource_name,
child_resource_name=child_resource_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("Secret", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}"
}
@overload
async def create_or_update(
self,
resource_group_name: str,
resource_name: str,
child_resource_name: str,
parameters: _models.Secret,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.Secret:
"""Creates or updates a Secret with the specified subscription, resource group and resource name.
The operation returns properties of a Secret.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param resource_name: The name of the OpenShift cluster resource. Required.
:type resource_name: str
:param child_resource_name: The name of the Secret resource. Required.
:type child_resource_name: str
:param parameters: The Secret resource. Required.
:type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Secret or the result of cls(response)
:rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def create_or_update(
self,
resource_group_name: str,
resource_name: str,
child_resource_name: str,
parameters: IO,
*,
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
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Secret or the result of cls(response)
:rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def create_or_update(
self,
resource_group_name: str,
resource_name: str,
child_resource_name: str,
parameters: Union[_models.Secret, IO],
**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 model type or a IO type. Required.
:type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Secret or the result of cls(response)
:rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: Literal["2022-09-04"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-04"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Secret] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(parameters, (IO, 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,
template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("Secret", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("Secret", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}"
}
@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
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: Literal["2022-09-04"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-04"))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
resource_name=resource_name,
child_resource_name=child_resource_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **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, {})
delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}"
}
@overload
async def update(
self,
resource_group_name: str,
resource_name: str,
child_resource_name: str,
parameters: _models.SecretUpdate,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.Secret:
"""Updates a Secret with the specified subscription, resource group and resource name.
The operation returns properties of a Secret.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param resource_name: The name of the OpenShift cluster resource. Required.
:type resource_name: str
:param child_resource_name: The name of the Secret resource. Required.
:type child_resource_name: str
:param parameters: The Secret resource. Required.
:type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SecretUpdate
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Secret or the result of cls(response)
:rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def update(
self,
resource_group_name: str,
resource_name: str,
child_resource_name: str,
parameters: IO,
*,
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
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Secret or the result of cls(response)
:rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def update(
self,
resource_group_name: str,
resource_name: str,
child_resource_name: str,
parameters: Union[_models.SecretUpdate, IO],
**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 model type or a IO type. Required.
:type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SecretUpdate or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Secret or the result of cls(response)
:rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: Literal["2022-09-04"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-04"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Secret] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(parameters, (IO, 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,
template_url=self.update.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("Secret", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}"
}

Просмотреть файл

@ -0,0 +1,617 @@
# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import sys
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, 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.pipeline.transport import AsyncHttpResponse
from azure.core.rest import 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 ..._vendor import _convert_request
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, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class SyncIdentityProvidersOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.redhatopenshift.v2022_09_04.aio.AzureRedHatOpenShiftClient`'s
:attr:`sync_identity_providers` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@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
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either SyncIdentityProvider or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: Literal["2022-09-04"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-04"))
cls: ClsType[_models.SyncIdentityProviderList] = kwargs.pop("cls", None)
error_map = {
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,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
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 = _convert_request(request)
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)
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/syncIdentityProviders"
}
@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
:keyword callable cls: A custom type or function that will be passed the direct response
:return: SyncIdentityProvider or the result of cls(response)
:rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: Literal["2022-09-04"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-04"))
cls: ClsType[_models.SyncIdentityProvider] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
resource_name=resource_name,
child_resource_name=child_resource_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("SyncIdentityProvider", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}"
}
@overload
async def create_or_update(
self,
resource_group_name: str,
resource_name: str,
child_resource_name: str,
parameters: _models.SyncIdentityProvider,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.SyncIdentityProvider:
"""Creates or updates a SyncIdentityProvider with the specified subscription, resource group and
resource name.
The operation returns properties of a SyncIdentityProvider.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param resource_name: The name of the OpenShift cluster resource. Required.
:type resource_name: str
:param child_resource_name: The name of the SyncIdentityProvider resource. Required.
:type child_resource_name: str
:param parameters: The SyncIdentityProvider resource. Required.
:type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: SyncIdentityProvider or the result of cls(response)
:rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def create_or_update(
self,
resource_group_name: str,
resource_name: str,
child_resource_name: str,
parameters: IO,
*,
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
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: SyncIdentityProvider or the result of cls(response)
:rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def create_or_update(
self,
resource_group_name: str,
resource_name: str,
child_resource_name: str,
parameters: Union[_models.SyncIdentityProvider, IO],
**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 model type or a IO type.
Required.
:type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: SyncIdentityProvider or the result of cls(response)
:rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: Literal["2022-09-04"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-04"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.SyncIdentityProvider] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(parameters, (IO, 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,
template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("SyncIdentityProvider", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("SyncIdentityProvider", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}"
}
@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
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: Literal["2022-09-04"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-04"))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
resource_name=resource_name,
child_resource_name=child_resource_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **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, {})
delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}"
}
@overload
async def update(
self,
resource_group_name: str,
resource_name: str,
child_resource_name: str,
parameters: _models.SyncIdentityProviderUpdate,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.SyncIdentityProvider:
"""Updates a SyncIdentityProvider with the specified subscription, resource group and resource
name.
The operation returns properties of a SyncIdentityProvider.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param resource_name: The name of the OpenShift cluster resource. Required.
:type resource_name: str
:param child_resource_name: The name of the SyncIdentityProvider resource. Required.
:type child_resource_name: str
:param parameters: The SyncIdentityProvider resource. Required.
:type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProviderUpdate
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: SyncIdentityProvider or the result of cls(response)
:rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def update(
self,
resource_group_name: str,
resource_name: str,
child_resource_name: str,
parameters: IO,
*,
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
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: SyncIdentityProvider or the result of cls(response)
:rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def update(
self,
resource_group_name: str,
resource_name: str,
child_resource_name: str,
parameters: Union[_models.SyncIdentityProviderUpdate, IO],
**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 model type or a IO type.
Required.
:type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProviderUpdate or
IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: SyncIdentityProvider or the result of cls(response)
:rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: Literal["2022-09-04"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-04"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.SyncIdentityProvider] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(parameters, (IO, 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,
template_url=self.update.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("SyncIdentityProvider", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}"
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше