Skip to content

Commit

Permalink
CodeGen from PR 21248 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Azure RedHat OpenShift 2022-09-04 (Azure#21248)

* Previous API Version 2022-04-01

* add new api 2022-09-04

refactor list install versions

* Add patterns, remove 201s for PUTs

* Update examples

* Remove patterns, add back 201s for PUTs

* Fix response codes

* Remove patterns

* Update examples

* Update readme.python.md

* Removed 201 modified from added resources

* Satisfy ModelValidation.

* Implement pattern restrictions on new resources

Co-authored-by: Ross Bryan <[email protected]>
Co-authored-by: Yuchao Yan <[email protected]>
  • Loading branch information
3 people committed Dec 7, 2022
1 parent c86892a commit b859123
Show file tree
Hide file tree
Showing 111 changed files with 18,858 additions and 3,891 deletions.
12 changes: 6 additions & 6 deletions sdk/redhatopenshift/azure-mgmt-redhatopenshift/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"autorest": "3.7.2",
"commit": "1be09531e4c6edeafde41d6562371566d39669e8",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.2",
"use": [
"@autorest/python@5.13.0",
"@autorest/modelerfour@4.19.3"
"@autorest/python@6.2.7",
"@autorest/modelerfour@4.24.3"
],
"commit": "50ed15bd61ac79f2368d769df0c207a00b9e099f",
"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/[email protected] --use=@autorest/[email protected] --version=3.7.2",
"autorest_command": "autorest specification/redhatopenshift/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.9.2 --version-tolerant=False",
"readme": "specification/redhatopenshift/resource-manager/readme.md"
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@
patch_sdk()
except ImportError:
pass

from ._version import VERSION

__version__ = VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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
Expand All @@ -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: {
Expand All @@ -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)
Expand All @@ -92,6 +89,7 @@ def models(cls, api_version=DEFAULT_API_VERSION):
* 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
Expand All @@ -102,15 +100,33 @@ def models(cls, api_version=DEFAULT_API_VERSION):
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:
* 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':
Expand All @@ -119,8 +135,25 @@ def open_shift_clusters(self):
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
Expand All @@ -130,6 +163,7 @@ def operations(self):
* 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':
Expand All @@ -138,8 +172,53 @@ def operations(self):
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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -18,8 +18,6 @@

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any

from azure.core.credentials import TokenCredential

class AzureRedHatOpenShiftClientConfiguration(Configuration):
Expand All @@ -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:
Expand All @@ -55,9 +52,8 @@ def __init__(

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)
Expand Down
Loading

0 comments on commit b859123

Please sign in to comment.