Skip to content

Commit 5f796d3

Browse files
authored
code and test (Azure#31489)
Co-authored-by: azure-sdk <PythonSdkPipelines>
1 parent b6f06d8 commit 5f796d3

File tree

123 files changed

+11988
-834
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+11988
-834
lines changed

sdk/redhatopenshift/azure-mgmt-redhatopenshift/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Release History
22

3+
## 1.3.0 (2023-08-18)
4+
5+
### Features Added
6+
7+
- Model NetworkProfile has a new parameter outbound_type
8+
39
## 1.3.0b1 (2023-02-16)
410

511
### Other Changes

sdk/redhatopenshift/azure-mgmt-redhatopenshift/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ client = AzureRedHatOpenShiftClient(credential=DefaultAzureCredential(), subscri
4545

4646
## Examples
4747

48-
49-
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 and [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)
48+
Code samples for this package can be found at:
49+
- [Search 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
50+
- [Azure Python Mgmt SDK Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)
5051

5152

5253
## Troubleshooting
Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
{
2-
"commit": "51d4c24a011e300b9713179e0515fef35bf3f678",
2+
"commit": "a3089b2764df11b10a8a43e2a5a33dbe4d3653ca",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4-
"autorest": "3.9.2",
4+
"autorest": "3.9.7",
55
"use": [
6-
"@autorest/python@6.4.0",
7-
"@autorest/modelerfour@4.24.3"
6+
"@autorest/python@6.7.1",
7+
"@autorest/modelerfour@4.26.2"
88
],
9-
"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.4.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
10-
"readme": "specification/redhatopenshift/resource-manager/readme.md"
9+
"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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False",
10+
"readme": "specification/redhatopenshift/resource-manager/readme.md",
11+
"package-2020-04-30": "2022-03-13 20:06:12 -0700 b0a0fccef5bfe412614343ef20a5be7427661330 Microsoft.RedHatOpenShift/stable/2020-04-30/redhatopenshift.json",
12+
"package-2021-09-01-preview": "2021-09-08 03:37:58 +0300 b9e1a57680ad54fd555bce727702550aefcd2d47 Microsoft.RedHatOpenShift/preview/2021-09-01-preview/redhatopenshift.json",
13+
"package-2022-04-01": "2022-04-26 20:09:23 -0700 3c622a337592e7debc58b09a9fdc3aa275ba808f Microsoft.RedHatOpenShift/stable/2022-04-01/redhatopenshift.json",
14+
"package-2022-09-04": "2022-12-06 18:13:21 -0800 1be09531e4c6edeafde41d6562371566d39669e8 Microsoft.RedHatOpenShift/stable/2022-09-04/redhatopenshift.json",
15+
"package-2023-04-01": "2023-07-24 17:12:10 +1000 db80d2c04a9e7ecd7d1fee6da42fe5b825fabf4b Microsoft.RedHatOpenShift/stable/2023-04-01/redhatopenshift.json"
1116
}

sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_azure_red_hat_open_shift_client.py

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class AzureRedHatOpenShiftClient(MultiApiClientMixin, _SDKClient):
5353
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
5454
"""
5555

56-
DEFAULT_API_VERSION = '2022-09-04'
56+
DEFAULT_API_VERSION = '2023-04-01'
5757
_PROFILE_TAG = "azure.mgmt.redhatopenshift.AzureRedHatOpenShiftClient"
5858
LATEST_PROFILE = ProfileDefinition({
5959
_PROFILE_TAG: {
@@ -71,6 +71,8 @@ def __init__(
7171
profile: KnownProfiles=KnownProfiles.default,
7272
**kwargs: Any
7373
):
74+
if api_version:
75+
kwargs.setdefault('api_version', api_version)
7476
self._config = AzureRedHatOpenShiftClientConfiguration(credential, subscription_id, **kwargs)
7577
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
7678
super(AzureRedHatOpenShiftClient, self).__init__(
@@ -90,6 +92,7 @@ def models(cls, api_version=DEFAULT_API_VERSION):
9092
* 2021-09-01-preview: :mod:`v2021_09_01_preview.models<azure.mgmt.redhatopenshift.v2021_09_01_preview.models>`
9193
* 2022-04-01: :mod:`v2022_04_01.models<azure.mgmt.redhatopenshift.v2022_04_01.models>`
9294
* 2022-09-04: :mod:`v2022_09_04.models<azure.mgmt.redhatopenshift.v2022_09_04.models>`
95+
* 2023-04-01: :mod:`v2023_04_01.models<azure.mgmt.redhatopenshift.v2023_04_01.models>`
9396
"""
9497
if api_version == '2020-04-30':
9598
from .v2020_04_30 import models
@@ -103,21 +106,27 @@ def models(cls, api_version=DEFAULT_API_VERSION):
103106
elif api_version == '2022-09-04':
104107
from .v2022_09_04 import models
105108
return models
109+
elif api_version == '2023-04-01':
110+
from .v2023_04_01 import models
111+
return models
106112
raise ValueError("API version {} is not available".format(api_version))
107113

108114
@property
109115
def machine_pools(self):
110116
"""Instance depends on the API version:
111117
112118
* 2022-09-04: :class:`MachinePoolsOperations<azure.mgmt.redhatopenshift.v2022_09_04.operations.MachinePoolsOperations>`
119+
* 2023-04-01: :class:`MachinePoolsOperations<azure.mgmt.redhatopenshift.v2023_04_01.operations.MachinePoolsOperations>`
113120
"""
114121
api_version = self._get_api_version('machine_pools')
115122
if api_version == '2022-09-04':
116123
from .v2022_09_04.operations import MachinePoolsOperations as OperationClass
124+
elif api_version == '2023-04-01':
125+
from .v2023_04_01.operations import MachinePoolsOperations as OperationClass
117126
else:
118127
raise ValueError("API version {} does not have operation group 'machine_pools'".format(api_version))
119128
self._config.api_version = api_version
120-
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
129+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)
121130

122131
@property
123132
def open_shift_clusters(self):
@@ -127,6 +136,7 @@ def open_shift_clusters(self):
127136
* 2021-09-01-preview: :class:`OpenShiftClustersOperations<azure.mgmt.redhatopenshift.v2021_09_01_preview.operations.OpenShiftClustersOperations>`
128137
* 2022-04-01: :class:`OpenShiftClustersOperations<azure.mgmt.redhatopenshift.v2022_04_01.operations.OpenShiftClustersOperations>`
129138
* 2022-09-04: :class:`OpenShiftClustersOperations<azure.mgmt.redhatopenshift.v2022_09_04.operations.OpenShiftClustersOperations>`
139+
* 2023-04-01: :class:`OpenShiftClustersOperations<azure.mgmt.redhatopenshift.v2023_04_01.operations.OpenShiftClustersOperations>`
130140
"""
131141
api_version = self._get_api_version('open_shift_clusters')
132142
if api_version == '2020-04-30':
@@ -137,24 +147,29 @@ def open_shift_clusters(self):
137147
from .v2022_04_01.operations import OpenShiftClustersOperations as OperationClass
138148
elif api_version == '2022-09-04':
139149
from .v2022_09_04.operations import OpenShiftClustersOperations as OperationClass
150+
elif api_version == '2023-04-01':
151+
from .v2023_04_01.operations import OpenShiftClustersOperations as OperationClass
140152
else:
141153
raise ValueError("API version {} does not have operation group 'open_shift_clusters'".format(api_version))
142154
self._config.api_version = api_version
143-
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
155+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)
144156

145157
@property
146158
def open_shift_versions(self):
147159
"""Instance depends on the API version:
148160
149161
* 2022-09-04: :class:`OpenShiftVersionsOperations<azure.mgmt.redhatopenshift.v2022_09_04.operations.OpenShiftVersionsOperations>`
162+
* 2023-04-01: :class:`OpenShiftVersionsOperations<azure.mgmt.redhatopenshift.v2023_04_01.operations.OpenShiftVersionsOperations>`
150163
"""
151164
api_version = self._get_api_version('open_shift_versions')
152165
if api_version == '2022-09-04':
153166
from .v2022_09_04.operations import OpenShiftVersionsOperations as OperationClass
167+
elif api_version == '2023-04-01':
168+
from .v2023_04_01.operations import OpenShiftVersionsOperations as OperationClass
154169
else:
155170
raise ValueError("API version {} does not have operation group 'open_shift_versions'".format(api_version))
156171
self._config.api_version = api_version
157-
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
172+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)
158173

159174
@property
160175
def operations(self):
@@ -164,6 +179,7 @@ def operations(self):
164179
* 2021-09-01-preview: :class:`Operations<azure.mgmt.redhatopenshift.v2021_09_01_preview.operations.Operations>`
165180
* 2022-04-01: :class:`Operations<azure.mgmt.redhatopenshift.v2022_04_01.operations.Operations>`
166181
* 2022-09-04: :class:`Operations<azure.mgmt.redhatopenshift.v2022_09_04.operations.Operations>`
182+
* 2023-04-01: :class:`Operations<azure.mgmt.redhatopenshift.v2023_04_01.operations.Operations>`
167183
"""
168184
api_version = self._get_api_version('operations')
169185
if api_version == '2020-04-30':
@@ -174,52 +190,63 @@ def operations(self):
174190
from .v2022_04_01.operations import Operations as OperationClass
175191
elif api_version == '2022-09-04':
176192
from .v2022_09_04.operations import Operations as OperationClass
193+
elif api_version == '2023-04-01':
194+
from .v2023_04_01.operations import Operations as OperationClass
177195
else:
178196
raise ValueError("API version {} does not have operation group 'operations'".format(api_version))
179197
self._config.api_version = api_version
180-
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
198+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)
181199

182200
@property
183201
def secrets(self):
184202
"""Instance depends on the API version:
185203
186204
* 2022-09-04: :class:`SecretsOperations<azure.mgmt.redhatopenshift.v2022_09_04.operations.SecretsOperations>`
205+
* 2023-04-01: :class:`SecretsOperations<azure.mgmt.redhatopenshift.v2023_04_01.operations.SecretsOperations>`
187206
"""
188207
api_version = self._get_api_version('secrets')
189208
if api_version == '2022-09-04':
190209
from .v2022_09_04.operations import SecretsOperations as OperationClass
210+
elif api_version == '2023-04-01':
211+
from .v2023_04_01.operations import SecretsOperations as OperationClass
191212
else:
192213
raise ValueError("API version {} does not have operation group 'secrets'".format(api_version))
193214
self._config.api_version = api_version
194-
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
215+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)
195216

196217
@property
197218
def sync_identity_providers(self):
198219
"""Instance depends on the API version:
199220
200221
* 2022-09-04: :class:`SyncIdentityProvidersOperations<azure.mgmt.redhatopenshift.v2022_09_04.operations.SyncIdentityProvidersOperations>`
222+
* 2023-04-01: :class:`SyncIdentityProvidersOperations<azure.mgmt.redhatopenshift.v2023_04_01.operations.SyncIdentityProvidersOperations>`
201223
"""
202224
api_version = self._get_api_version('sync_identity_providers')
203225
if api_version == '2022-09-04':
204226
from .v2022_09_04.operations import SyncIdentityProvidersOperations as OperationClass
227+
elif api_version == '2023-04-01':
228+
from .v2023_04_01.operations import SyncIdentityProvidersOperations as OperationClass
205229
else:
206230
raise ValueError("API version {} does not have operation group 'sync_identity_providers'".format(api_version))
207231
self._config.api_version = api_version
208-
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
232+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)
209233

210234
@property
211235
def sync_sets(self):
212236
"""Instance depends on the API version:
213237
214238
* 2022-09-04: :class:`SyncSetsOperations<azure.mgmt.redhatopenshift.v2022_09_04.operations.SyncSetsOperations>`
239+
* 2023-04-01: :class:`SyncSetsOperations<azure.mgmt.redhatopenshift.v2023_04_01.operations.SyncSetsOperations>`
215240
"""
216241
api_version = self._get_api_version('sync_sets')
217242
if api_version == '2022-09-04':
218243
from .v2022_09_04.operations import SyncSetsOperations as OperationClass
244+
elif api_version == '2023-04-01':
245+
from .v2023_04_01.operations import SyncSetsOperations as OperationClass
219246
else:
220247
raise ValueError("API version {} does not have operation group 'sync_sets'".format(api_version))
221248
self._config.api_version = api_version
222-
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
249+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)
223250

224251
def close(self):
225252
self._client.close()

sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_serialization.py

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs):
631631
if xml_desc.get("attr", False):
632632
if xml_ns:
633633
ET.register_namespace(xml_prefix, xml_ns)
634-
xml_name = "{}{}".format(xml_ns, xml_name)
634+
xml_name = "{{{}}}{}".format(xml_ns, xml_name)
635635
serialized.set(xml_name, new_attr) # type: ignore
636636
continue
637637
if xml_desc.get("text", False):
@@ -664,8 +664,9 @@ def _serialize(self, target_obj, data_type=None, **kwargs):
664664
_serialized.update(_new_attr) # type: ignore
665665
_new_attr = _new_attr[k] # type: ignore
666666
_serialized = _serialized[k]
667-
except ValueError:
668-
continue
667+
except ValueError as err:
668+
if isinstance(err, SerializationError):
669+
raise
669670

670671
except (AttributeError, KeyError, TypeError) as err:
671672
msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj))
@@ -743,6 +744,8 @@ def query(self, name, data, data_type, **kwargs):
743744
744745
:param data: The data to be serialized.
745746
:param str data_type: The type to be serialized from.
747+
:keyword bool skip_quote: Whether to skip quote the serialized result.
748+
Defaults to False.
746749
:rtype: str
747750
:raises: TypeError if serialization fails.
748751
:raises: ValueError if data is None
@@ -751,10 +754,8 @@ def query(self, name, data, data_type, **kwargs):
751754
# Treat the list aside, since we don't want to encode the div separator
752755
if data_type.startswith("["):
753756
internal_data_type = data_type[1:-1]
754-
data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data]
755-
if not kwargs.get("skip_quote", False):
756-
data = [quote(str(d), safe="") for d in data]
757-
return str(self.serialize_iter(data, internal_data_type, **kwargs))
757+
do_quote = not kwargs.get('skip_quote', False)
758+
return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs))
758759

759760
# Not a list, regular serialization
760761
output = self.serialize_data(data, data_type, **kwargs)
@@ -893,6 +894,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs):
893894
not be None or empty.
894895
:param str div: If set, this str will be used to combine the elements
895896
in the iterable into a combined string. Default is 'None'.
897+
:keyword bool do_quote: Whether to quote the serialized result of each iterable element.
898+
Defaults to False.
896899
:rtype: list, str
897900
"""
898901
if isinstance(data, str):
@@ -905,9 +908,18 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs):
905908
for d in data:
906909
try:
907910
serialized.append(self.serialize_data(d, iter_type, **kwargs))
908-
except ValueError:
911+
except ValueError as err:
912+
if isinstance(err, SerializationError):
913+
raise
909914
serialized.append(None)
910915

916+
if kwargs.get('do_quote', False):
917+
serialized = [
918+
'' if s is None else quote(str(s), safe='')
919+
for s
920+
in serialized
921+
]
922+
911923
if div:
912924
serialized = ["" if s is None else str(s) for s in serialized]
913925
serialized = div.join(serialized)
@@ -952,7 +964,9 @@ def serialize_dict(self, attr, dict_type, **kwargs):
952964
for key, value in attr.items():
953965
try:
954966
serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs)
955-
except ValueError:
967+
except ValueError as err:
968+
if isinstance(err, SerializationError):
969+
raise
956970
serialized[self.serialize_unicode(key)] = None
957971

958972
if "xml" in serialization_ctxt:
@@ -1273,7 +1287,7 @@ def _extract_name_from_internal_type(internal_type):
12731287
xml_name = internal_type_xml_map.get("name", internal_type.__name__)
12741288
xml_ns = internal_type_xml_map.get("ns", None)
12751289
if xml_ns:
1276-
xml_name = "{}{}".format(xml_ns, xml_name)
1290+
xml_name = "{{{}}}{}".format(xml_ns, xml_name)
12771291
return xml_name
12781292

12791293

@@ -1297,7 +1311,7 @@ def xml_key_extractor(attr, attr_desc, data):
12971311
# Integrate namespace if necessary
12981312
xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None))
12991313
if xml_ns:
1300-
xml_name = "{}{}".format(xml_ns, xml_name)
1314+
xml_name = "{{{}}}{}".format(xml_ns, xml_name)
13011315

13021316
# If it's an attribute, that's simple
13031317
if xml_desc.get("attr", False):

sdk/redhatopenshift/azure-mgmt-redhatopenshift/azure/mgmt/redhatopenshift/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
VERSION = "1.3.0b1"
9+
VERSION = "1.3.0"
1010

0 commit comments

Comments
 (0)