Skip to content

Commit 9d96133

Browse files
[AutoRelease] t2-servicefabricmanagedclusters-2024-10-08-57405(can only be merged by SDK owner) (Azure#37768)
* code and test * update-testcase * update-testcases --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: ChenxiJiang333 <[email protected]>
1 parent 6ea0798 commit 9d96133

File tree

143 files changed

+3603
-722
lines changed

Some content is hidden

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

143 files changed

+3603
-722
lines changed

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

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

3+
## 2.1.0b1 (2024-10-21)
4+
5+
### Features Added
6+
7+
- Model `ManagedCluster` added property `auto_generated_domain_name_label_scope`
8+
- Model `ManagedCluster` added property `custom_fqdn`
9+
- Model `NodeType` added property `vm_applications`
10+
- Added enum `AutoGeneratedDomainNameLabelScope`
11+
- Added model `VmApplication`
12+
313
## 2.0.0 (2024-07-22)
414

515
### Features Added
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"commit": "d1296700aa6cd650970e9891dd58eef5698327fd",
2+
"commit": "9a8af2acfafc4d7a23eff41b859d2d332f51b0bc",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
44
"autorest": "3.10.2",
55
"use": [
6-
"@autorest/python@6.13.19",
6+
"@autorest/python@6.19.0",
77
"@autorest/[email protected]"
88
],
9-
"autorest_command": "autorest specification/servicefabricmanagedclusters/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.13.19 --use=@autorest/[email protected] --version=3.10.2 --version-tolerant=False",
9+
"autorest_command": "autorest specification/servicefabricmanagedclusters/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.19.0 --use=@autorest/[email protected] --version=3.10.2 --version-tolerant=False",
1010
"readme": "specification/servicefabricmanagedclusters/resource-manager/readme.md"
1111
}

sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/assets.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_configuration.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ class ServiceFabricManagedClustersManagementClientConfiguration: # pylint: disa
2828
:type credential: ~azure.core.credentials.TokenCredential
2929
:param subscription_id: The customer subscription identifier. Required.
3030
:type subscription_id: str
31-
:keyword api_version: Api Version. Default value is "2024-04-01". Note that overriding this
32-
default value may result in unsupported behavior.
31+
:keyword api_version: Api Version. Default value is "2024-06-01-preview". Note that overriding
32+
this default value may result in unsupported behavior.
3333
:paramtype api_version: str
3434
"""
3535

3636
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
37-
api_version: str = kwargs.pop("api_version", "2024-04-01")
37+
api_version: str = kwargs.pop("api_version", "2024-06-01-preview")
3838

3939
if credential is None:
4040
raise ValueError("Parameter 'credential' must not be None.")

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ def _json_attemp(data):
144144
# context otherwise.
145145
_LOGGER.critical("Wasn't XML not JSON, failing")
146146
raise DeserializationError("XML is invalid") from err
147+
elif content_type.startswith("text/"):
148+
return data_as_str
147149
raise DeserializationError("Cannot deserialize content-type: {}".format(content_type))
148150

149151
@classmethod

sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_service_fabric_managed_clusters_management_client.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
from copy import deepcopy
1010
from typing import Any, TYPE_CHECKING
11+
from typing_extensions import Self
1112

1213
from azure.core.pipeline import policies
1314
from azure.core.rest import HttpRequest, HttpResponse
@@ -91,8 +92,8 @@ class ServiceFabricManagedClustersManagementClient: # pylint: disable=client-ac
9192
:type subscription_id: str
9293
:param base_url: Service URL. Default value is "https://management.azure.com".
9394
:type base_url: str
94-
:keyword api_version: Api Version. Default value is "2024-04-01". Note that overriding this
95-
default value may result in unsupported behavior.
95+
:keyword api_version: Api Version. Default value is "2024-06-01-preview". Note that overriding
96+
this default value may result in unsupported behavior.
9697
:paramtype api_version: str
9798
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
9899
Retry-After header is present.
@@ -193,7 +194,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
193194
def close(self) -> None:
194195
self._client.close()
195196

196-
def __enter__(self) -> "ServiceFabricManagedClustersManagementClient":
197+
def __enter__(self) -> Self:
197198
self._client.__enter__()
198199
return self
199200

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

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

9-
VERSION = "2.0.0"
9+
VERSION = "2.1.0b1"

sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_configuration.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ class ServiceFabricManagedClustersManagementClientConfiguration: # pylint: disa
2828
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
2929
:param subscription_id: The customer subscription identifier. Required.
3030
:type subscription_id: str
31-
:keyword api_version: Api Version. Default value is "2024-04-01". Note that overriding this
32-
default value may result in unsupported behavior.
31+
:keyword api_version: Api Version. Default value is "2024-06-01-preview". Note that overriding
32+
this default value may result in unsupported behavior.
3333
:paramtype api_version: str
3434
"""
3535

3636
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
37-
api_version: str = kwargs.pop("api_version", "2024-04-01")
37+
api_version: str = kwargs.pop("api_version", "2024-06-01-preview")
3838

3939
if credential is None:
4040
raise ValueError("Parameter 'credential' must not be None.")

sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_service_fabric_managed_clusters_management_client.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
from copy import deepcopy
1010
from typing import Any, Awaitable, TYPE_CHECKING
11+
from typing_extensions import Self
1112

1213
from azure.core.pipeline import policies
1314
from azure.core.rest import AsyncHttpResponse, HttpRequest
@@ -91,8 +92,8 @@ class ServiceFabricManagedClustersManagementClient: # pylint: disable=client-ac
9192
:type subscription_id: str
9293
:param base_url: Service URL. Default value is "https://management.azure.com".
9394
:type base_url: str
94-
:keyword api_version: Api Version. Default value is "2024-04-01". Note that overriding this
95-
default value may result in unsupported behavior.
95+
:keyword api_version: Api Version. Default value is "2024-06-01-preview". Note that overriding
96+
this default value may result in unsupported behavior.
9697
:paramtype api_version: str
9798
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
9899
Retry-After header is present.
@@ -195,7 +196,7 @@ def _send_request(
195196
async def close(self) -> None:
196197
await self._client.close()
197198

198-
async def __aenter__(self) -> "ServiceFabricManagedClustersManagementClient":
199+
async def __aenter__(self) -> Self:
199200
await self._client.__aenter__()
200201
return self
201202

sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_application_type_versions_operations.py

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# --------------------------------------------------------------------------
99
from io import IOBase
1010
import sys
11-
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
11+
from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
1212
import urllib.parse
1313

1414
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -18,20 +18,20 @@
1818
ResourceExistsError,
1919
ResourceNotFoundError,
2020
ResourceNotModifiedError,
21+
StreamClosedError,
22+
StreamConsumedError,
2123
map_error,
2224
)
2325
from azure.core.pipeline import PipelineResponse
24-
from azure.core.pipeline.transport import AsyncHttpResponse
2526
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
26-
from azure.core.rest import HttpRequest
27+
from azure.core.rest import AsyncHttpResponse, HttpRequest
2728
from azure.core.tracing.decorator import distributed_trace
2829
from azure.core.tracing.decorator_async import distributed_trace_async
2930
from azure.core.utils import case_insensitive_dict
3031
from azure.mgmt.core.exceptions import ARMErrorFormat
3132
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
3233

3334
from ... import models as _models
34-
from ..._vendor import _convert_request
3535
from ...operations._application_type_versions_operations import (
3636
build_create_or_update_request,
3737
build_delete_request,
@@ -112,7 +112,6 @@ async def get(
112112
headers=_headers,
113113
params=_params,
114114
)
115-
_request = _convert_request(_request)
116115
_request.url = self._client.format_url(_request.url)
117116

118117
_stream = False
@@ -127,7 +126,7 @@ async def get(
127126
error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response)
128127
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
129128

130-
deserialized = self._deserialize("ApplicationTypeVersionResource", pipeline_response)
129+
deserialized = self._deserialize("ApplicationTypeVersionResource", pipeline_response.http_response)
131130

132131
if cls:
133132
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -142,7 +141,7 @@ async def _create_or_update_initial(
142141
version: str,
143142
parameters: Union[_models.ApplicationTypeVersionResource, IO[bytes]],
144143
**kwargs: Any
145-
) -> _models.ApplicationTypeVersionResource:
144+
) -> AsyncIterator[bytes]:
146145
error_map: MutableMapping[int, Type[HttpResponseError]] = {
147146
401: ClientAuthenticationError,
148147
404: ResourceNotFoundError,
@@ -156,7 +155,7 @@ async def _create_or_update_initial(
156155

157156
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
158157
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
159-
cls: ClsType[_models.ApplicationTypeVersionResource] = kwargs.pop("cls", None)
158+
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
160159

161160
content_type = content_type or "application/json"
162161
_json = None
@@ -179,32 +178,33 @@ async def _create_or_update_initial(
179178
headers=_headers,
180179
params=_params,
181180
)
182-
_request = _convert_request(_request)
183181
_request.url = self._client.format_url(_request.url)
184182

185-
_stream = False
183+
_decompress = kwargs.pop("decompress", True)
184+
_stream = True
186185
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
187186
_request, stream=_stream, **kwargs
188187
)
189188

190189
response = pipeline_response.http_response
191190

192191
if response.status_code not in [200, 202]:
192+
try:
193+
await response.read() # Load the body in memory and close the socket
194+
except (StreamConsumedError, StreamClosedError):
195+
pass
193196
map_error(status_code=response.status_code, response=response, error_map=error_map)
194197
error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response)
195198
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
196199

197200
response_headers = {}
198-
if response.status_code == 200:
199-
deserialized = self._deserialize("ApplicationTypeVersionResource", pipeline_response)
200-
201201
if response.status_code == 202:
202202
response_headers["Azure-AsyncOperation"] = self._deserialize(
203203
"str", response.headers.get("Azure-AsyncOperation")
204204
)
205205
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
206206

207-
deserialized = self._deserialize("ApplicationTypeVersionResource", pipeline_response)
207+
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
208208

209209
if cls:
210210
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -342,10 +342,11 @@ async def begin_create_or_update(
342342
params=_params,
343343
**kwargs
344344
)
345+
await raw_result.http_response.read() # type: ignore
345346
kwargs.pop("error_map", None)
346347

347348
def get_long_running_output(pipeline_response):
348-
deserialized = self._deserialize("ApplicationTypeVersionResource", pipeline_response)
349+
deserialized = self._deserialize("ApplicationTypeVersionResource", pipeline_response.http_response)
349350
if cls:
350351
return cls(pipeline_response, deserialized, {}) # type: ignore
351352
return deserialized
@@ -505,7 +506,6 @@ async def update(
505506
headers=_headers,
506507
params=_params,
507508
)
508-
_request = _convert_request(_request)
509509
_request.url = self._client.format_url(_request.url)
510510

511511
_stream = False
@@ -520,16 +520,16 @@ async def update(
520520
error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response)
521521
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
522522

523-
deserialized = self._deserialize("ApplicationTypeVersionResource", pipeline_response)
523+
deserialized = self._deserialize("ApplicationTypeVersionResource", pipeline_response.http_response)
524524

525525
if cls:
526526
return cls(pipeline_response, deserialized, {}) # type: ignore
527527

528528
return deserialized # type: ignore
529529

530-
async def _delete_initial( # pylint: disable=inconsistent-return-statements
530+
async def _delete_initial(
531531
self, resource_group_name: str, cluster_name: str, application_type_name: str, version: str, **kwargs: Any
532-
) -> None:
532+
) -> AsyncIterator[bytes]:
533533
error_map: MutableMapping[int, Type[HttpResponseError]] = {
534534
401: ClientAuthenticationError,
535535
404: ResourceNotFoundError,
@@ -542,7 +542,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
542542
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
543543

544544
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
545-
cls: ClsType[None] = kwargs.pop("cls", None)
545+
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
546546

547547
_request = build_delete_request(
548548
resource_group_name=resource_group_name,
@@ -554,17 +554,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
554554
headers=_headers,
555555
params=_params,
556556
)
557-
_request = _convert_request(_request)
558557
_request.url = self._client.format_url(_request.url)
559558

560-
_stream = False
559+
_decompress = kwargs.pop("decompress", True)
560+
_stream = True
561561
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
562562
_request, stream=_stream, **kwargs
563563
)
564564

565565
response = pipeline_response.http_response
566566

567567
if response.status_code not in [200, 202, 204]:
568+
try:
569+
await response.read() # Load the body in memory and close the socket
570+
except (StreamConsumedError, StreamClosedError):
571+
pass
568572
map_error(status_code=response.status_code, response=response, error_map=error_map)
569573
error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response)
570574
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
@@ -576,8 +580,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
576580
)
577581
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
578582

583+
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
584+
579585
if cls:
580-
return cls(pipeline_response, None, response_headers) # type: ignore
586+
return cls(pipeline_response, deserialized, response_headers) # type: ignore
587+
588+
return deserialized # type: ignore
581589

582590
@distributed_trace_async
583591
async def begin_delete(
@@ -608,7 +616,7 @@ async def begin_delete(
608616
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
609617
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
610618
if cont_token is None:
611-
raw_result = await self._delete_initial( # type: ignore
619+
raw_result = await self._delete_initial(
612620
resource_group_name=resource_group_name,
613621
cluster_name=cluster_name,
614622
application_type_name=application_type_name,
@@ -619,6 +627,7 @@ async def begin_delete(
619627
params=_params,
620628
**kwargs
621629
)
630+
await raw_result.http_response.read() # type: ignore
622631
kwargs.pop("error_map", None)
623632

624633
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -690,7 +699,6 @@ def prepare_request(next_link=None):
690699
headers=_headers,
691700
params=_params,
692701
)
693-
_request = _convert_request(_request)
694702
_request.url = self._client.format_url(_request.url)
695703

696704
else:
@@ -706,7 +714,6 @@ def prepare_request(next_link=None):
706714
_request = HttpRequest(
707715
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
708716
)
709-
_request = _convert_request(_request)
710717
_request.url = self._client.format_url(_request.url)
711718
_request.method = "GET"
712719
return _request

0 commit comments

Comments
 (0)