diff --git a/sdk/resourceconnector/azure-mgmt-resourceconnector/_meta.json b/sdk/resourceconnector/azure-mgmt-resourceconnector/_meta.json index 9f55be9684cc..b4e325b9f64d 100644 --- a/sdk/resourceconnector/azure-mgmt-resourceconnector/_meta.json +++ b/sdk/resourceconnector/azure-mgmt-resourceconnector/_meta.json @@ -1,11 +1,11 @@ { - "commit": "0de386a47454f277f89563c616992d6defa0bf98", + "commit": "6e179e1f5e57af6a0a8c293404964fef88b6705c", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.4.7", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/resourceconnector/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.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/resourceconnector/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/resourceconnector/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/resourceconnector/azure-mgmt-resourceconnector/azure/mgmt/resourceconnector/_serialization.py b/sdk/resourceconnector/azure-mgmt-resourceconnector/azure/mgmt/resourceconnector/_serialization.py index 842ae727fbbc..4bae2292227b 100644 --- a/sdk/resourceconnector/azure-mgmt-resourceconnector/azure/mgmt/resourceconnector/_serialization.py +++ b/sdk/resourceconnector/azure-mgmt-resourceconnector/azure/mgmt/resourceconnector/_serialization.py @@ -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)) @@ -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 @@ -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) @@ -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): @@ -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) @@ -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: diff --git a/sdk/resourceconnector/azure-mgmt-resourceconnector/azure/mgmt/resourceconnector/_vendor.py b/sdk/resourceconnector/azure-mgmt-resourceconnector/azure/mgmt/resourceconnector/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/resourceconnector/azure-mgmt-resourceconnector/azure/mgmt/resourceconnector/_vendor.py +++ b/sdk/resourceconnector/azure-mgmt-resourceconnector/azure/mgmt/resourceconnector/_vendor.py @@ -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 @@ -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) diff --git a/sdk/resourceconnector/azure-mgmt-resourceconnector/azure/mgmt/resourceconnector/_version.py b/sdk/resourceconnector/azure-mgmt-resourceconnector/azure/mgmt/resourceconnector/_version.py index 8d50297ac8eb..e5754a47ce68 100644 --- a/sdk/resourceconnector/azure-mgmt-resourceconnector/azure/mgmt/resourceconnector/_version.py +++ b/sdk/resourceconnector/azure-mgmt-resourceconnector/azure/mgmt/resourceconnector/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b4" +VERSION = "1.0.0b1" diff --git a/sdk/resourceconnector/azure-mgmt-resourceconnector/azure/mgmt/resourceconnector/aio/operations/_appliances_operations.py b/sdk/resourceconnector/azure-mgmt-resourceconnector/azure/mgmt/resourceconnector/aio/operations/_appliances_operations.py index e4c6dc15b3fe..99b017339467 100644 --- a/sdk/resourceconnector/azure-mgmt-resourceconnector/azure/mgmt/resourceconnector/aio/operations/_appliances_operations.py +++ b/sdk/resourceconnector/azure-mgmt-resourceconnector/azure/mgmt/resourceconnector/aio/operations/_appliances_operations.py @@ -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 @@ -468,7 +469,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, "Appliance") @@ -936,7 +937,7 @@ async def list_cluster_user_credential( @distributed_trace_async async def list_keys( - self, resource_group_name: str, resource_name: str, **kwargs: Any + self, resource_group_name: str, resource_name: str, artifact_type: Optional[str] = None, **kwargs: Any ) -> _models.ApplianceListKeysResults: """Gets the management config. @@ -947,6 +948,9 @@ async def list_keys( :type resource_group_name: str :param resource_name: Appliances name. Required. :type resource_name: str + :param artifact_type: This sets the type of artifact being returned, when empty no artifact + endpoint is returned. Default value is None. + :type artifact_type: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplianceListKeysResults or the result of cls(response) :rtype: ~azure.mgmt.resourceconnector.models.ApplianceListKeysResults @@ -970,6 +974,7 @@ async def list_keys( resource_group_name=resource_group_name, resource_name=resource_name, subscription_id=self._config.subscription_id, + artifact_type=artifact_type, api_version=api_version, template_url=self.list_keys.metadata["url"], headers=_headers, diff --git a/sdk/resourceconnector/azure-mgmt-resourceconnector/azure/mgmt/resourceconnector/models/_models_py3.py b/sdk/resourceconnector/azure-mgmt-resourceconnector/azure/mgmt/resourceconnector/models/_models_py3.py index 82f00321a32c..37f2de840208 100644 --- a/sdk/resourceconnector/azure-mgmt-resourceconnector/azure/mgmt/resourceconnector/models/_models_py3.py +++ b/sdk/resourceconnector/azure-mgmt-resourceconnector/azure/mgmt/resourceconnector/models/_models_py3.py @@ -149,10 +149,12 @@ class Appliance(TrackedResource): # pylint: disable=too-many-instance-attribute :vartype public_key: str :ivar status: Appliance’s health and state of connection to on-prem. Known values are: "WaitingForHeartbeat", "Validating", "Connecting", "Connected", "Running", - "PreparingForUpgrade", "UpgradePrerequisitesCompleted", "PreUpgrade", "UpgradingKVAIO", - "WaitingForKVAIO", "ImagePending", "ImageProvisioning", "ImageProvisioned", "ImageDownloading", - "ImageDownloaded", "ImageDeprovisioning", "ImageUnknown", "UpdatingCloudOperator", - "WaitingForCloudOperator", "UpdatingCAPI", "UpdatingCluster", "PostUpgrade", "UpgradeComplete", + "PreparingForUpgrade", "ETCDSnapshotFailed", "UpgradePrerequisitesCompleted", + "ValidatingSFSConnectivity", "ValidatingImageDownload", "ValidatingImageUpload", + "ValidatingETCDHealth", "PreUpgrade", "UpgradingKVAIO", "WaitingForKVAIO", "ImagePending", + "ImageProvisioning", "ImageProvisioned", "ImageDownloading", "ImageDownloaded", + "ImageDeprovisioning", "ImageUnknown", "UpdatingCloudOperator", "WaitingForCloudOperator", + "UpdatingCAPI", "UpdatingCluster", "PostUpgrade", "UpgradeComplete", "UpgradeClusterExtensionFailedToDelete", "UpgradeFailed", "Offline", and "None". :vartype status: str or ~azure.mgmt.resourceconnector.models.Status :ivar version: Version of the Appliance. @@ -462,7 +464,7 @@ class AppliancePropertiesInfrastructureConfig(_serialization.Model): """Contains infrastructure information about the Appliance. :ivar provider: Information about the connected appliance. Known values are: "VMWare", "HCI", - "SCVMM", "KubeVirt", and "OpenStack". + and "SCVMM". :vartype provider: str or ~azure.mgmt.resourceconnector.models.Provider """ @@ -473,7 +475,7 @@ class AppliancePropertiesInfrastructureConfig(_serialization.Model): def __init__(self, *, provider: Optional[Union[str, "_models.Provider"]] = None, **kwargs: Any) -> None: """ :keyword provider: Information about the connected appliance. Known values are: "VMWare", - "HCI", "SCVMM", "KubeVirt", and "OpenStack". + "HCI", and "SCVMM". :paramtype provider: str or ~azure.mgmt.resourceconnector.models.Provider """ super().__init__(**kwargs) diff --git a/sdk/resourceconnector/azure-mgmt-resourceconnector/azure/mgmt/resourceconnector/models/_resource_connector_mgmt_client_enums.py b/sdk/resourceconnector/azure-mgmt-resourceconnector/azure/mgmt/resourceconnector/models/_resource_connector_mgmt_client_enums.py index e0eb787908a3..ac6607d5ec1b 100644 --- a/sdk/resourceconnector/azure-mgmt-resourceconnector/azure/mgmt/resourceconnector/models/_resource_connector_mgmt_client_enums.py +++ b/sdk/resourceconnector/azure-mgmt-resourceconnector/azure/mgmt/resourceconnector/models/_resource_connector_mgmt_client_enums.py @@ -44,8 +44,6 @@ class Provider(str, Enum, metaclass=CaseInsensitiveEnumMeta): VM_WARE = "VMWare" HCI = "HCI" SCVMM = "SCVMM" - KUBE_VIRT = "KubeVirt" - OPEN_STACK = "OpenStack" class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -73,7 +71,12 @@ class Status(str, Enum, metaclass=CaseInsensitiveEnumMeta): CONNECTED = "Connected" RUNNING = "Running" PREPARING_FOR_UPGRADE = "PreparingForUpgrade" + ETCD_SNAPSHOT_FAILED = "ETCDSnapshotFailed" UPGRADE_PREREQUISITES_COMPLETED = "UpgradePrerequisitesCompleted" + VALIDATING_SFS_CONNECTIVITY = "ValidatingSFSConnectivity" + VALIDATING_IMAGE_DOWNLOAD = "ValidatingImageDownload" + VALIDATING_IMAGE_UPLOAD = "ValidatingImageUpload" + VALIDATING_ETCD_HEALTH = "ValidatingETCDHealth" PRE_UPGRADE = "PreUpgrade" UPGRADING_KVAIO = "UpgradingKVAIO" WAITING_FOR_KVAIO = "WaitingForKVAIO" diff --git a/sdk/resourceconnector/azure-mgmt-resourceconnector/azure/mgmt/resourceconnector/operations/_appliances_operations.py b/sdk/resourceconnector/azure-mgmt-resourceconnector/azure/mgmt/resourceconnector/operations/_appliances_operations.py index fcd9dd2adfe0..272c6f26599a 100644 --- a/sdk/resourceconnector/azure-mgmt-resourceconnector/azure/mgmt/resourceconnector/operations/_appliances_operations.py +++ b/sdk/resourceconnector/azure-mgmt-resourceconnector/azure/mgmt/resourceconnector/operations/_appliances_operations.py @@ -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, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +73,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -98,7 +99,7 @@ def build_get_telemetry_config_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -128,7 +129,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -166,7 +167,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -207,7 +208,7 @@ def build_create_or_update_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -249,7 +250,7 @@ def build_delete_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -290,7 +291,7 @@ def build_update_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -332,7 +333,7 @@ def build_list_cluster_user_credential_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -344,7 +345,12 @@ def build_list_cluster_user_credential_request( def build_list_keys_request( - resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, + resource_name: str, + subscription_id: str, + *, + artifact_type: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -372,10 +378,12 @@ def build_list_keys_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if artifact_type is not None: + _params["artifactType"] = _SERIALIZER.query("artifact_type", artifact_type, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -413,7 +421,7 @@ def build_get_upgrade_graph_request( "upgradeGraph": _SERIALIZER.url("upgrade_graph", upgrade_graph, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -843,7 +851,7 @@ 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, "Appliance") @@ -1306,7 +1314,7 @@ def list_cluster_user_credential( @distributed_trace def list_keys( - self, resource_group_name: str, resource_name: str, **kwargs: Any + self, resource_group_name: str, resource_name: str, artifact_type: Optional[str] = None, **kwargs: Any ) -> _models.ApplianceListKeysResults: """Gets the management config. @@ -1317,6 +1325,9 @@ def list_keys( :type resource_group_name: str :param resource_name: Appliances name. Required. :type resource_name: str + :param artifact_type: This sets the type of artifact being returned, when empty no artifact + endpoint is returned. Default value is None. + :type artifact_type: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplianceListKeysResults or the result of cls(response) :rtype: ~azure.mgmt.resourceconnector.models.ApplianceListKeysResults @@ -1340,6 +1351,7 @@ def list_keys( resource_group_name=resource_group_name, resource_name=resource_name, subscription_id=self._config.subscription_id, + artifact_type=artifact_type, api_version=api_version, template_url=self.list_keys.metadata["url"], headers=_headers, diff --git a/sdk/resourceconnector/azure-mgmt-resourceconnector/generated_samples/appliances_delete.py b/sdk/resourceconnector/azure-mgmt-resourceconnector/generated_samples/appliances_delete.py index 2fd4a0b35d22..5432904c5807 100644 --- a/sdk/resourceconnector/azure-mgmt-resourceconnector/generated_samples/appliances_delete.py +++ b/sdk/resourceconnector/azure-mgmt-resourceconnector/generated_samples/appliances_delete.py @@ -29,11 +29,10 @@ def main(): subscription_id="11111111-2222-3333-4444-555555555555", ) - response = client.appliances.begin_delete( + client.appliances.begin_delete( resource_group_name="testresourcegroup", resource_name="appliance01", ).result() - print(response) # x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesDelete.json