Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"commit": "e7e775e2f3fe00f25fbd0e7ca0d953e22eef93ff",
"commit": "7ad7c5251b53e9d5c476060b7d777055a1703f61",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.2",
"autorest": "3.9.7",
"use": [
"@autorest/python@6.4.8",
"@autorest/modelerfour@4.24.3"
"@autorest/python@6.7.1",
"@autorest/modelerfour@4.26.2"
],
"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.4.8 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
"autorest_command": "autorest specification/servicefabricmanagedclusters/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/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False",
"readme": "specification/servicefabricmanagedclusters/resource-manager/readme.md"
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ class ServiceFabricManagedClustersManagementClientConfiguration(
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The customer subscription identifier. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2023-02-01-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2023-11-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:
super(ServiceFabricManagedClustersManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2023-02-01-preview")
api_version: str = kwargs.pop("api_version", "2023-11-01-preview")

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -662,8 +662,9 @@ def _serialize(self, target_obj, data_type=None, **kwargs):
_serialized.update(_new_attr) # type: ignore
_new_attr = _new_attr[k] # type: ignore
_serialized = _serialized[k]
except ValueError:
continue
except ValueError as err:
if isinstance(err, SerializationError):
raise

except (AttributeError, KeyError, TypeError) as err:
msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj))
Expand Down Expand Up @@ -741,6 +742,8 @@ def query(self, name, data, data_type, **kwargs):

:param data: The data to be serialized.
:param str data_type: The type to be serialized from.
:keyword bool skip_quote: Whether to skip quote the serialized result.
Defaults to False.
:rtype: str
:raises: TypeError if serialization fails.
:raises: ValueError if data is None
Expand All @@ -749,10 +752,8 @@ def query(self, name, data, data_type, **kwargs):
# Treat the list aside, since we don't want to encode the div separator
if data_type.startswith("["):
internal_data_type = data_type[1:-1]
data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data]
if not kwargs.get("skip_quote", False):
data = [quote(str(d), safe="") for d in data]
return str(self.serialize_iter(data, internal_data_type, **kwargs))
do_quote = not kwargs.get("skip_quote", False)
return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs))

# Not a list, regular serialization
output = self.serialize_data(data, data_type, **kwargs)
Expand Down Expand Up @@ -891,6 +892,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs):
not be None or empty.
:param str div: If set, this str will be used to combine the elements
in the iterable into a combined string. Default is 'None'.
:keyword bool do_quote: Whether to quote the serialized result of each iterable element.
Defaults to False.
:rtype: list, str
"""
if isinstance(data, str):
Expand All @@ -903,9 +906,14 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs):
for d in data:
try:
serialized.append(self.serialize_data(d, iter_type, **kwargs))
except ValueError:
except ValueError as err:
if isinstance(err, SerializationError):
raise
serialized.append(None)

if kwargs.get("do_quote", False):
serialized = ["" if s is None else quote(str(s), safe="") for s in serialized]

if div:
serialized = ["" if s is None else str(s) for s in serialized]
serialized = div.join(serialized)
Expand Down Expand Up @@ -950,7 +958,9 @@ def serialize_dict(self, attr, dict_type, **kwargs):
for key, value in attr.items():
try:
serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs)
except ValueError:
except ValueError as err:
if isinstance(err, SerializationError):
raise
serialized[self.serialize_unicode(key)] = None

if "xml" in serialization_ctxt:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@
ApplicationTypeVersionsOperations,
ApplicationTypesOperations,
ApplicationsOperations,
ManagedApplyMaintenanceWindowOperations,
ManagedAzResiliencyStatusOperations,
ManagedClusterVersionOperations,
ManagedClustersOperations,
ManagedMaintenanceWindowStatusOperations,
ManagedUnsupportedVMSizesOperations,
NodeTypeSkusOperations,
NodeTypesOperations,
Expand All @@ -36,7 +38,7 @@
from azure.core.credentials import TokenCredential


class ServiceFabricManagedClustersManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes,name-too-long
class ServiceFabricManagedClustersManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
"""Service Fabric Managed Clusters Management Client.

:ivar application_types: ApplicationTypesOperations operations
Expand All @@ -56,6 +58,12 @@ class ServiceFabricManagedClustersManagementClient: # pylint: disable=client-ac
:ivar managed_az_resiliency_status: ManagedAzResiliencyStatusOperations operations
:vartype managed_az_resiliency_status:
azure.mgmt.servicefabricmanagedclusters.operations.ManagedAzResiliencyStatusOperations
:ivar managed_maintenance_window_status: ManagedMaintenanceWindowStatusOperations operations
:vartype managed_maintenance_window_status:
azure.mgmt.servicefabricmanagedclusters.operations.ManagedMaintenanceWindowStatusOperations
:ivar managed_apply_maintenance_window: ManagedApplyMaintenanceWindowOperations operations
:vartype managed_apply_maintenance_window:
azure.mgmt.servicefabricmanagedclusters.operations.ManagedApplyMaintenanceWindowOperations
:ivar managed_cluster_version: ManagedClusterVersionOperations operations
:vartype managed_cluster_version:
azure.mgmt.servicefabricmanagedclusters.operations.ManagedClusterVersionOperations
Expand All @@ -81,7 +89,7 @@ class ServiceFabricManagedClustersManagementClient: # pylint: disable=client-ac
: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 "2023-02-01-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2023-11-01-preview". 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
Expand Down Expand Up @@ -118,6 +126,12 @@ def __init__(
self.managed_az_resiliency_status = ManagedAzResiliencyStatusOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.managed_maintenance_window_status = ManagedMaintenanceWindowStatusOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.managed_apply_maintenance_window = ManagedApplyMaintenanceWindowOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.managed_cluster_version = ManagedClusterVersionOperations(
self._client, self._config, self._serialize, self._deserialize
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import List, cast

from azure.core.pipeline.transport import HttpRequest


Expand All @@ -16,15 +14,3 @@ def _convert_request(request, files=None):
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:
# Need the cast, as for some reasons "split" is typed as list[str | Any]
formatted_components = cast(List[str], template.split("/"))
components = [c for c in formatted_components if "{}".format(key.args[0]) not in c]
template = "/".join(components)
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

VERSION = "2.0.0b4"
VERSION = "0.1.0"
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ class ServiceFabricManagedClustersManagementClientConfiguration(
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: The customer subscription identifier. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2023-02-01-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2023-11-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:
super(ServiceFabricManagedClustersManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2023-02-01-preview")
api_version: str = kwargs.pop("api_version", "2023-11-01-preview")

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@
ApplicationTypeVersionsOperations,
ApplicationTypesOperations,
ApplicationsOperations,
ManagedApplyMaintenanceWindowOperations,
ManagedAzResiliencyStatusOperations,
ManagedClusterVersionOperations,
ManagedClustersOperations,
ManagedMaintenanceWindowStatusOperations,
ManagedUnsupportedVMSizesOperations,
NodeTypeSkusOperations,
NodeTypesOperations,
Expand All @@ -36,7 +38,7 @@
from azure.core.credentials_async import AsyncTokenCredential


class ServiceFabricManagedClustersManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes,name-too-long
class ServiceFabricManagedClustersManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
"""Service Fabric Managed Clusters Management Client.

:ivar application_types: ApplicationTypesOperations operations
Expand All @@ -56,6 +58,12 @@ class ServiceFabricManagedClustersManagementClient: # pylint: disable=client-ac
:ivar managed_az_resiliency_status: ManagedAzResiliencyStatusOperations operations
:vartype managed_az_resiliency_status:
azure.mgmt.servicefabricmanagedclusters.aio.operations.ManagedAzResiliencyStatusOperations
:ivar managed_maintenance_window_status: ManagedMaintenanceWindowStatusOperations operations
:vartype managed_maintenance_window_status:
azure.mgmt.servicefabricmanagedclusters.aio.operations.ManagedMaintenanceWindowStatusOperations
:ivar managed_apply_maintenance_window: ManagedApplyMaintenanceWindowOperations operations
:vartype managed_apply_maintenance_window:
azure.mgmt.servicefabricmanagedclusters.aio.operations.ManagedApplyMaintenanceWindowOperations
:ivar managed_cluster_version: ManagedClusterVersionOperations operations
:vartype managed_cluster_version:
azure.mgmt.servicefabricmanagedclusters.aio.operations.ManagedClusterVersionOperations
Expand All @@ -81,7 +89,7 @@ class ServiceFabricManagedClustersManagementClient: # pylint: disable=client-ac
: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 "2023-02-01-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2023-11-01-preview". 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
Expand Down Expand Up @@ -118,6 +126,12 @@ def __init__(
self.managed_az_resiliency_status = ManagedAzResiliencyStatusOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.managed_maintenance_window_status = ManagedMaintenanceWindowStatusOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.managed_apply_maintenance_window = ManagedApplyMaintenanceWindowOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.managed_cluster_version = ManagedClusterVersionOperations(
self._client, self._config, self._serialize, self._deserialize
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
from ._services_operations import ServicesOperations
from ._managed_clusters_operations import ManagedClustersOperations
from ._managed_az_resiliency_status_operations import ManagedAzResiliencyStatusOperations
from ._managed_maintenance_window_status_operations import ManagedMaintenanceWindowStatusOperations
from ._managed_apply_maintenance_window_operations import ManagedApplyMaintenanceWindowOperations
from ._managed_cluster_version_operations import ManagedClusterVersionOperations
from ._managed_unsupported_vm_sizes_operations import ManagedUnsupportedVMSizesOperations
from ._operation_status_operations import OperationStatusOperations
Expand All @@ -31,6 +33,8 @@
"ServicesOperations",
"ManagedClustersOperations",
"ManagedAzResiliencyStatusOperations",
"ManagedMaintenanceWindowStatusOperations",
"ManagedApplyMaintenanceWindowOperations",
"ManagedClusterVersionOperations",
"ManagedUnsupportedVMSizesOperations",
"OperationStatusOperations",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse

Expand Down Expand Up @@ -161,7 +162,7 @@ async def _create_or_update_initial(
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(parameters, (IO, bytes)):
if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ApplicationTypeVersionResource")
Expand Down Expand Up @@ -195,14 +196,20 @@ async def _create_or_update_initial(
error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

response_headers = {}
if response.status_code == 200:
deserialized = self._deserialize("ApplicationTypeVersionResource", pipeline_response)

if response.status_code == 202:
response_headers["Azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("Azure-AsyncOperation")
)
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))

deserialized = self._deserialize("ApplicationTypeVersionResource", pipeline_response)

if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return cls(pipeline_response, deserialized, response_headers) # type: ignore

return deserialized # type: ignore

Expand Down Expand Up @@ -520,7 +527,7 @@ async def update(
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(parameters, (IO, bytes)):
if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ApplicationTypeVersionUpdateParameters")
Expand Down Expand Up @@ -608,8 +615,15 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

response_headers = {}
if response.status_code == 202:
response_headers["Azure-AsyncOperation"] = self._deserialize(
"str", response.headers.get("Azure-AsyncOperation")
)
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))

if cls:
return cls(pipeline_response, None, {})
return cls(pipeline_response, None, response_headers)

_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse

Expand Down Expand Up @@ -246,7 +247,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(parameters, (IO, bytes)):
if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ApplicationTypeResource")
Expand Down Expand Up @@ -404,7 +405,7 @@ async def update(
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(parameters, (IO, bytes)):
if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ApplicationTypeUpdateParameters")
Expand Down
Loading