diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/_meta.json b/sdk/connectedvmware/azure-mgmt-connectedvmware/_meta.json index 8639cba6d569..8688864bbe05 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/_meta.json +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/_meta.json @@ -1,11 +1,11 @@ { - "commit": "e37a57df67daaa82f9c3758fc450bc8655812a08", + "commit": "a27e87b791b8d4a9a836a679e66b679eaf2f74e0", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.2.7", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/connectedvmware/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.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/connectedvmware/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/connectedvmware/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_azure_arc_vmware_management_service_api.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_azure_arc_vmware_management_service_api.py index 6e46c53e59e8..4bd6b28f3ddb 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_azure_arc_vmware_management_service_api.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_azure_arc_vmware_management_service_api.py @@ -27,9 +27,12 @@ Operations, ResourcePoolsOperations, VCentersOperations, + VMInstanceGuestAgentsOperations, + VirtualMachineInstancesOperations, VirtualMachineTemplatesOperations, VirtualMachinesOperations, VirtualNetworksOperations, + VmInstanceHybridIdentityMetadataOperations, ) if TYPE_CHECKING: @@ -70,13 +73,23 @@ class AzureArcVMwareManagementServiceAPI( :vartype machine_extensions: azure.mgmt.connectedvmware.operations.MachineExtensionsOperations :ivar guest_agents: GuestAgentsOperations operations :vartype guest_agents: azure.mgmt.connectedvmware.operations.GuestAgentsOperations + :ivar virtual_machine_instances: VirtualMachineInstancesOperations operations + :vartype virtual_machine_instances: + azure.mgmt.connectedvmware.operations.VirtualMachineInstancesOperations + :ivar vm_instance_hybrid_identity_metadata: VmInstanceHybridIdentityMetadataOperations + operations + :vartype vm_instance_hybrid_identity_metadata: + azure.mgmt.connectedvmware.operations.VmInstanceHybridIdentityMetadataOperations + :ivar vm_instance_guest_agents: VMInstanceGuestAgentsOperations operations + :vartype vm_instance_guest_agents: + azure.mgmt.connectedvmware.operations.VMInstanceGuestAgentsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The Subscription ID. Required. :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 "2022-07-15-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-03-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 @@ -93,7 +106,7 @@ def __init__( self._config = AzureArcVMwareManagementServiceAPIConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -122,6 +135,15 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.guest_agents = GuestAgentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_instances = VirtualMachineInstancesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.vm_instance_hybrid_identity_metadata = VmInstanceHybridIdentityMetadataOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.vm_instance_guest_agents = VMInstanceGuestAgentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. @@ -152,5 +174,5 @@ def __enter__(self) -> "AzureArcVMwareManagementServiceAPI": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_configuration.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_configuration.py index 843bd0cc1522..9959a626c43b 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_configuration.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -35,14 +29,14 @@ class AzureArcVMwareManagementServiceAPIConfiguration(Configuration): # pylint: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The Subscription ID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-07-15-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-03-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(AzureArcVMwareManagementServiceAPIConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-07-15-preview"] = kwargs.pop("api_version", "2022-07-15-preview") + api_version: str = kwargs.pop("api_version", "2023-03-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_serialization.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_serialization.py index 2c170e28dbca..4bae2292227b 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_serialization.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -277,8 +294,8 @@ class Model(object): _attribute_map: Dict[str, Dict[str, Any]] = {} _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -287,25 +304,25 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -322,7 +339,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -336,8 +353,13 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -384,7 +406,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -396,7 +418,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -409,8 +436,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -518,7 +545,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,7 +561,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -602,7 +629,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): @@ -626,8 +653,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -636,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)) @@ -656,8 +683,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -715,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 @@ -723,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) @@ -777,6 +804,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -863,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): @@ -875,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) @@ -922,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: @@ -1161,7 +1199,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1242,7 +1281,7 @@ def _extract_name_from_internal_type(internal_type): xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1266,7 +1305,7 @@ def xml_key_extractor(attr, attr_desc, data): # Integrate namespace if necessary xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): @@ -1332,7 +1371,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1391,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1471,7 +1510,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1486,7 +1525,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,7 +1535,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_vendor.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_vendor.py index 710e41c10fa4..5e13c66aeed3 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_vendor.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_vendor.py @@ -27,17 +27,6 @@ def _convert_request(request, files=None): return request -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) - - class AzureArcVMwareManagementServiceAPIMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_version.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_version.py index 20971492f129..e5754a47ce68 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_version.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b3" +VERSION = "1.0.0b1" diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/_azure_arc_vmware_management_service_api.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/_azure_arc_vmware_management_service_api.py index 26fae8bb9131..4b0afa6c4cd2 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/_azure_arc_vmware_management_service_api.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/_azure_arc_vmware_management_service_api.py @@ -27,9 +27,12 @@ Operations, ResourcePoolsOperations, VCentersOperations, + VMInstanceGuestAgentsOperations, + VirtualMachineInstancesOperations, VirtualMachineTemplatesOperations, VirtualMachinesOperations, VirtualNetworksOperations, + VmInstanceHybridIdentityMetadataOperations, ) if TYPE_CHECKING: @@ -71,13 +74,23 @@ class AzureArcVMwareManagementServiceAPI( azure.mgmt.connectedvmware.aio.operations.MachineExtensionsOperations :ivar guest_agents: GuestAgentsOperations operations :vartype guest_agents: azure.mgmt.connectedvmware.aio.operations.GuestAgentsOperations + :ivar virtual_machine_instances: VirtualMachineInstancesOperations operations + :vartype virtual_machine_instances: + azure.mgmt.connectedvmware.aio.operations.VirtualMachineInstancesOperations + :ivar vm_instance_hybrid_identity_metadata: VmInstanceHybridIdentityMetadataOperations + operations + :vartype vm_instance_hybrid_identity_metadata: + azure.mgmt.connectedvmware.aio.operations.VmInstanceHybridIdentityMetadataOperations + :ivar vm_instance_guest_agents: VMInstanceGuestAgentsOperations operations + :vartype vm_instance_guest_agents: + azure.mgmt.connectedvmware.aio.operations.VMInstanceGuestAgentsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The Subscription ID. Required. :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 "2022-07-15-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-03-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 @@ -94,7 +107,7 @@ def __init__( self._config = AzureArcVMwareManagementServiceAPIConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -123,6 +136,15 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.guest_agents = GuestAgentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_instances = VirtualMachineInstancesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.vm_instance_hybrid_identity_metadata = VmInstanceHybridIdentityMetadataOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.vm_instance_guest_agents = VMInstanceGuestAgentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. @@ -153,5 +175,5 @@ async def __aenter__(self) -> "AzureArcVMwareManagementServiceAPI": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/_configuration.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/_configuration.py index d02373590f91..07f302c2f6ee 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/_configuration.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -35,14 +29,14 @@ class AzureArcVMwareManagementServiceAPIConfiguration(Configuration): # pylint: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The Subscription ID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-07-15-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-03-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(AzureArcVMwareManagementServiceAPIConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-07-15-preview"] = kwargs.pop("api_version", "2022-07-15-preview") + api_version: str = kwargs.pop("api_version", "2023-03-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/__init__.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/__init__.py index 5cf879bbc55c..821d45478cd6 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/__init__.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/__init__.py @@ -20,6 +20,9 @@ from ._machine_extensions_operations import MachineExtensionsOperations from ._azure_arc_vmware_management_service_api_operations import AzureArcVMwareManagementServiceAPIOperationsMixin from ._guest_agents_operations import GuestAgentsOperations +from ._virtual_machine_instances_operations import VirtualMachineInstancesOperations +from ._vm_instance_hybrid_identity_metadata_operations import VmInstanceHybridIdentityMetadataOperations +from ._vm_instance_guest_agents_operations import VMInstanceGuestAgentsOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -40,6 +43,9 @@ "MachineExtensionsOperations", "AzureArcVMwareManagementServiceAPIOperationsMixin", "GuestAgentsOperations", + "VirtualMachineInstancesOperations", + "VmInstanceHybridIdentityMetadataOperations", + "VMInstanceGuestAgentsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_azure_arc_vmware_management_service_api_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_azure_arc_vmware_management_service_api_operations.py index bf729bf31060..bf0ec57a3596 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_azure_arc_vmware_management_service_api_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_azure_arc_vmware_management_service_api_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -31,10 +31,6 @@ from ...operations._azure_arc_vmware_management_service_api_operations import build_upgrade_extensions_request from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,16 +54,14 @@ async def _upgrade_extensions_initial( # pylint: disable=inconsistent-return-st _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(extension_upgrade_parameters, (IO, bytes)): + if isinstance(extension_upgrade_parameters, (IOBase, bytes)): _content = extension_upgrade_parameters else: _json = self._serialize.body(extension_upgrade_parameters, "MachineExtensionUpgrade") @@ -87,8 +81,9 @@ async def _upgrade_extensions_initial( # pylint: disable=inconsistent-return-st request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -98,8 +93,12 @@ async def _upgrade_extensions_initial( # pylint: disable=inconsistent-return-st error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _upgrade_extensions_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/upgradeExtensions" @@ -190,7 +189,7 @@ async def begin_upgrade_extensions( :param virtual_machine_name: The name of the machine containing the extension. Required. :type virtual_machine_name: str :param extension_upgrade_parameters: Parameters supplied to the Upgrade Extensions operation. - Is either a model type or a IO type. Required. + Is either a MachineExtensionUpgrade type or a IO type. Required. :type extension_upgrade_parameters: ~azure.mgmt.connectedvmware.models.MachineExtensionUpgrade or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -211,9 +210,7 @@ async def begin_upgrade_extensions( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_clusters_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_clusters_operations.py index a1e618a80fd2..89c1d927fdd6 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_clusters_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_clusters_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -41,10 +41,6 @@ ) from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,16 +82,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Cluster] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -118,8 +112,9 @@ async def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -234,7 +229,7 @@ async def begin_create( :type resource_group_name: str :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a Cluster type or a IO type. Default value is None. :type body: ~azure.mgmt.connectedvmware.models.Cluster or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -255,9 +250,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Cluster] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -331,9 +324,7 @@ async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Cluster] = kwargs.pop("cls", None) request = build_get_request( @@ -348,8 +339,9 @@ async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -444,8 +436,8 @@ async def update( :type resource_group_name: str :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param body: Resource properties to update. Is either a model type or a IO type. Default value - is None. + :param body: Resource properties to update. Is either a ResourcePatch type or a IO type. + Default value is None. :type body: ~azure.mgmt.connectedvmware.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -466,16 +458,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Cluster] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -498,8 +488,9 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -534,9 +525,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -552,8 +541,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -563,8 +553,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + 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.ConnectedVMwarevSphere/clusters/{clusterName}" @@ -599,9 +593,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -656,9 +648,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Cluster"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClustersList] = kwargs.pop("cls", None) error_map = { @@ -710,8 +700,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -742,9 +733,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClustersList] = kwargs.pop("cls", None) error_map = { @@ -797,8 +786,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_datastores_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_datastores_operations.py index 3aa23149eda9..6bedcc6c0586 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_datastores_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_datastores_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -41,10 +41,6 @@ ) from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,16 +82,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Datastore] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -118,8 +112,9 @@ async def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -234,7 +229,7 @@ async def begin_create( :type resource_group_name: str :param datastore_name: Name of the datastore. Required. :type datastore_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a Datastore type or a IO type. Default value is None. :type body: ~azure.mgmt.connectedvmware.models.Datastore or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -255,9 +250,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Datastore] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -331,9 +324,7 @@ async def get(self, resource_group_name: str, datastore_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Datastore] = kwargs.pop("cls", None) request = build_get_request( @@ -348,8 +339,9 @@ async def get(self, resource_group_name: str, datastore_name: str, **kwargs: Any request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -444,8 +436,8 @@ async def update( :type resource_group_name: str :param datastore_name: Name of the datastore. Required. :type datastore_name: str - :param body: Resource properties to update. Is either a model type or a IO type. Default value - is None. + :param body: Resource properties to update. Is either a ResourcePatch type or a IO type. + Default value is None. :type body: ~azure.mgmt.connectedvmware.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -466,16 +458,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Datastore] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -498,8 +488,9 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -534,9 +525,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -552,8 +541,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -563,8 +553,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + 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.ConnectedVMwarevSphere/datastores/{datastoreName}" @@ -599,9 +593,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -656,9 +648,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Datastore"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DatastoresList] = kwargs.pop("cls", None) error_map = { @@ -710,8 +700,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -742,9 +733,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DatastoresList] = kwargs.pop("cls", None) error_map = { @@ -797,8 +786,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_guest_agents_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_guest_agents_operations.py index 1da6c4592865..c48987b0f20b 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_guest_agents_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_guest_agents_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ ) from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,16 +81,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.GuestAgent] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -118,8 +112,9 @@ async def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -243,7 +238,7 @@ async def begin_create( :type virtual_machine_name: str :param name: Name of the guestAgents. Required. :type name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a GuestAgent type or a IO type. Default value is None. :type body: ~azure.mgmt.connectedvmware.models.GuestAgent or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -264,9 +259,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.GuestAgent] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -345,9 +338,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GuestAgent] = kwargs.pop("cls", None) request = build_get_request( @@ -363,8 +354,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -399,9 +391,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -417,8 +407,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -428,8 +419,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + 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.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/guestAgents/{name}" @@ -464,9 +459,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -527,9 +520,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GuestAgentList] = kwargs.pop("cls", None) error_map = { @@ -583,8 +574,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_hosts_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_hosts_operations.py index 23670f6b2c3e..3ea373840f40 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_hosts_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_hosts_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -41,10 +41,6 @@ ) from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,16 +78,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Host] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -114,8 +108,9 @@ async def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -224,7 +219,7 @@ async def begin_create( :type resource_group_name: str :param host_name: Name of the host. Required. :type host_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a Host type or a IO type. Default value is None. :type body: ~azure.mgmt.connectedvmware.models.Host or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -244,9 +239,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Host] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -320,9 +313,7 @@ async def get(self, resource_group_name: str, host_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Host] = kwargs.pop("cls", None) request = build_get_request( @@ -337,8 +328,9 @@ async def get(self, resource_group_name: str, host_name: str, **kwargs: Any) -> request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -433,8 +425,8 @@ async def update( :type resource_group_name: str :param host_name: Name of the host. Required. :type host_name: str - :param body: Resource properties to update. Is either a model type or a IO type. Default value - is None. + :param body: Resource properties to update. Is either a ResourcePatch type or a IO type. + Default value is None. :type body: ~azure.mgmt.connectedvmware.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -455,16 +447,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Host] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -487,8 +477,9 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -523,9 +514,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -541,8 +530,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -552,8 +542,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + 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.ConnectedVMwarevSphere/hosts/{hostName}" @@ -588,9 +582,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -645,9 +637,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Host"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HostsList] = kwargs.pop("cls", None) error_map = { @@ -699,8 +689,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -731,9 +722,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HostsList] = kwargs.pop("cls", None) error_map = { @@ -786,8 +775,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_hybrid_identity_metadata_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_hybrid_identity_metadata_operations.py index a22686840cbc..d1ca71dce3fb 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_hybrid_identity_metadata_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_hybrid_identity_metadata_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -37,10 +37,6 @@ ) from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -147,7 +143,8 @@ async def create( :type virtual_machine_name: str :param metadata_name: Name of the hybridIdentityMetadata. Required. :type metadata_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a HybridIdentityMetadata type or a IO type. Default + value is None. :type body: ~azure.mgmt.connectedvmware.models.HybridIdentityMetadata or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -168,16 +165,14 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.HybridIdentityMetadata] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -201,8 +196,9 @@ async def create( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -253,9 +249,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HybridIdentityMetadata] = kwargs.pop("cls", None) request = build_get_request( @@ -271,8 +265,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -323,9 +318,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -341,8 +334,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -381,9 +375,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HybridIdentityMetadataList] = kwargs.pop("cls", None) error_map = { @@ -437,8 +429,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_inventory_items_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_inventory_items_operations.py index c3b5d41cc9b4..df27c839ad5e 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_inventory_items_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_inventory_items_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -37,10 +37,6 @@ ) from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -147,7 +143,8 @@ async def create( :type vcenter_name: str :param inventory_item_name: Name of the inventoryItem. Required. :type inventory_item_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a InventoryItem type or a IO type. Default value is + None. :type body: ~azure.mgmt.connectedvmware.models.InventoryItem or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -168,16 +165,14 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.InventoryItem] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -201,8 +196,9 @@ async def create( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -253,9 +249,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.InventoryItem] = kwargs.pop("cls", None) request = build_get_request( @@ -271,8 +265,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -323,9 +318,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -341,8 +334,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -380,9 +374,7 @@ def list_by_v_center( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.InventoryItemsList] = kwargs.pop("cls", None) error_map = { @@ -436,8 +428,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_machine_extensions_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_machine_extensions_operations.py index 7dc1e2cc6e15..b8c22f02a04a 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_machine_extensions_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_machine_extensions_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -40,10 +40,6 @@ ) from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,16 +82,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.MachineExtension] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(extension_parameters, (IO, bytes)): + if isinstance(extension_parameters, (IOBase, bytes)): _content = extension_parameters else: _json = self._serialize.body(extension_parameters, "MachineExtension") @@ -116,8 +110,9 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -241,7 +236,7 @@ async def begin_create_or_update( :param extension_name: The name of the machine extension. Required. :type extension_name: str :param extension_parameters: Parameters supplied to the Create Machine Extension operation. Is - either a model type or a IO type. Required. + either a MachineExtension type or a IO type. Required. :type extension_parameters: ~azure.mgmt.connectedvmware.models.MachineExtension or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -262,9 +257,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.MachineExtension] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -332,16 +325,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.MachineExtension] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(extension_parameters, (IO, bytes)): + if isinstance(extension_parameters, (IOBase, bytes)): _content = extension_parameters else: _json = self._serialize.body(extension_parameters, "MachineExtensionUpdate") @@ -362,8 +353,9 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -487,7 +479,7 @@ async def begin_update( :param extension_name: The name of the machine extension. Required. :type extension_name: str :param extension_parameters: Parameters supplied to the Create Machine Extension operation. Is - either a model type or a IO type. Required. + either a MachineExtensionUpdate type or a IO type. Required. :type extension_parameters: ~azure.mgmt.connectedvmware.models.MachineExtensionUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -508,9 +500,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.MachineExtension] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -570,9 +560,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -588,8 +576,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -599,8 +588,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + 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.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/extensions/{extensionName}" @@ -634,9 +627,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -705,9 +696,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MachineExtension] = kwargs.pop("cls", None) request = build_get_request( @@ -723,8 +712,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -766,9 +756,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MachineExtensionsListResult] = kwargs.pop("cls", None) error_map = { @@ -823,8 +811,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_operations.py index d1fce80456cb..e6846724f8d9 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from ...operations._operations import build_list_request from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,9 +65,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationsList] = kwargs.pop("cls", None) error_map = { @@ -123,8 +116,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_resource_pools_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_resource_pools_operations.py index cca6d9a8866d..8b4b0724cd36 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_resource_pools_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_resource_pools_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -41,10 +41,6 @@ ) from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,16 +82,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ResourcePool] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -118,8 +112,9 @@ async def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -234,7 +229,8 @@ async def begin_create( :type resource_group_name: str :param resource_pool_name: Name of the resourcePool. Required. :type resource_pool_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a ResourcePool type or a IO type. Default value is + None. :type body: ~azure.mgmt.connectedvmware.models.ResourcePool or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -255,9 +251,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ResourcePool] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -331,9 +325,7 @@ async def get(self, resource_group_name: str, resource_pool_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResourcePool] = kwargs.pop("cls", None) request = build_get_request( @@ -348,8 +340,9 @@ async def get(self, resource_group_name: str, resource_pool_name: str, **kwargs: request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -444,8 +437,8 @@ async def update( :type resource_group_name: str :param resource_pool_name: Name of the resourcePool. Required. :type resource_pool_name: str - :param body: Resource properties to update. Is either a model type or a IO type. Default value - is None. + :param body: Resource properties to update. Is either a ResourcePatch type or a IO type. + Default value is None. :type body: ~azure.mgmt.connectedvmware.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -466,16 +459,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ResourcePool] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -498,8 +489,9 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -534,9 +526,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -552,8 +542,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -563,8 +554,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + 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.ConnectedVMwarevSphere/resourcePools/{resourcePoolName}" @@ -599,9 +594,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -657,9 +650,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourcePool"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResourcePoolsList] = kwargs.pop("cls", None) error_map = { @@ -711,8 +702,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -744,9 +736,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResourcePoolsList] = kwargs.pop("cls", None) error_map = { @@ -799,8 +789,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_vcenters_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_vcenters_operations.py index 724690578480..be194f2ca9c0 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_vcenters_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_vcenters_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -41,10 +41,6 @@ ) from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,16 +82,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VCenter] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -118,8 +112,9 @@ async def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -234,7 +229,7 @@ async def begin_create( :type resource_group_name: str :param vcenter_name: Name of the vCenter. Required. :type vcenter_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a VCenter type or a IO type. Default value is None. :type body: ~azure.mgmt.connectedvmware.models.VCenter or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -255,9 +250,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VCenter] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -331,9 +324,7 @@ async def get(self, resource_group_name: str, vcenter_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VCenter] = kwargs.pop("cls", None) request = build_get_request( @@ -348,8 +339,9 @@ async def get(self, resource_group_name: str, vcenter_name: str, **kwargs: Any) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -444,8 +436,8 @@ async def update( :type resource_group_name: str :param vcenter_name: Name of the vCenter. Required. :type vcenter_name: str - :param body: Resource properties to update. Is either a model type or a IO type. Default value - is None. + :param body: Resource properties to update. Is either a ResourcePatch type or a IO type. + Default value is None. :type body: ~azure.mgmt.connectedvmware.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -466,16 +458,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VCenter] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -498,8 +488,9 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -534,9 +525,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -552,8 +541,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -563,8 +553,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + 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.ConnectedVMwarevSphere/vcenters/{vcenterName}" @@ -599,9 +593,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -656,9 +648,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.VCenter"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VCentersList] = kwargs.pop("cls", None) error_map = { @@ -710,8 +700,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -742,9 +733,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VCentersList] = kwargs.pop("cls", None) error_map = { @@ -797,8 +786,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_virtual_machine_instances_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_virtual_machine_instances_operations.py new file mode 100644 index 000000000000..d13de89caac2 --- /dev/null +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_virtual_machine_instances_operations.py @@ -0,0 +1,1210 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# 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 + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._virtual_machine_instances_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_restart_request, + build_start_request, + build_stop_request, + build_update_request, +) +from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class VirtualMachineInstancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.connectedvmware.aio.AzureArcVMwareManagementServiceAPI`'s + :attr:`virtual_machine_instances` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _create_or_update_initial( + self, resource_uri: str, body: Optional[Union[_models.VirtualMachineInstance, IO]] = None, **kwargs: Any + ) -> _models.VirtualMachineInstance: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachineInstance] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "VirtualMachineInstance") + else: + _json = None + + request = build_create_or_update_request( + resource_uri=resource_uri, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default" + } + + @overload + async def begin_create_or_update( + self, + resource_uri: str, + body: Optional[_models.VirtualMachineInstance] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineInstance]: + """Implements virtual machine PUT method. + + The operation to create or update a virtual machine instance. Please note some properties can + be set only during virtual machine instance creation. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Request payload. Default value is None. + :type body: ~azure.mgmt.connectedvmware.models.VirtualMachineInstance + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualMachineInstance or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.connectedvmware.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, resource_uri: str, body: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineInstance]: + """Implements virtual machine PUT method. + + The operation to create or update a virtual machine instance. Please note some properties can + be set only during virtual machine instance creation. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Request payload. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualMachineInstance or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.connectedvmware.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_uri: str, body: Optional[Union[_models.VirtualMachineInstance, IO]] = None, **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineInstance]: + """Implements virtual machine PUT method. + + The operation to create or update a virtual machine instance. Please note some properties can + be set only during virtual machine instance creation. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Request payload. Is either a VirtualMachineInstance type or a IO type. Default + value is None. + :type body: ~azure.mgmt.connectedvmware.models.VirtualMachineInstance or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualMachineInstance or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.connectedvmware.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachineInstance] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_uri=resource_uri, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default" + } + + @distributed_trace_async + async def get(self, resource_uri: str, **kwargs: Any) -> _models.VirtualMachineInstance: + """Gets a virtual machine. + + Retrieves information about a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineInstance or the result of cls(response) + :rtype: ~azure.mgmt.connectedvmware.models.VirtualMachineInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualMachineInstance] = kwargs.pop("cls", None) + + request = build_get_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {"url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default"} + + async def _update_initial( + self, resource_uri: str, body: Optional[Union[_models.VirtualMachineInstanceUpdate, IO]] = None, **kwargs: Any + ) -> Optional[_models.VirtualMachineInstance]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.VirtualMachineInstance]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "VirtualMachineInstanceUpdate") + else: + _json = None + + request = build_update_request( + resource_uri=resource_uri, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default" + } + + @overload + async def begin_update( + self, + resource_uri: str, + body: Optional[_models.VirtualMachineInstanceUpdate] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineInstance]: + """Updates a virtual machine. + + The operation to update a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Resource properties to update. Default value is None. + :type body: ~azure.mgmt.connectedvmware.models.VirtualMachineInstanceUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualMachineInstance or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.connectedvmware.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, resource_uri: str, body: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineInstance]: + """Updates a virtual machine. + + The operation to update a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Resource properties to update. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualMachineInstance or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.connectedvmware.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, resource_uri: str, body: Optional[Union[_models.VirtualMachineInstanceUpdate, IO]] = None, **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineInstance]: + """Updates a virtual machine. + + The operation to update a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Resource properties to update. Is either a VirtualMachineInstanceUpdate type or a + IO type. Default value is None. + :type body: ~azure.mgmt.connectedvmware.models.VirtualMachineInstanceUpdate or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualMachineInstance or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.connectedvmware.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachineInstance] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_uri=resource_uri, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_uri: str, delete_from_host: Optional[bool] = None, force: Optional[bool] = None, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_uri=resource_uri, + delete_from_host=delete_from_host, + force=force, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default" + } + + @distributed_trace_async + async def begin_delete( + self, resource_uri: str, delete_from_host: Optional[bool] = None, force: Optional[bool] = None, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an virtual machine. + + The operation to delete a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param delete_from_host: Whether to delete the VM from the vCenter. Default value is None. + :type delete_from_host: bool + :param force: Whether force delete was specified. Default value is None. + :type force: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_uri=resource_uri, + delete_from_host=delete_from_host, + force=force, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default" + } + + @distributed_trace + def list(self, resource_uri: str, **kwargs: Any) -> AsyncIterable["_models.VirtualMachineInstance"]: + """Implements List virtual machine instances. + + Lists all of the virtual machine instances within the specified parent resource. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineInstance or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.connectedvmware.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualMachineInstancesList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualMachineInstancesList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances"} + + async def _stop_initial( # pylint: disable=inconsistent-return-statements + self, resource_uri: str, body: Optional[Union[_models.StopVirtualMachineOptions, IO]] = None, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "StopVirtualMachineOptions") + else: + _json = None + + request = build_stop_request( + resource_uri=resource_uri, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._stop_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _stop_initial.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/stop" + } + + @overload + async def begin_stop( + self, + resource_uri: str, + body: Optional[_models.StopVirtualMachineOptions] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements the operation to stop a virtual machine. + + The operation to power off (stop) a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Virtualmachine stop action payload. Default value is None. + :type body: ~azure.mgmt.connectedvmware.models.StopVirtualMachineOptions + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_stop( + self, resource_uri: str, body: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements the operation to stop a virtual machine. + + The operation to power off (stop) a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Virtualmachine stop action payload. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_stop( + self, resource_uri: str, body: Optional[Union[_models.StopVirtualMachineOptions, IO]] = None, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements the operation to stop a virtual machine. + + The operation to power off (stop) a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Virtualmachine stop action payload. Is either a StopVirtualMachineOptions type or + a IO type. Default value is None. + :type body: ~azure.mgmt.connectedvmware.models.StopVirtualMachineOptions or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._stop_initial( # type: ignore + resource_uri=resource_uri, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/stop" + } + + async def _start_initial( # pylint: disable=inconsistent-return-statements + self, resource_uri: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_start_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self._start_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _start_initial.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/start" + } + + @distributed_trace_async + async def begin_start(self, resource_uri: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Implements the operation to start a virtual machine. + + The operation to start a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._start_initial( # type: ignore + resource_uri=resource_uri, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/start" + } + + async def _restart_initial( # pylint: disable=inconsistent-return-statements + self, resource_uri: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_restart_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self._restart_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _restart_initial.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/restart" + } + + @distributed_trace_async + async def begin_restart(self, resource_uri: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Implements the operation to restart a virtual machine. + + The operation to restart a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._restart_initial( # type: ignore + resource_uri=resource_uri, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_restart.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/restart" + } diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_virtual_machine_templates_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_virtual_machine_templates_operations.py index ace320990c5d..c0efe4563d69 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_virtual_machine_templates_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_virtual_machine_templates_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -41,10 +41,6 @@ ) from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,16 +82,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualMachineTemplate] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -118,8 +112,9 @@ async def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -236,7 +231,8 @@ async def begin_create( :type resource_group_name: str :param virtual_machine_template_name: Name of the virtual machine template resource. Required. :type virtual_machine_template_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a VirtualMachineTemplate type or a IO type. Default + value is None. :type body: ~azure.mgmt.connectedvmware.models.VirtualMachineTemplate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -258,9 +254,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualMachineTemplate] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -336,9 +330,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachineTemplate] = kwargs.pop("cls", None) request = build_get_request( @@ -353,8 +345,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -449,8 +442,8 @@ async def update( :type resource_group_name: str :param virtual_machine_template_name: Name of the virtual machine template resource. Required. :type virtual_machine_template_name: str - :param body: Resource properties to update. Is either a model type or a IO type. Default value - is None. + :param body: Resource properties to update. Is either a ResourcePatch type or a IO type. + Default value is None. :type body: ~azure.mgmt.connectedvmware.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -471,16 +464,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualMachineTemplate] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -503,8 +494,9 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -539,9 +531,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -557,8 +547,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -568,8 +559,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + 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.ConnectedVMwarevSphere/virtualMachineTemplates/{virtualMachineTemplateName}" @@ -604,9 +599,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -663,9 +656,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.VirtualMachineTemplate"] _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachineTemplatesList] = kwargs.pop("cls", None) error_map = { @@ -717,8 +708,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -755,9 +747,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachineTemplatesList] = kwargs.pop("cls", None) error_map = { @@ -810,8 +800,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_virtual_machines_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_virtual_machines_operations.py index c89481d966e2..83fde5a22247 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_virtual_machines_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_virtual_machines_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -46,10 +46,6 @@ ) from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -87,9 +83,7 @@ async def _assess_patches_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.VirtualMachineAssessPatchesResult]] = kwargs.pop("cls", None) request = build_assess_patches_request( @@ -104,8 +98,9 @@ async def _assess_patches_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -116,11 +111,15 @@ async def _assess_patches_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("VirtualMachineAssessPatchesResult", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized @@ -155,9 +154,7 @@ async def begin_assess_patches( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachineAssessPatchesResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -219,16 +216,14 @@ async def _install_patches_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.VirtualMachineInstallPatchesResult]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(install_patches_input, (IO, bytes)): + if isinstance(install_patches_input, (IOBase, bytes)): _content = install_patches_input else: _json = self._serialize.body(install_patches_input, "VirtualMachineInstallPatchesParameters") @@ -248,8 +243,9 @@ async def _install_patches_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -260,11 +256,15 @@ async def _install_patches_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("VirtualMachineInstallPatchesResult", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized @@ -362,7 +362,7 @@ async def begin_install_patches( :param virtual_machine_name: The name of the vSphere VMware machine. Required. :type virtual_machine_name: str :param install_patches_input: Input for InstallPatches as directly received by the API. Is - either a model type or a IO type. Required. + either a VirtualMachineInstallPatchesParameters type or a IO type. Required. :type install_patches_input: ~azure.mgmt.connectedvmware.models.VirtualMachineInstallPatchesParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -385,9 +385,7 @@ async def begin_install_patches( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualMachineInstallPatchesResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -452,16 +450,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -484,8 +480,9 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -600,7 +597,8 @@ async def begin_create_or_update( :type resource_group_name: str :param virtual_machine_name: Name of the virtual machine resource. Required. :type virtual_machine_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a VirtualMachine type or a IO type. Default value is + None. :type body: ~azure.mgmt.connectedvmware.models.VirtualMachine or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -621,9 +619,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -697,9 +693,7 @@ async def get(self, resource_group_name: str, virtual_machine_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) request = build_get_request( @@ -714,8 +708,9 @@ async def get(self, resource_group_name: str, virtual_machine_name: str, **kwarg request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -754,16 +749,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.VirtualMachine]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -786,8 +779,9 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -798,14 +792,18 @@ async def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("VirtualMachine", pipeline_response) if response.status_code == 201: deserialized = self._deserialize("VirtualMachine", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized @@ -903,8 +901,8 @@ async def begin_update( :type resource_group_name: str :param virtual_machine_name: Name of the virtual machine resource. Required. :type virtual_machine_name: str - :param body: Resource properties to update. Is either a model type or a IO type. Default value - is None. + :param body: Resource properties to update. Is either a VirtualMachineUpdate type or a IO type. + Default value is None. :type body: ~azure.mgmt.connectedvmware.models.VirtualMachineUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -925,9 +923,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -976,7 +972,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, virtual_machine_name: str, - retain: Optional[bool] = None, + delete_from_host: Optional[bool] = None, force: Optional[bool] = None, **kwargs: Any ) -> None: @@ -991,16 +987,14 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, virtual_machine_name=virtual_machine_name, subscription_id=self._config.subscription_id, - retain=retain, + delete_from_host=delete_from_host, force=force, api_version=api_version, template_url=self._delete_initial.metadata["url"], @@ -1010,8 +1004,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1021,8 +1016,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + 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.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}" @@ -1033,7 +1032,7 @@ async def begin_delete( self, resource_group_name: str, virtual_machine_name: str, - retain: Optional[bool] = None, + delete_from_host: Optional[bool] = None, force: Optional[bool] = None, **kwargs: Any ) -> AsyncLROPoller[None]: @@ -1045,9 +1044,8 @@ async def begin_delete( :type resource_group_name: str :param virtual_machine_name: Name of the virtual machine resource. Required. :type virtual_machine_name: str - :param retain: Whether to just disable the VM from azure and retain the VM in the VMM. Default - value is None. - :type retain: bool + :param delete_from_host: Whether to delete the VM from the vCenter. Default value is None. + :type delete_from_host: bool :param force: Whether force delete was specified. Default value is None. :type force: bool :keyword callable cls: A custom type or function that will be passed the direct response @@ -1065,9 +1063,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -1076,7 +1072,7 @@ async def begin_delete( raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, virtual_machine_name=virtual_machine_name, - retain=retain, + delete_from_host=delete_from_host, force=force, api_version=api_version, cls=lambda x, y, z: x, @@ -1127,16 +1123,14 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -1159,8 +1153,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1170,8 +1165,12 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _stop_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/stop" @@ -1265,8 +1264,8 @@ async def begin_stop( :type resource_group_name: str :param virtual_machine_name: Name of the virtual machine resource. Required. :type virtual_machine_name: str - :param body: Virtualmachine stop action payload. Is either a model type or a IO type. Default - value is None. + :param body: Virtualmachine stop action payload. Is either a StopVirtualMachineOptions type or + a IO type. Default value is None. :type body: ~azure.mgmt.connectedvmware.models.StopVirtualMachineOptions or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1286,9 +1285,7 @@ async def begin_stop( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -1347,9 +1344,7 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_start_request( @@ -1364,8 +1359,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1375,8 +1371,12 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _start_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/start" @@ -1409,9 +1409,7 @@ async def begin_start( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -1467,9 +1465,7 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_restart_request( @@ -1484,8 +1480,9 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1495,8 +1492,12 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _restart_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/restart" @@ -1529,9 +1530,7 @@ async def begin_restart( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -1588,9 +1587,7 @@ def list_all(self, **kwargs: Any) -> AsyncIterable["_models.VirtualMachine"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachinesList] = kwargs.pop("cls", None) error_map = { @@ -1642,8 +1639,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1677,9 +1675,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_model _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachinesList] = kwargs.pop("cls", None) error_map = { @@ -1732,8 +1728,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_virtual_networks_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_virtual_networks_operations.py index 40b3d321e3e6..4135f8e7734d 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_virtual_networks_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_virtual_networks_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -41,10 +41,6 @@ ) from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,16 +82,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -118,8 +112,9 @@ async def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -234,7 +229,8 @@ async def begin_create( :type resource_group_name: str :param virtual_network_name: Name of the virtual network resource. Required. :type virtual_network_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a VirtualNetwork type or a IO type. Default value is + None. :type body: ~azure.mgmt.connectedvmware.models.VirtualNetwork or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -255,9 +251,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -331,9 +325,7 @@ async def get(self, resource_group_name: str, virtual_network_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) request = build_get_request( @@ -348,8 +340,9 @@ async def get(self, resource_group_name: str, virtual_network_name: str, **kwarg request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -444,8 +437,8 @@ async def update( :type resource_group_name: str :param virtual_network_name: Name of the virtual network resource. Required. :type virtual_network_name: str - :param body: Resource properties to update. Is either a model type or a IO type. Default value - is None. + :param body: Resource properties to update. Is either a ResourcePatch type or a IO type. + Default value is None. :type body: ~azure.mgmt.connectedvmware.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -466,16 +459,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -498,8 +489,9 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -534,9 +526,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -552,8 +542,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -563,8 +554,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + 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.ConnectedVMwarevSphere/virtualNetworks/{virtualNetworkName}" @@ -599,9 +594,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -657,9 +650,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.VirtualNetwork"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualNetworksList] = kwargs.pop("cls", None) error_map = { @@ -711,8 +702,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -748,9 +740,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualNetworksList] = kwargs.pop("cls", None) error_map = { @@ -803,8 +793,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_vm_instance_guest_agents_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_vm_instance_guest_agents_operations.py new file mode 100644 index 000000000000..e52291081378 --- /dev/null +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_vm_instance_guest_agents_operations.py @@ -0,0 +1,538 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# 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 + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._vm_instance_guest_agents_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_request, +) +from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class VMInstanceGuestAgentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.connectedvmware.aio.AzureArcVMwareManagementServiceAPI`'s + :attr:`vm_instance_guest_agents` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _create_initial( + self, resource_uri: str, body: Optional[Union[_models.GuestAgent, IO]] = None, **kwargs: Any + ) -> _models.GuestAgent: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GuestAgent] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "GuestAgent") + else: + _json = None + + request = build_create_request( + resource_uri=resource_uri, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("GuestAgent", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("GuestAgent", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/guestAgents/default" + } + + @overload + async def begin_create( + self, + resource_uri: str, + body: Optional[_models.GuestAgent] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GuestAgent]: + """Implements GuestAgent PUT method. + + Create Or Update GuestAgent. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Request payload. Default value is None. + :type body: ~azure.mgmt.connectedvmware.models.GuestAgent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GuestAgent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.connectedvmware.models.GuestAgent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, resource_uri: str, body: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.GuestAgent]: + """Implements GuestAgent PUT method. + + Create Or Update GuestAgent. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Request payload. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GuestAgent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.connectedvmware.models.GuestAgent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, resource_uri: str, body: Optional[Union[_models.GuestAgent, IO]] = None, **kwargs: Any + ) -> AsyncLROPoller[_models.GuestAgent]: + """Implements GuestAgent PUT method. + + Create Or Update GuestAgent. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Request payload. Is either a GuestAgent type or a IO type. Default value is None. + :type body: ~azure.mgmt.connectedvmware.models.GuestAgent or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GuestAgent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.connectedvmware.models.GuestAgent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GuestAgent] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_uri=resource_uri, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GuestAgent", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/guestAgents/default" + } + + @distributed_trace_async + async def get(self, resource_uri: str, **kwargs: Any) -> _models.GuestAgent: + """Gets GuestAgent. + + Implements GuestAgent GET method. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GuestAgent or the result of cls(response) + :rtype: ~azure.mgmt.connectedvmware.models.GuestAgent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GuestAgent] = kwargs.pop("cls", None) + + request = build_get_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("GuestAgent", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/guestAgents/default" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_uri: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/guestAgents/default" + } + + @distributed_trace_async + async def begin_delete(self, resource_uri: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes an GuestAgent. + + Implements GuestAgent DELETE method. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_uri=resource_uri, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/guestAgents/default" + } + + @distributed_trace + def list(self, resource_uri: str, **kwargs: Any) -> AsyncIterable["_models.GuestAgent"]: + """Implements GET GuestAgent in a vm. + + Returns the list of GuestAgent of the given vm. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GuestAgent or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.connectedvmware.models.GuestAgent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GuestAgentList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("GuestAgentList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/guestAgents" + } diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_vm_instance_hybrid_identity_metadata_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_vm_instance_hybrid_identity_metadata_operations.py new file mode 100644 index 000000000000..85b02e97551f --- /dev/null +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_vm_instance_hybrid_identity_metadata_operations.py @@ -0,0 +1,206 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._vm_instance_hybrid_identity_metadata_operations import build_get_request, build_list_request +from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class VmInstanceHybridIdentityMetadataOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.connectedvmware.aio.AzureArcVMwareManagementServiceAPI`'s + :attr:`vm_instance_hybrid_identity_metadata` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, resource_uri: str, **kwargs: Any) -> _models.VmInstanceHybridIdentityMetadata: + """Gets HybridIdentityMetadata. + + Implements HybridIdentityMetadata GET method. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VmInstanceHybridIdentityMetadata or the result of cls(response) + :rtype: ~azure.mgmt.connectedvmware.models.VmInstanceHybridIdentityMetadata + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VmInstanceHybridIdentityMetadata] = kwargs.pop("cls", None) + + request = build_get_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VmInstanceHybridIdentityMetadata", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/hybridIdentityMetadata/default" + } + + @distributed_trace + def list(self, resource_uri: str, **kwargs: Any) -> AsyncIterable["_models.VmInstanceHybridIdentityMetadata"]: + """Implements GET HybridIdentityMetadata in a vm. + + Returns the list of HybridIdentityMetadata of the given vm. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VmInstanceHybridIdentityMetadata or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.connectedvmware.models.VmInstanceHybridIdentityMetadata] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VmInstanceHybridIdentityMetadataList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("VmInstanceHybridIdentityMetadataList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/hybridIdentityMetadata" + } diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/models/__init__.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/models/__init__.py index 6ea441d3d777..380b94e389cc 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/models/__init__.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/models/__init__.py @@ -32,6 +32,7 @@ from ._models_py3 import HybridIdentityMetadata from ._models_py3 import HybridIdentityMetadataList from ._models_py3 import Identity +from ._models_py3 import InfrastructureProfile from ._models_py3 import InventoryItem from ._models_py3 import InventoryItemDetails from ._models_py3 import InventoryItemProperties @@ -54,6 +55,7 @@ from ._models_py3 import OperationDisplay from ._models_py3 import OperationsList from ._models_py3 import OsProfile +from ._models_py3 import OsProfileForVMInstance from ._models_py3 import OsProfileLinuxConfiguration from ._models_py3 import OsProfileUpdate from ._models_py3 import OsProfileUpdateLinuxConfiguration @@ -82,6 +84,9 @@ from ._models_py3 import VirtualMachineAssessPatchesResult from ._models_py3 import VirtualMachineInstallPatchesParameters from ._models_py3 import VirtualMachineInstallPatchesResult +from ._models_py3 import VirtualMachineInstance +from ._models_py3 import VirtualMachineInstanceUpdate +from ._models_py3 import VirtualMachineInstancesList from ._models_py3 import VirtualMachineInventoryItem from ._models_py3 import VirtualMachineTemplate from ._models_py3 import VirtualMachineTemplateInventoryItem @@ -92,6 +97,8 @@ from ._models_py3 import VirtualNetworkInventoryItem from ._models_py3 import VirtualNetworksList from ._models_py3 import VirtualSCSIController +from ._models_py3 import VmInstanceHybridIdentityMetadata +from ._models_py3 import VmInstanceHybridIdentityMetadataList from ._models_py3 import WindowsParameters from ._azure_arc_vmware_management_service_api_enums import CreatedByType @@ -149,6 +156,7 @@ "HybridIdentityMetadata", "HybridIdentityMetadataList", "Identity", + "InfrastructureProfile", "InventoryItem", "InventoryItemDetails", "InventoryItemProperties", @@ -171,6 +179,7 @@ "OperationDisplay", "OperationsList", "OsProfile", + "OsProfileForVMInstance", "OsProfileLinuxConfiguration", "OsProfileUpdate", "OsProfileUpdateLinuxConfiguration", @@ -199,6 +208,9 @@ "VirtualMachineAssessPatchesResult", "VirtualMachineInstallPatchesParameters", "VirtualMachineInstallPatchesResult", + "VirtualMachineInstance", + "VirtualMachineInstanceUpdate", + "VirtualMachineInstancesList", "VirtualMachineInventoryItem", "VirtualMachineTemplate", "VirtualMachineTemplateInventoryItem", @@ -209,6 +221,8 @@ "VirtualNetworkInventoryItem", "VirtualNetworksList", "VirtualSCSIController", + "VmInstanceHybridIdentityMetadata", + "VmInstanceHybridIdentityMetadataList", "WindowsParameters", "CreatedByType", "DiskMode", diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/models/_models_py3.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/models/_models_py3.py index d9bc40264e5c..3086b6aef8cc 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/models/_models_py3.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/models/_models_py3.py @@ -73,7 +73,7 @@ class AvailablePatchCountByClassification(_serialization.Model): "other": {"key": "other", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.security = None @@ -127,12 +127,21 @@ class Cluster(_serialization.Model): # pylint: disable=too-many-instance-attrib :vartype statuses: list[~azure.mgmt.connectedvmware.models.ResourceStatus] :ivar custom_resource_name: Gets the name of the corresponding resource in Kubernetes. :vartype custom_resource_name: str - :ivar datastore_ids: Gets or sets the datastore ARM ids. + :ivar used_memory_gb: Gets the used physical memory on the cluster in GB. + :vartype used_memory_gb: int + :ivar total_memory_gb: Gets the total amount of physical memory on the cluster in GB. + :vartype total_memory_gb: int + :ivar used_cpu_m_hz: Gets the used CPU usage across all cores on the cluster in MHz. + :vartype used_cpu_m_hz: int + :ivar total_cpu_m_hz: Gets the max CPU usage across all cores on the cluster in MHz. + :vartype total_cpu_m_hz: int + :ivar datastore_ids: Gets the datastore ARM ids. :vartype datastore_ids: list[str] - :ivar network_ids: Gets or sets the network ARM ids. + :ivar network_ids: Gets the network ARM ids. :vartype network_ids: list[str] - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState """ _validation = { @@ -145,6 +154,10 @@ class Cluster(_serialization.Model): # pylint: disable=too-many-instance-attrib "mo_name": {"readonly": True}, "statuses": {"readonly": True}, "custom_resource_name": {"readonly": True}, + "used_memory_gb": {"readonly": True}, + "total_memory_gb": {"readonly": True}, + "used_cpu_m_hz": {"readonly": True}, + "total_cpu_m_hz": {"readonly": True}, "datastore_ids": {"readonly": True}, "network_ids": {"readonly": True}, "provisioning_state": {"readonly": True}, @@ -166,6 +179,10 @@ class Cluster(_serialization.Model): # pylint: disable=too-many-instance-attrib "mo_name": {"key": "properties.moName", "type": "str"}, "statuses": {"key": "properties.statuses", "type": "[ResourceStatus]"}, "custom_resource_name": {"key": "properties.customResourceName", "type": "str"}, + "used_memory_gb": {"key": "properties.usedMemoryGB", "type": "int"}, + "total_memory_gb": {"key": "properties.totalMemoryGB", "type": "int"}, + "used_cpu_m_hz": {"key": "properties.usedCpuMHz", "type": "int"}, + "total_cpu_m_hz": {"key": "properties.totalCpuMHz", "type": "int"}, "datastore_ids": {"key": "properties.datastoreIds", "type": "[str]"}, "network_ids": {"key": "properties.networkIds", "type": "[str]"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, @@ -181,8 +198,8 @@ def __init__( v_center_id: Optional[str] = None, mo_ref_id: Optional[str] = None, inventory_item_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Gets or sets the location. Required. :paramtype location: str @@ -219,6 +236,10 @@ def __init__( self.mo_name = None self.statuses = None self.custom_resource_name = None + self.used_memory_gb = None + self.total_memory_gb = None + self.used_cpu_m_hz = None + self.total_cpu_m_hz = None self.datastore_ids = None self.network_ids = None self.provisioning_state = None @@ -246,8 +267,9 @@ class InventoryItemProperties(_serialization.Model): :vartype mo_ref_id: str :ivar mo_name: Gets or sets the vCenter Managed Object name for the inventory item. :vartype mo_name: str - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState """ _validation = { @@ -281,8 +303,8 @@ def __init__( managed_resource_id: Optional[str] = None, mo_ref_id: Optional[str] = None, mo_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword managed_resource_id: Gets or sets the tracked resource id corresponding to the inventory resource. @@ -319,8 +341,9 @@ class ClusterInventoryItem(InventoryItemProperties): :vartype mo_ref_id: str :ivar mo_name: Gets or sets the vCenter Managed Object name for the inventory item. :vartype mo_name: str - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState """ _validation = { @@ -342,8 +365,8 @@ def __init__( managed_resource_id: Optional[str] = None, mo_ref_id: Optional[str] = None, mo_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword managed_resource_id: Gets or sets the tracked resource id corresponding to the inventory resource. @@ -378,7 +401,7 @@ class ClustersList(_serialization.Model): "value": {"key": "value", "type": "[Cluster]"}, } - def __init__(self, *, value: List["_models.Cluster"], next_link: Optional[str] = None, **kwargs): + def __init__(self, *, value: List["_models.Cluster"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: Url to follow for getting next page of Clusters. :paramtype next_link: str @@ -419,7 +442,7 @@ class Condition(_serialization.Model): "severity": {"key": "severity", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.status = None @@ -524,8 +547,8 @@ def __init__( v_center_id: Optional[str] = None, mo_ref_id: Optional[str] = None, inventory_item_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Gets or sets the location. Required. :paramtype location: str @@ -585,8 +608,9 @@ class DatastoreInventoryItem(InventoryItemProperties): :vartype mo_ref_id: str :ivar mo_name: Gets or sets the vCenter Managed Object name for the inventory item. :vartype mo_name: str - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState :ivar capacity_gb: Gets or sets Maximum capacity of this datastore, in GBs. :vartype capacity_gb: int :ivar free_space_gb: Gets or sets Available space of this datastore, in GBs. @@ -616,8 +640,8 @@ def __init__( mo_name: Optional[str] = None, capacity_gb: Optional[int] = None, free_space_gb: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword managed_resource_id: Gets or sets the tracked resource id corresponding to the inventory resource. @@ -658,7 +682,7 @@ class DatastoresList(_serialization.Model): "value": {"key": "value", "type": "[Datastore]"}, } - def __init__(self, *, value: List["_models.Datastore"], next_link: Optional[str] = None, **kwargs): + def __init__(self, *, value: List["_models.Datastore"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: Url to follow for getting next page of Datastores. :paramtype next_link: str @@ -691,7 +715,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -731,7 +755,7 @@ class ErrorDetail(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -742,7 +766,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). :ivar error: The error object. :vartype error: ~azure.mgmt.connectedvmware.models.ErrorDetail @@ -752,7 +777,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.connectedvmware.models.ErrorDetail @@ -775,7 +800,7 @@ class ExtendedLocation(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, type: Optional[str] = None, name: Optional[str] = None, **kwargs): + def __init__(self, *, type: Optional[str] = None, name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword type: The extended location type. :paramtype type: str @@ -798,7 +823,7 @@ class ExtensionTargetProperties(_serialization.Model): "target_version": {"key": "targetVersion", "type": "str"}, } - def __init__(self, *, target_version: Optional[str] = None, **kwargs): + def __init__(self, *, target_version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword target_version: Properties for the specified Extension to Upgrade. :paramtype target_version: str @@ -812,64 +837,76 @@ class Resource(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.connectedvmware.models.SystemData """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None self.name = None self.type = None + self.system_data = None class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.connectedvmware.models.SystemData """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) @@ -879,20 +916,24 @@ class GuestAgent(ProxyResource): # pylint: disable=too-many-instance-attributes Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: The system data. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.connectedvmware.models.SystemData :ivar uuid: Gets or sets a unique identifier for this resource. :vartype uuid: str :ivar credentials: Username / Password Credentials to provision guest agent. :vartype credentials: ~azure.mgmt.connectedvmware.models.GuestCredential + :ivar private_link_scope_resource_id: The resource id of the private link scope this machine is + assigned to, if any. + :vartype private_link_scope_resource_id: str :ivar http_proxy_config: HTTP Proxy configuration for the VM. :vartype http_proxy_config: ~azure.mgmt.connectedvmware.models.HttpProxyConfiguration :ivar provisioning_action: Gets or sets the guest agent provisioning action. Known values are: @@ -904,8 +945,9 @@ class GuestAgent(ProxyResource): # pylint: disable=too-many-instance-attributes :vartype custom_resource_name: str :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.connectedvmware.models.ResourceStatus] - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState """ _validation = { @@ -927,6 +969,7 @@ class GuestAgent(ProxyResource): # pylint: disable=too-many-instance-attributes "system_data": {"key": "systemData", "type": "SystemData"}, "uuid": {"key": "properties.uuid", "type": "str"}, "credentials": {"key": "properties.credentials", "type": "GuestCredential"}, + "private_link_scope_resource_id": {"key": "properties.privateLinkScopeResourceId", "type": "str"}, "http_proxy_config": {"key": "properties.httpProxyConfig", "type": "HttpProxyConfiguration"}, "provisioning_action": {"key": "properties.provisioningAction", "type": "str"}, "status": {"key": "properties.status", "type": "str"}, @@ -939,13 +982,17 @@ def __init__( self, *, credentials: Optional["_models.GuestCredential"] = None, + private_link_scope_resource_id: Optional[str] = None, http_proxy_config: Optional["_models.HttpProxyConfiguration"] = None, provisioning_action: Optional[Union[str, "_models.ProvisioningAction"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword credentials: Username / Password Credentials to provision guest agent. :paramtype credentials: ~azure.mgmt.connectedvmware.models.GuestCredential + :keyword private_link_scope_resource_id: The resource id of the private link scope this machine + is assigned to, if any. + :paramtype private_link_scope_resource_id: str :keyword http_proxy_config: HTTP Proxy configuration for the VM. :paramtype http_proxy_config: ~azure.mgmt.connectedvmware.models.HttpProxyConfiguration :keyword provisioning_action: Gets or sets the guest agent provisioning action. Known values @@ -953,9 +1000,9 @@ def __init__( :paramtype provisioning_action: str or ~azure.mgmt.connectedvmware.models.ProvisioningAction """ super().__init__(**kwargs) - self.system_data = None self.uuid = None self.credentials = credentials + self.private_link_scope_resource_id = private_link_scope_resource_id self.http_proxy_config = http_proxy_config self.provisioning_action = provisioning_action self.status = None @@ -984,7 +1031,7 @@ class GuestAgentList(_serialization.Model): "value": {"key": "value", "type": "[GuestAgent]"}, } - def __init__(self, *, value: List["_models.GuestAgent"], next_link: Optional[str] = None, **kwargs): + def __init__(self, *, value: List["_models.GuestAgent"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: Url to follow for getting next page of GuestAgent. :paramtype next_link: str @@ -1038,7 +1085,7 @@ class GuestAgentProfile(_serialization.Model): "error_details": {"key": "errorDetails", "type": "[ErrorDetail]"}, } - def __init__(self, *, client_public_key: Optional[str] = None, **kwargs): + def __init__(self, *, client_public_key: Optional[str] = None, **kwargs: Any) -> None: """ :keyword client_public_key: Gets or sets the Public Key provided by the client for enabling guest management. @@ -1066,7 +1113,7 @@ class GuestAgentProfileUpdate(_serialization.Model): "client_public_key": {"key": "clientPublicKey", "type": "str"}, } - def __init__(self, *, client_public_key: Optional[str] = None, **kwargs): + def __init__(self, *, client_public_key: Optional[str] = None, **kwargs: Any) -> None: """ :keyword client_public_key: Gets or sets the Public Key provided by the client for enabling guest management. @@ -1090,7 +1137,7 @@ class GuestCredential(_serialization.Model): "password": {"key": "password", "type": "str"}, } - def __init__(self, *, username: Optional[str] = None, password: Optional[str] = None, **kwargs): + def __init__(self, *, username: Optional[str] = None, password: Optional[str] = None, **kwargs: Any) -> None: """ :keyword username: Gets or sets username to connect with the guest. :paramtype username: str @@ -1146,8 +1193,8 @@ def __init__( memory_size_mb: Optional[int] = None, num_cp_us: Optional[int] = None, num_cores_per_socket: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword memory_size_mb: Gets or sets memory size in MBs for the vm. :paramtype memory_size_mb: int @@ -1205,12 +1252,21 @@ class Host(_serialization.Model): # pylint: disable=too-many-instance-attribute :vartype statuses: list[~azure.mgmt.connectedvmware.models.ResourceStatus] :ivar custom_resource_name: Gets the name of the corresponding resource in Kubernetes. :vartype custom_resource_name: str - :ivar datastore_ids: Gets or sets the datastore ARM ids. + :ivar overall_memory_usage_gb: Gets the used physical memory on the host in GB. + :vartype overall_memory_usage_gb: int + :ivar memory_size_gb: Gets the total amount of physical memory on the host in GB. + :vartype memory_size_gb: int + :ivar overall_cpu_usage_m_hz: Gets the used CPU usage across all cores in MHz. + :vartype overall_cpu_usage_m_hz: int + :ivar cpu_mhz: Gets the max CPU usage across all cores in MHz. + :vartype cpu_mhz: int + :ivar datastore_ids: Gets the datastore ARM ids. :vartype datastore_ids: list[str] - :ivar network_ids: Gets or sets the network ARM ids. + :ivar network_ids: Gets the network ARM ids. :vartype network_ids: list[str] - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState """ _validation = { @@ -1223,6 +1279,10 @@ class Host(_serialization.Model): # pylint: disable=too-many-instance-attribute "mo_name": {"readonly": True}, "statuses": {"readonly": True}, "custom_resource_name": {"readonly": True}, + "overall_memory_usage_gb": {"readonly": True}, + "memory_size_gb": {"readonly": True}, + "overall_cpu_usage_m_hz": {"readonly": True}, + "cpu_mhz": {"readonly": True}, "datastore_ids": {"readonly": True}, "network_ids": {"readonly": True}, "provisioning_state": {"readonly": True}, @@ -1244,6 +1304,10 @@ class Host(_serialization.Model): # pylint: disable=too-many-instance-attribute "mo_name": {"key": "properties.moName", "type": "str"}, "statuses": {"key": "properties.statuses", "type": "[ResourceStatus]"}, "custom_resource_name": {"key": "properties.customResourceName", "type": "str"}, + "overall_memory_usage_gb": {"key": "properties.overallMemoryUsageGB", "type": "int"}, + "memory_size_gb": {"key": "properties.memorySizeGB", "type": "int"}, + "overall_cpu_usage_m_hz": {"key": "properties.overallCpuUsageMHz", "type": "int"}, + "cpu_mhz": {"key": "properties.cpuMhz", "type": "int"}, "datastore_ids": {"key": "properties.datastoreIds", "type": "[str]"}, "network_ids": {"key": "properties.networkIds", "type": "[str]"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, @@ -1259,8 +1323,8 @@ def __init__( v_center_id: Optional[str] = None, mo_ref_id: Optional[str] = None, inventory_item_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Gets or sets the location. Required. :paramtype location: str @@ -1296,6 +1360,10 @@ def __init__( self.mo_name = None self.statuses = None self.custom_resource_name = None + self.overall_memory_usage_gb = None + self.memory_size_gb = None + self.overall_cpu_usage_m_hz = None + self.cpu_mhz = None self.datastore_ids = None self.network_ids = None self.provisioning_state = None @@ -1319,8 +1387,9 @@ class HostInventoryItem(InventoryItemProperties): :vartype mo_ref_id: str :ivar mo_name: Gets or sets the vCenter Managed Object name for the inventory item. :vartype mo_name: str - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState :ivar parent: Parent host inventory resource details. :vartype parent: ~azure.mgmt.connectedvmware.models.InventoryItemDetails """ @@ -1346,8 +1415,8 @@ def __init__( mo_ref_id: Optional[str] = None, mo_name: Optional[str] = None, parent: Optional["_models.InventoryItemDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword managed_resource_id: Gets or sets the tracked resource id corresponding to the inventory resource. @@ -1385,7 +1454,7 @@ class HostsList(_serialization.Model): "value": {"key": "value", "type": "[Host]"}, } - def __init__(self, *, value: List["_models.Host"], next_link: Optional[str] = None, **kwargs): + def __init__(self, *, value: List["_models.Host"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: Url to follow for getting next page of Hosts. :paramtype next_link: str @@ -1408,7 +1477,7 @@ class HttpProxyConfiguration(_serialization.Model): "https_proxy": {"key": "httpsProxy", "type": "str"}, } - def __init__(self, *, https_proxy: Optional[str] = None, **kwargs): + def __init__(self, *, https_proxy: Optional[str] = None, **kwargs: Any) -> None: """ :keyword https_proxy: Gets or sets httpsProxy url. :paramtype https_proxy: str @@ -1422,15 +1491,16 @@ class HybridIdentityMetadata(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: The system data. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.connectedvmware.models.SystemData :ivar vm_id: Gets or sets the Vm Id. :vartype vm_id: str @@ -1438,8 +1508,9 @@ class HybridIdentityMetadata(ProxyResource): :vartype public_key: str :ivar identity: The identity of the resource. :vartype identity: ~azure.mgmt.connectedvmware.models.Identity - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState """ _validation = { @@ -1462,7 +1533,7 @@ class HybridIdentityMetadata(ProxyResource): "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, } - def __init__(self, *, vm_id: Optional[str] = None, public_key: Optional[str] = None, **kwargs): + def __init__(self, *, vm_id: Optional[str] = None, public_key: Optional[str] = None, **kwargs: Any) -> None: """ :keyword vm_id: Gets or sets the Vm Id. :paramtype vm_id: str @@ -1470,7 +1541,6 @@ def __init__(self, *, vm_id: Optional[str] = None, public_key: Optional[str] = N :paramtype public_key: str """ super().__init__(**kwargs) - self.system_data = None self.vm_id = vm_id self.public_key = public_key self.identity = None @@ -1497,7 +1567,9 @@ class HybridIdentityMetadataList(_serialization.Model): "value": {"key": "value", "type": "[HybridIdentityMetadata]"}, } - def __init__(self, *, value: List["_models.HybridIdentityMetadata"], next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: List["_models.HybridIdentityMetadata"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword next_link: Url to follow for getting next page of HybridIdentityMetadata. :paramtype next_link: str @@ -1537,7 +1609,7 @@ class Identity(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: Union[str, "_models.IdentityType"], **kwargs): + def __init__(self, *, type: Union[str, "_models.IdentityType"], **kwargs: Any) -> None: """ :keyword type: The type of managed service identity. Required. Known values are: "None" and "SystemAssigned". @@ -1549,6 +1621,94 @@ def __init__(self, *, type: Union[str, "_models.IdentityType"], **kwargs): self.type = type +class InfrastructureProfile(_serialization.Model): + """Specifies the vCenter infrastructure specific settings for the virtual machine. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar template_id: Gets or sets the ARM Id of the template resource to deploy the virtual + machine. + :vartype template_id: str + :ivar v_center_id: Gets or sets the ARM Id of the vCenter resource in which this resource pool + resides. + :vartype v_center_id: str + :ivar mo_ref_id: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the virtual + machine. + :vartype mo_ref_id: str + :ivar inventory_item_id: Gets or sets the inventory Item ID for the virtual machine. + :vartype inventory_item_id: str + :ivar mo_name: Gets or sets the vCenter Managed Object name for the virtual machine. + :vartype mo_name: str + :ivar folder_path: Gets or sets the folder path of the vm. + :vartype folder_path: str + :ivar instance_uuid: Gets or sets the instance uuid of the vm. + :vartype instance_uuid: str + :ivar smbios_uuid: Gets or sets the SMBIOS UUID of the vm. + :vartype smbios_uuid: str + :ivar firmware_type: Firmware type. Known values are: "bios" and "efi". + :vartype firmware_type: str or ~azure.mgmt.connectedvmware.models.FirmwareType + :ivar custom_resource_name: Gets the name of the corresponding resource in Kubernetes. + :vartype custom_resource_name: str + """ + + _validation = { + "mo_ref_id": {"readonly": True}, + "mo_name": {"readonly": True}, + "folder_path": {"readonly": True}, + "instance_uuid": {"readonly": True}, + "custom_resource_name": {"readonly": True}, + } + + _attribute_map = { + "template_id": {"key": "templateId", "type": "str"}, + "v_center_id": {"key": "vCenterId", "type": "str"}, + "mo_ref_id": {"key": "moRefId", "type": "str"}, + "inventory_item_id": {"key": "inventoryItemId", "type": "str"}, + "mo_name": {"key": "moName", "type": "str"}, + "folder_path": {"key": "folderPath", "type": "str"}, + "instance_uuid": {"key": "instanceUuid", "type": "str"}, + "smbios_uuid": {"key": "smbiosUuid", "type": "str"}, + "firmware_type": {"key": "firmwareType", "type": "str"}, + "custom_resource_name": {"key": "customResourceName", "type": "str"}, + } + + def __init__( + self, + *, + template_id: Optional[str] = None, + v_center_id: Optional[str] = None, + inventory_item_id: Optional[str] = None, + smbios_uuid: Optional[str] = None, + firmware_type: Optional[Union[str, "_models.FirmwareType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword template_id: Gets or sets the ARM Id of the template resource to deploy the virtual + machine. + :paramtype template_id: str + :keyword v_center_id: Gets or sets the ARM Id of the vCenter resource in which this resource + pool resides. + :paramtype v_center_id: str + :keyword inventory_item_id: Gets or sets the inventory Item ID for the virtual machine. + :paramtype inventory_item_id: str + :keyword smbios_uuid: Gets or sets the SMBIOS UUID of the vm. + :paramtype smbios_uuid: str + :keyword firmware_type: Firmware type. Known values are: "bios" and "efi". + :paramtype firmware_type: str or ~azure.mgmt.connectedvmware.models.FirmwareType + """ + super().__init__(**kwargs) + self.template_id = template_id + self.v_center_id = v_center_id + self.mo_ref_id = None + self.inventory_item_id = inventory_item_id + self.mo_name = None + self.folder_path = None + self.instance_uuid = None + self.smbios_uuid = smbios_uuid + self.firmware_type = firmware_type + self.custom_resource_name = None + + class InventoryItem(ProxyResource): """Defines the inventory item. @@ -1556,15 +1716,16 @@ class InventoryItem(ProxyResource): All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: The system data. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.connectedvmware.models.SystemData :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, @@ -1581,8 +1742,9 @@ class InventoryItem(ProxyResource): :vartype mo_ref_id: str :ivar mo_name: Gets or sets the vCenter Managed Object name for the inventory item. :vartype mo_name: str - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState """ _validation = { @@ -1614,8 +1776,8 @@ def __init__( managed_resource_id: Optional[str] = None, mo_ref_id: Optional[str] = None, mo_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword kind: Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, @@ -1631,7 +1793,6 @@ def __init__( :paramtype mo_name: str """ super().__init__(**kwargs) - self.system_data = None self.kind = kind self.inventory_type: Optional[str] = None self.managed_resource_id = managed_resource_id @@ -1664,8 +1825,8 @@ def __init__( inventory_item_id: Optional[str] = None, mo_name: Optional[str] = None, inventory_type: Optional[Union[str, "_models.InventoryType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword inventory_item_id: Gets or sets the inventory Item ID for the resource. :paramtype inventory_item_id: str @@ -1702,7 +1863,7 @@ class InventoryItemsList(_serialization.Model): "value": {"key": "value", "type": "[InventoryItem]"}, } - def __init__(self, *, value: List["_models.InventoryItem"], next_link: Optional[str] = None, **kwargs): + def __init__(self, *, value: List["_models.InventoryItem"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: Url to follow for getting next page of InventoryItems. :paramtype next_link: str @@ -1741,8 +1902,8 @@ def __init__( classifications_to_include: Optional[List[Union[str, "_models.VMGuestPatchClassificationLinux"]]] = None, package_name_masks_to_include: Optional[List[str]] = None, package_name_masks_to_exclude: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword classifications_to_include: The update classifications to select when installing patches for Linux. @@ -1848,8 +2009,8 @@ def __init__( settings: Optional[JSON] = None, protected_settings: Optional[JSON] = None, instance_view: Optional["_models.MachineExtensionPropertiesInstanceView"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Gets or sets the location. :paramtype location: str @@ -1928,7 +2089,7 @@ class MachineExtensionInstanceView(_serialization.Model): "status": {"key": "status", "type": "MachineExtensionInstanceViewStatus"}, } - def __init__(self, *, status: Optional["_models.MachineExtensionInstanceViewStatus"] = None, **kwargs): + def __init__(self, *, status: Optional["_models.MachineExtensionInstanceViewStatus"] = None, **kwargs: Any) -> None: """ :keyword status: Instance view status. :paramtype status: ~azure.mgmt.connectedvmware.models.MachineExtensionInstanceViewStatus @@ -1973,7 +2134,7 @@ class MachineExtensionInstanceViewStatus(_serialization.Model): "time": {"key": "time", "type": "iso-8601"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -2011,7 +2172,7 @@ class MachineExtensionPropertiesInstanceView(MachineExtensionInstanceView): "status": {"key": "status", "type": "MachineExtensionInstanceViewStatus"}, } - def __init__(self, *, status: Optional["_models.MachineExtensionInstanceViewStatus"] = None, **kwargs): + def __init__(self, *, status: Optional["_models.MachineExtensionInstanceViewStatus"] = None, **kwargs: Any) -> None: """ :keyword status: Instance view status. :paramtype status: ~azure.mgmt.connectedvmware.models.MachineExtensionInstanceViewStatus @@ -2035,8 +2196,12 @@ class MachineExtensionsListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.MachineExtension"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.MachineExtension"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: The list of extensions. :paramtype value: list[~azure.mgmt.connectedvmware.models.MachineExtension] @@ -2060,7 +2225,7 @@ class ResourcePatch(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -2121,8 +2286,8 @@ def __init__( auto_upgrade_minor_version: Optional[bool] = None, settings: Optional[JSON] = None, protected_settings: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -2171,7 +2336,9 @@ class MachineExtensionUpgrade(_serialization.Model): "extension_targets": {"key": "extensionTargets", "type": "{ExtensionTargetProperties}"}, } - def __init__(self, *, extension_targets: Optional[Dict[str, "_models.ExtensionTargetProperties"]] = None, **kwargs): + def __init__( + self, *, extension_targets: Optional[Dict[str, "_models.ExtensionTargetProperties"]] = None, **kwargs: Any + ) -> None: """ :keyword extension_targets: Describes the Extension Target Properties. :paramtype extension_targets: dict[str, @@ -2248,8 +2415,8 @@ def __init__( power_on_boot: Optional[Union[str, "_models.PowerOnBootOption"]] = None, device_key: Optional[int] = None, ip_settings: Optional["_models.NicIPSettings"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the network interface. :paramtype name: str @@ -2315,8 +2482,8 @@ def __init__( nic_type: Optional[Union[str, "_models.NICType"]] = None, power_on_boot: Optional[Union[str, "_models.PowerOnBootOption"]] = None, device_key: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the network interface. :paramtype name: str @@ -2352,7 +2519,7 @@ class NetworkProfile(_serialization.Model): "network_interfaces": {"key": "networkInterfaces", "type": "[NetworkInterface]"}, } - def __init__(self, *, network_interfaces: Optional[List["_models.NetworkInterface"]] = None, **kwargs): + def __init__(self, *, network_interfaces: Optional[List["_models.NetworkInterface"]] = None, **kwargs: Any) -> None: """ :keyword network_interfaces: Gets or sets the list of network interfaces associated with the virtual machine. @@ -2374,7 +2541,9 @@ class NetworkProfileUpdate(_serialization.Model): "network_interfaces": {"key": "networkInterfaces", "type": "[NetworkInterfaceUpdate]"}, } - def __init__(self, *, network_interfaces: Optional[List["_models.NetworkInterfaceUpdate"]] = None, **kwargs): + def __init__( + self, *, network_interfaces: Optional[List["_models.NetworkInterfaceUpdate"]] = None, **kwargs: Any + ) -> None: """ :keyword network_interfaces: Gets or sets the list of network interfaces associated with the virtual machine. @@ -2409,7 +2578,7 @@ class NicIPAddressSettings(_serialization.Model): "subnet_mask": {"key": "subnetMask", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.allocation_method = None @@ -2467,8 +2636,8 @@ def __init__( gateway: Optional[List[str]] = None, ip_address: Optional[str] = None, subnet_mask: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword allocation_method: Gets or sets the nic allocation method. Known values are: "unset", "dynamic", "static", "linklayer", "random", and "other". @@ -2517,8 +2686,8 @@ def __init__( name: Optional[str] = None, is_data_action: Optional[bool] = None, display: Optional["_models.OperationDisplay"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name of the operation. :paramtype name: str @@ -2560,8 +2729,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Provider name. :paramtype provider: str @@ -2599,7 +2768,7 @@ class OperationsList(_serialization.Model): "value": {"key": "value", "type": "[Operation]"}, } - def __init__(self, *, value: List["_models.Operation"], next_link: Optional[str] = None, **kwargs): + def __init__(self, *, value: List["_models.Operation"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: Url to follow for getting next page of operations. :paramtype next_link: str @@ -2680,8 +2849,8 @@ def __init__( os_type: Optional[Union[str, "_models.OsType"]] = None, windows_configuration: Optional["_models.OsProfileWindowsConfiguration"] = None, linux_configuration: Optional["_models.OsProfileLinuxConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword computer_name: Gets or sets computer name. :paramtype computer_name: str @@ -2715,6 +2884,88 @@ def __init__( self.linux_configuration = linux_configuration +class OsProfileForVMInstance(_serialization.Model): + """Specifies the operating system settings for the virtual machine. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar computer_name: Gets or sets computer name. + :vartype computer_name: str + :ivar admin_username: Gets or sets administrator username. + :vartype admin_username: str + :ivar admin_password: Sets administrator password. + :vartype admin_password: str + :ivar guest_id: Gets or sets the guestId. + :vartype guest_id: str + :ivar os_type: Gets or sets the type of the os. Known values are: "Windows", "Linux", and + "Other". + :vartype os_type: str or ~azure.mgmt.connectedvmware.models.OsType + :ivar os_sku: Gets or sets os sku. + :vartype os_sku: str + :ivar tools_running_status: Gets or sets the current running status of VMware Tools running in + the guest operating system. + :vartype tools_running_status: str + :ivar tools_version_status: Gets or sets the current version status of VMware Tools installed + in the guest operating system. + :vartype tools_version_status: str + :ivar tools_version: Gets or sets the current version of VMware Tools. + :vartype tools_version: str + """ + + _validation = { + "os_sku": {"readonly": True}, + "tools_running_status": {"readonly": True}, + "tools_version_status": {"readonly": True}, + "tools_version": {"readonly": True}, + } + + _attribute_map = { + "computer_name": {"key": "computerName", "type": "str"}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, + "guest_id": {"key": "guestId", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSku", "type": "str"}, + "tools_running_status": {"key": "toolsRunningStatus", "type": "str"}, + "tools_version_status": {"key": "toolsVersionStatus", "type": "str"}, + "tools_version": {"key": "toolsVersion", "type": "str"}, + } + + def __init__( + self, + *, + computer_name: Optional[str] = None, + admin_username: Optional[str] = None, + admin_password: Optional[str] = None, + guest_id: Optional[str] = None, + os_type: Optional[Union[str, "_models.OsType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword computer_name: Gets or sets computer name. + :paramtype computer_name: str + :keyword admin_username: Gets or sets administrator username. + :paramtype admin_username: str + :keyword admin_password: Sets administrator password. + :paramtype admin_password: str + :keyword guest_id: Gets or sets the guestId. + :paramtype guest_id: str + :keyword os_type: Gets or sets the type of the os. Known values are: "Windows", "Linux", and + "Other". + :paramtype os_type: str or ~azure.mgmt.connectedvmware.models.OsType + """ + super().__init__(**kwargs) + self.computer_name = computer_name + self.admin_username = admin_username + self.admin_password = admin_password + self.guest_id = guest_id + self.os_type = os_type + self.os_sku = None + self.tools_running_status = None + self.tools_version_status = None + self.tools_version = None + + class OsProfileLinuxConfiguration(_serialization.Model): """Specifies the linux configuration for update management. @@ -2729,7 +2980,9 @@ class OsProfileLinuxConfiguration(_serialization.Model): "patch_mode": {"key": "patchSettings.patchMode", "type": "str"}, } - def __init__(self, *, assessment_mode: Optional[str] = None, patch_mode: Optional[str] = None, **kwargs): + def __init__( + self, *, assessment_mode: Optional[str] = None, patch_mode: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword assessment_mode: Specifies the assessment mode. :paramtype assessment_mode: str @@ -2762,8 +3015,8 @@ def __init__( *, windows_configuration: Optional["_models.OsProfileUpdateWindowsConfiguration"] = None, linux_configuration: Optional["_models.OsProfileUpdateLinuxConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword windows_configuration: Specifies the windows configuration for update management. :paramtype windows_configuration: @@ -2791,7 +3044,9 @@ class OsProfileUpdateLinuxConfiguration(_serialization.Model): "patch_mode": {"key": "patchSettings.patchMode", "type": "str"}, } - def __init__(self, *, assessment_mode: Optional[str] = None, patch_mode: Optional[str] = None, **kwargs): + def __init__( + self, *, assessment_mode: Optional[str] = None, patch_mode: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword assessment_mode: Specifies the assessment mode. :paramtype assessment_mode: str @@ -2817,7 +3072,9 @@ class OsProfileUpdateWindowsConfiguration(_serialization.Model): "patch_mode": {"key": "patchSettings.patchMode", "type": "str"}, } - def __init__(self, *, assessment_mode: Optional[str] = None, patch_mode: Optional[str] = None, **kwargs): + def __init__( + self, *, assessment_mode: Optional[str] = None, patch_mode: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword assessment_mode: Specifies the assessment mode. :paramtype assessment_mode: str @@ -2843,7 +3100,9 @@ class OsProfileWindowsConfiguration(_serialization.Model): "patch_mode": {"key": "patchSettings.patchMode", "type": "str"}, } - def __init__(self, *, assessment_mode: Optional[str] = None, patch_mode: Optional[str] = None, **kwargs): + def __init__( + self, *, assessment_mode: Optional[str] = None, patch_mode: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword assessment_mode: Specifies the assessment mode. :paramtype assessment_mode: str @@ -2886,8 +3145,8 @@ def __init__( cluster_id: Optional[str] = None, host_id: Optional[str] = None, datastore_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_pool_id: Gets or sets the ARM Id of the resourcePool resource on which this virtual machine will deploy. @@ -2968,16 +3227,25 @@ class ResourcePool(_serialization.Model): # pylint: disable=too-many-instance-a :ivar mem_limit_mb: Gets or sets MemLimitMB specifies a memory usage limit in megabytes. Utilization will not exceed the specified limit even if there are available resources. :vartype mem_limit_mb: int + :ivar mem_overall_usage_gb: Gets the used physical memory on the pool in GB. + :vartype mem_overall_usage_gb: int + :ivar mem_capacity_gb: Gets the total amount of physical memory on the pool in GB. + :vartype mem_capacity_gb: int + :ivar cpu_overall_usage_m_hz: Gets the used CPU usage across all cores on the pool in MHz. + :vartype cpu_overall_usage_m_hz: int + :ivar cpu_capacity_m_hz: Gets the max CPU usage across all cores on the pool in MHz. + :vartype cpu_capacity_m_hz: int :ivar custom_resource_name: Gets the name of the corresponding resource in Kubernetes. :vartype custom_resource_name: str - :ivar datastore_ids: Gets or sets the datastore ARM ids. + :ivar datastore_ids: Gets the datastore ARM ids. :vartype datastore_ids: list[str] - :ivar network_ids: Gets or sets the network ARM ids. + :ivar network_ids: Gets the network ARM ids. :vartype network_ids: list[str] :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.connectedvmware.models.ResourceStatus] - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState """ _validation = { @@ -2994,6 +3262,10 @@ class ResourcePool(_serialization.Model): # pylint: disable=too-many-instance-a "mem_shares_level": {"readonly": True}, "mem_reservation_mb": {"readonly": True}, "mem_limit_mb": {"readonly": True}, + "mem_overall_usage_gb": {"readonly": True}, + "mem_capacity_gb": {"readonly": True}, + "cpu_overall_usage_m_hz": {"readonly": True}, + "cpu_capacity_m_hz": {"readonly": True}, "custom_resource_name": {"readonly": True}, "datastore_ids": {"readonly": True}, "network_ids": {"readonly": True}, @@ -3021,6 +3293,10 @@ class ResourcePool(_serialization.Model): # pylint: disable=too-many-instance-a "mem_shares_level": {"key": "properties.memSharesLevel", "type": "str"}, "mem_reservation_mb": {"key": "properties.memReservationMB", "type": "int"}, "mem_limit_mb": {"key": "properties.memLimitMB", "type": "int"}, + "mem_overall_usage_gb": {"key": "properties.memOverallUsageGB", "type": "int"}, + "mem_capacity_gb": {"key": "properties.memCapacityGB", "type": "int"}, + "cpu_overall_usage_m_hz": {"key": "properties.cpuOverallUsageMHz", "type": "int"}, + "cpu_capacity_m_hz": {"key": "properties.cpuCapacityMHz", "type": "int"}, "custom_resource_name": {"key": "properties.customResourceName", "type": "str"}, "datastore_ids": {"key": "properties.datastoreIds", "type": "[str]"}, "network_ids": {"key": "properties.networkIds", "type": "[str]"}, @@ -3038,8 +3314,8 @@ def __init__( # pylint: disable=too-many-locals v_center_id: Optional[str] = None, mo_ref_id: Optional[str] = None, inventory_item_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Gets or sets the location. Required. :paramtype location: str @@ -3080,6 +3356,10 @@ def __init__( # pylint: disable=too-many-locals self.mem_shares_level = None self.mem_reservation_mb = None self.mem_limit_mb = None + self.mem_overall_usage_gb = None + self.mem_capacity_gb = None + self.cpu_overall_usage_m_hz = None + self.cpu_capacity_m_hz = None self.custom_resource_name = None self.datastore_ids = None self.network_ids = None @@ -3105,8 +3385,9 @@ class ResourcePoolInventoryItem(InventoryItemProperties): :vartype mo_ref_id: str :ivar mo_name: Gets or sets the vCenter Managed Object name for the inventory item. :vartype mo_name: str - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState :ivar parent: Parent resourcePool inventory resource details. :vartype parent: ~azure.mgmt.connectedvmware.models.InventoryItemDetails """ @@ -3132,8 +3413,8 @@ def __init__( mo_ref_id: Optional[str] = None, mo_name: Optional[str] = None, parent: Optional["_models.InventoryItemDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword managed_resource_id: Gets or sets the tracked resource id corresponding to the inventory resource. @@ -3171,7 +3452,7 @@ class ResourcePoolsList(_serialization.Model): "value": {"key": "value", "type": "[ResourcePool]"}, } - def __init__(self, *, value: List["_models.ResourcePool"], next_link: Optional[str] = None, **kwargs): + def __init__(self, *, value: List["_models.ResourcePool"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: Url to follow for getting next page of ResourcePools. :paramtype next_link: str @@ -3220,7 +3501,7 @@ class ResourceStatus(_serialization.Model): "last_updated_at": {"key": "lastUpdatedAt", "type": "iso-8601"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -3243,7 +3524,7 @@ class SecurityProfile(_serialization.Model): "uefi_settings": {"key": "uefiSettings", "type": "UefiSettings"}, } - def __init__(self, *, uefi_settings: Optional["_models.UefiSettings"] = None, **kwargs): + def __init__(self, *, uefi_settings: Optional["_models.UefiSettings"] = None, **kwargs: Any) -> None: """ :keyword uefi_settings: Specifies the security settings like secure boot used while creating the virtual machine. @@ -3266,7 +3547,7 @@ class StopVirtualMachineOptions(_serialization.Model): "skip_shutdown": {"key": "skipShutdown", "type": "bool"}, } - def __init__(self, *, skip_shutdown: bool = False, **kwargs): + def __init__(self, *, skip_shutdown: bool = False, **kwargs: Any) -> None: """ :keyword skip_shutdown: Gets or sets a value indicating whether to request non-graceful VM shutdown. True value for this flag indicates non-graceful shutdown whereas false indicates @@ -3298,7 +3579,7 @@ class StorageProfile(_serialization.Model): "scsi_controllers": {"key": "scsiControllers", "type": "[VirtualSCSIController]"}, } - def __init__(self, *, disks: Optional[List["_models.VirtualDisk"]] = None, **kwargs): + def __init__(self, *, disks: Optional[List["_models.VirtualDisk"]] = None, **kwargs: Any) -> None: """ :keyword disks: Gets or sets the list of virtual disks associated with the virtual machine. :paramtype disks: list[~azure.mgmt.connectedvmware.models.VirtualDisk] @@ -3319,7 +3600,7 @@ class StorageProfileUpdate(_serialization.Model): "disks": {"key": "disks", "type": "[VirtualDiskUpdate]"}, } - def __init__(self, *, disks: Optional[List["_models.VirtualDiskUpdate"]] = None, **kwargs): + def __init__(self, *, disks: Optional[List["_models.VirtualDiskUpdate"]] = None, **kwargs: Any) -> None: """ :keyword disks: Gets or sets the list of virtual disks associated with the virtual machine. :paramtype disks: list[~azure.mgmt.connectedvmware.models.VirtualDiskUpdate] @@ -3365,8 +3646,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -3404,7 +3685,7 @@ class UefiSettings(_serialization.Model): "secure_boot_enabled": {"key": "secureBootEnabled", "type": "bool"}, } - def __init__(self, *, secure_boot_enabled: Optional[bool] = None, **kwargs): + def __init__(self, *, secure_boot_enabled: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword secure_boot_enabled: Specifies whether secure boot should be enabled on the virtual machine. @@ -3457,8 +3738,9 @@ class VCenter(_serialization.Model): # pylint: disable=too-many-instance-attrib :vartype credentials: ~azure.mgmt.connectedvmware.models.VICredential :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.connectedvmware.models.ResourceStatus] - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState """ _validation = { @@ -3509,8 +3791,8 @@ def __init__( kind: Optional[str] = None, port: Optional[int] = None, credentials: Optional["_models.VICredential"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Gets or sets the location. Required. :paramtype location: str @@ -3570,7 +3852,7 @@ class VCentersList(_serialization.Model): "value": {"key": "value", "type": "[VCenter]"}, } - def __init__(self, *, value: List["_models.VCenter"], next_link: Optional[str] = None, **kwargs): + def __init__(self, *, value: List["_models.VCenter"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: Url to follow for getting next page of VCenters. :paramtype next_link: str @@ -3596,7 +3878,7 @@ class VICredential(_serialization.Model): "password": {"key": "password", "type": "str"}, } - def __init__(self, *, username: Optional[str] = None, password: Optional[str] = None, **kwargs): + def __init__(self, *, username: Optional[str] = None, password: Optional[str] = None, **kwargs: Any) -> None: """ :keyword username: Gets or sets username to connect with the vCenter. :paramtype username: str @@ -3666,8 +3948,8 @@ def __init__( unit_number: Optional[int] = None, device_name: Optional[str] = None, disk_type: Optional[Union[str, "_models.DiskType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the virtual disk. :paramtype name: str @@ -3746,8 +4028,8 @@ def __init__( unit_number: Optional[int] = None, device_name: Optional[str] = None, disk_type: Optional[Union[str, "_models.DiskType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the virtual disk. :paramtype name: str @@ -3853,8 +4135,9 @@ class VirtualMachine(_serialization.Model): # pylint: disable=too-many-instance :vartype uuid: str :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.connectedvmware.models.ResourceStatus] - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState :ivar vm_id: Gets or sets a unique identifier for the vm resource. :vartype vm_id: str """ @@ -3933,8 +4216,8 @@ def __init__( # pylint: disable=too-many-locals inventory_item_id: Optional[str] = None, smbios_uuid: Optional[str] = None, firmware_type: Optional[Union[str, "_models.FirmwareType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Gets or sets the location. Required. :paramtype location: str @@ -4087,8 +4370,8 @@ def __init__( self, *, available_patch_count_by_classification: Optional["_models.AvailablePatchCountByClassification"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword available_patch_count_by_classification: Summarization of patches available for installation on the machine by classification. @@ -4146,8 +4429,8 @@ def __init__( reboot_setting: Union[str, "_models.VMGuestPatchRebootSetting"], windows_parameters: Optional["_models.WindowsParameters"] = None, linux_parameters: Optional["_models.LinuxParameters"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword maximum_duration: Specifies the maximum amount of time that the operation will run. It must be an ISO 8601-compliant duration string such as PT4H (4 hours). Required. @@ -4256,7 +4539,7 @@ class VirtualMachineInstallPatchesResult(_serialization.Model): # pylint: disab "error_details": {"key": "errorDetails", "type": "ErrorDetail"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.status = None @@ -4276,6 +4559,198 @@ def __init__(self, **kwargs): self.error_details = None +class VirtualMachineInstance(ProxyResource): # pylint: disable=too-many-instance-attributes + """Define the virtualMachineInstance. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.connectedvmware.models.SystemData + :ivar extended_location: Gets or sets the extended location. + :vartype extended_location: ~azure.mgmt.connectedvmware.models.ExtendedLocation + :ivar placement_profile: Placement properties. + :vartype placement_profile: ~azure.mgmt.connectedvmware.models.PlacementProfile + :ivar os_profile: OS properties. + :vartype os_profile: ~azure.mgmt.connectedvmware.models.OsProfileForVMInstance + :ivar hardware_profile: Hardware properties. + :vartype hardware_profile: ~azure.mgmt.connectedvmware.models.HardwareProfile + :ivar network_profile: Network properties. + :vartype network_profile: ~azure.mgmt.connectedvmware.models.NetworkProfile + :ivar storage_profile: Storage properties. + :vartype storage_profile: ~azure.mgmt.connectedvmware.models.StorageProfile + :ivar security_profile: Gets the security profile. + :vartype security_profile: ~azure.mgmt.connectedvmware.models.SecurityProfile + :ivar infrastructure_profile: Gets the infrastructure profile. + :vartype infrastructure_profile: ~azure.mgmt.connectedvmware.models.InfrastructureProfile + :ivar power_state: Gets the power state of the virtual machine. + :vartype power_state: str + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.connectedvmware.models.ResourceStatus] + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState + :ivar resource_uid: Gets or sets a unique identifier for the vm resource. + :vartype resource_uid: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "power_state": {"readonly": True}, + "statuses": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "resource_uid": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "placement_profile": {"key": "properties.placementProfile", "type": "PlacementProfile"}, + "os_profile": {"key": "properties.osProfile", "type": "OsProfileForVMInstance"}, + "hardware_profile": {"key": "properties.hardwareProfile", "type": "HardwareProfile"}, + "network_profile": {"key": "properties.networkProfile", "type": "NetworkProfile"}, + "storage_profile": {"key": "properties.storageProfile", "type": "StorageProfile"}, + "security_profile": {"key": "properties.securityProfile", "type": "SecurityProfile"}, + "infrastructure_profile": {"key": "properties.infrastructureProfile", "type": "InfrastructureProfile"}, + "power_state": {"key": "properties.powerState", "type": "str"}, + "statuses": {"key": "properties.statuses", "type": "[ResourceStatus]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "resource_uid": {"key": "properties.resourceUid", "type": "str"}, + } + + def __init__( + self, + *, + extended_location: Optional["_models.ExtendedLocation"] = None, + placement_profile: Optional["_models.PlacementProfile"] = None, + os_profile: Optional["_models.OsProfileForVMInstance"] = None, + hardware_profile: Optional["_models.HardwareProfile"] = None, + network_profile: Optional["_models.NetworkProfile"] = None, + storage_profile: Optional["_models.StorageProfile"] = None, + security_profile: Optional["_models.SecurityProfile"] = None, + infrastructure_profile: Optional["_models.InfrastructureProfile"] = None, + **kwargs: Any + ) -> None: + """ + :keyword extended_location: Gets or sets the extended location. + :paramtype extended_location: ~azure.mgmt.connectedvmware.models.ExtendedLocation + :keyword placement_profile: Placement properties. + :paramtype placement_profile: ~azure.mgmt.connectedvmware.models.PlacementProfile + :keyword os_profile: OS properties. + :paramtype os_profile: ~azure.mgmt.connectedvmware.models.OsProfileForVMInstance + :keyword hardware_profile: Hardware properties. + :paramtype hardware_profile: ~azure.mgmt.connectedvmware.models.HardwareProfile + :keyword network_profile: Network properties. + :paramtype network_profile: ~azure.mgmt.connectedvmware.models.NetworkProfile + :keyword storage_profile: Storage properties. + :paramtype storage_profile: ~azure.mgmt.connectedvmware.models.StorageProfile + :keyword security_profile: Gets the security profile. + :paramtype security_profile: ~azure.mgmt.connectedvmware.models.SecurityProfile + :keyword infrastructure_profile: Gets the infrastructure profile. + :paramtype infrastructure_profile: ~azure.mgmt.connectedvmware.models.InfrastructureProfile + """ + super().__init__(**kwargs) + self.extended_location = extended_location + self.placement_profile = placement_profile + self.os_profile = os_profile + self.hardware_profile = hardware_profile + self.network_profile = network_profile + self.storage_profile = storage_profile + self.security_profile = security_profile + self.infrastructure_profile = infrastructure_profile + self.power_state = None + self.statuses = None + self.provisioning_state = None + self.resource_uid = None + + +class VirtualMachineInstancesList(_serialization.Model): + """List of VirtualMachineInstances. + + All required parameters must be populated in order to send to Azure. + + :ivar next_link: Url to follow for getting next page of VirtualMachines. + :vartype next_link: str + :ivar value: Array of VirtualMachines. Required. + :vartype value: list[~azure.mgmt.connectedvmware.models.VirtualMachineInstance] + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[VirtualMachineInstance]"}, + } + + def __init__( + self, *, value: List["_models.VirtualMachineInstance"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword next_link: Url to follow for getting next page of VirtualMachines. + :paramtype next_link: str + :keyword value: Array of VirtualMachines. Required. + :paramtype value: list[~azure.mgmt.connectedvmware.models.VirtualMachineInstance] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class VirtualMachineInstanceUpdate(_serialization.Model): + """Defines the virtualMachineInstanceUpdate. + + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.connectedvmware.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.connectedvmware.models.StorageProfileUpdate + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.connectedvmware.models.NetworkProfileUpdate + """ + + _attribute_map = { + "hardware_profile": {"key": "properties.hardwareProfile", "type": "HardwareProfile"}, + "storage_profile": {"key": "properties.storageProfile", "type": "StorageProfileUpdate"}, + "network_profile": {"key": "properties.networkProfile", "type": "NetworkProfileUpdate"}, + } + + def __init__( + self, + *, + hardware_profile: Optional["_models.HardwareProfile"] = None, + storage_profile: Optional["_models.StorageProfileUpdate"] = None, + network_profile: Optional["_models.NetworkProfileUpdate"] = None, + **kwargs: Any + ) -> None: + """ + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.connectedvmware.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.connectedvmware.models.StorageProfileUpdate + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.connectedvmware.models.NetworkProfileUpdate + """ + super().__init__(**kwargs) + self.hardware_profile = hardware_profile + self.storage_profile = storage_profile + self.network_profile = network_profile + + class VirtualMachineInventoryItem(InventoryItemProperties): # pylint: disable=too-many-instance-attributes """The VM inventory item. @@ -4294,8 +4769,9 @@ class VirtualMachineInventoryItem(InventoryItemProperties): # pylint: disable=t :vartype mo_ref_id: str :ivar mo_name: Gets or sets the vCenter Managed Object name for the inventory item. :vartype mo_name: str - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState :ivar os_type: Gets or sets the type of the os. Known values are: "Windows", "Linux", and "Other". :vartype os_type: str or ~azure.mgmt.connectedvmware.models.OsType @@ -4372,8 +4848,8 @@ def __init__( cluster: Optional["_models.InventoryItemDetails"] = None, instance_uuid: Optional[str] = None, smbios_uuid: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword managed_resource_id: Gets or sets the tracked resource id corresponding to the inventory resource. @@ -4440,7 +4916,9 @@ class VirtualMachinesList(_serialization.Model): "value": {"key": "value", "type": "[VirtualMachine]"}, } - def __init__(self, *, value: List["_models.VirtualMachine"], next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: List["_models.VirtualMachine"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword next_link: Url to follow for getting next page of VirtualMachines. :paramtype next_link: str @@ -4519,8 +4997,9 @@ class VirtualMachineTemplate(_serialization.Model): # pylint: disable=too-many- :vartype firmware_type: str or ~azure.mgmt.connectedvmware.models.FirmwareType :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.connectedvmware.models.ResourceStatus] - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState """ _validation = { @@ -4587,8 +5066,8 @@ def __init__( # pylint: disable=too-many-locals v_center_id: Optional[str] = None, mo_ref_id: Optional[str] = None, inventory_item_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Gets or sets the location. Required. :paramtype location: str @@ -4659,8 +5138,9 @@ class VirtualMachineTemplateInventoryItem(InventoryItemProperties): # pylint: d :vartype mo_ref_id: str :ivar mo_name: Gets or sets the vCenter Managed Object name for the inventory item. :vartype mo_name: str - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState :ivar memory_size_mb: Gets or sets memory size in MBs for the template. :vartype memory_size_mb: int :ivar num_cp_us: Gets or sets the number of vCPUs for the template. @@ -4717,8 +5197,8 @@ def __init__( os_type: Optional[Union[str, "_models.OsType"]] = None, os_name: Optional[str] = None, folder_path: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword managed_resource_id: Gets or sets the tracked resource id corresponding to the inventory resource. @@ -4775,7 +5255,9 @@ class VirtualMachineTemplatesList(_serialization.Model): "value": {"key": "value", "type": "[VirtualMachineTemplate]"}, } - def __init__(self, *, value: List["_models.VirtualMachineTemplate"], next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: List["_models.VirtualMachineTemplate"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword next_link: Url to follow for getting next page of VirtualMachineTemplates. :paramtype next_link: str @@ -4826,8 +5308,8 @@ def __init__( storage_profile: Optional["_models.StorageProfileUpdate"] = None, network_profile: Optional["_models.NetworkProfileUpdate"] = None, guest_agent_profile: Optional["_models.GuestAgentProfileUpdate"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Gets or sets the Resource tags. :paramtype tags: dict[str, str] @@ -4895,8 +5377,9 @@ class VirtualNetwork(_serialization.Model): # pylint: disable=too-many-instance :vartype custom_resource_name: str :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.connectedvmware.models.ResourceStatus] - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState """ _validation = { @@ -4941,8 +5424,8 @@ def __init__( v_center_id: Optional[str] = None, mo_ref_id: Optional[str] = None, inventory_item_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Gets or sets the location. Required. :paramtype location: str @@ -5000,8 +5483,9 @@ class VirtualNetworkInventoryItem(InventoryItemProperties): :vartype mo_ref_id: str :ivar mo_name: Gets or sets the vCenter Managed Object name for the inventory item. :vartype mo_name: str - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState """ _validation = { @@ -5023,8 +5507,8 @@ def __init__( managed_resource_id: Optional[str] = None, mo_ref_id: Optional[str] = None, mo_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword managed_resource_id: Gets or sets the tracked resource id corresponding to the inventory resource. @@ -5059,7 +5543,9 @@ class VirtualNetworksList(_serialization.Model): "value": {"key": "value", "type": "[VirtualNetwork]"}, } - def __init__(self, *, value: List["_models.VirtualNetwork"], next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: List["_models.VirtualNetwork"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword next_link: Url to follow for getting next page of VirtualNetworks. :paramtype next_link: str @@ -5072,7 +5558,8 @@ def __init__(self, *, value: List["_models.VirtualNetwork"], next_link: Optional class VirtualSCSIController(_serialization.Model): - """This data object type contains the properties of a SCSI controller device attached to a virtual machine that is reported by the controller. + """This data object type contains the properties of a SCSI controller device attached to a virtual + machine that is reported by the controller. :ivar type: Gets or sets the controller type. Known values are: "lsilogic", "buslogic", "pvscsi", and "lsilogicsas". @@ -5104,8 +5591,8 @@ def __init__( bus_number: Optional[int] = None, scsi_ctlr_unit_number: Optional[int] = None, sharing: Optional[Union[str, "_models.VirtualSCSISharing"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: Gets or sets the controller type. Known values are: "lsilogic", "buslogic", "pvscsi", and "lsilogicsas". @@ -5128,6 +5615,96 @@ def __init__( self.sharing = sharing +class VmInstanceHybridIdentityMetadata(ProxyResource): + """Defines the HybridIdentityMetadata. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.connectedvmware.models.SystemData + :ivar resource_uid: The unique identifier for the resource. + :vartype resource_uid: str + :ivar public_key: Gets or sets the Public Key. + :vartype public_key: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "resource_uid": {"key": "properties.resourceUid", "type": "str"}, + "public_key": {"key": "properties.publicKey", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__(self, *, resource_uid: Optional[str] = None, public_key: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword resource_uid: The unique identifier for the resource. + :paramtype resource_uid: str + :keyword public_key: Gets or sets the Public Key. + :paramtype public_key: str + """ + super().__init__(**kwargs) + self.resource_uid = resource_uid + self.public_key = public_key + self.provisioning_state = None + + +class VmInstanceHybridIdentityMetadataList(_serialization.Model): + """List of HybridIdentityMetadata. + + All required parameters must be populated in order to send to Azure. + + :ivar next_link: Url to follow for getting next page of HybridIdentityMetadata. + :vartype next_link: str + :ivar value: Array of HybridIdentityMetadata. Required. + :vartype value: list[~azure.mgmt.connectedvmware.models.VmInstanceHybridIdentityMetadata] + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[VmInstanceHybridIdentityMetadata]"}, + } + + def __init__( + self, *, value: List["_models.VmInstanceHybridIdentityMetadata"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword next_link: Url to follow for getting next page of HybridIdentityMetadata. + :paramtype next_link: str + :keyword value: Array of HybridIdentityMetadata. Required. + :paramtype value: list[~azure.mgmt.connectedvmware.models.VmInstanceHybridIdentityMetadata] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + class WindowsParameters(_serialization.Model): """Input for InstallPatches on a Windows VM, as directly received by the API. @@ -5163,8 +5740,8 @@ def __init__( kb_numbers_to_exclude: Optional[List[str]] = None, exclude_kbs_requiring_reboot: Optional[bool] = None, max_patch_publish_date: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword classifications_to_include: The update classifications to select when installing patches for Windows. diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/__init__.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/__init__.py index 5cf879bbc55c..821d45478cd6 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/__init__.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/__init__.py @@ -20,6 +20,9 @@ from ._machine_extensions_operations import MachineExtensionsOperations from ._azure_arc_vmware_management_service_api_operations import AzureArcVMwareManagementServiceAPIOperationsMixin from ._guest_agents_operations import GuestAgentsOperations +from ._virtual_machine_instances_operations import VirtualMachineInstancesOperations +from ._vm_instance_hybrid_identity_metadata_operations import VmInstanceHybridIdentityMetadataOperations +from ._vm_instance_guest_agents_operations import VMInstanceGuestAgentsOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -40,6 +43,9 @@ "MachineExtensionsOperations", "AzureArcVMwareManagementServiceAPIOperationsMixin", "GuestAgentsOperations", + "VirtualMachineInstancesOperations", + "VmInstanceHybridIdentityMetadataOperations", + "VMInstanceGuestAgentsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_azure_arc_vmware_management_service_api_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_azure_arc_vmware_management_service_api_operations.py index f7af63bd36b6..a43fd0c15ab9 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_azure_arc_vmware_management_service_api_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_azure_arc_vmware_management_service_api_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -28,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request, _format_url_section +from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +43,7 @@ def build_upgrade_extensions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -64,7 +58,7 @@ def build_upgrade_extensions_request( "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "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") @@ -96,16 +90,14 @@ def _upgrade_extensions_initial( # pylint: disable=inconsistent-return-statemen _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(extension_upgrade_parameters, (IO, bytes)): + if isinstance(extension_upgrade_parameters, (IOBase, bytes)): _content = extension_upgrade_parameters else: _json = self._serialize.body(extension_upgrade_parameters, "MachineExtensionUpgrade") @@ -125,8 +117,9 @@ def _upgrade_extensions_initial( # pylint: disable=inconsistent-return-statemen request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -136,8 +129,12 @@ def _upgrade_extensions_initial( # pylint: disable=inconsistent-return-statemen error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _upgrade_extensions_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/upgradeExtensions" @@ -228,7 +225,7 @@ def begin_upgrade_extensions( :param virtual_machine_name: The name of the machine containing the extension. Required. :type virtual_machine_name: str :param extension_upgrade_parameters: Parameters supplied to the Upgrade Extensions operation. - Is either a model type or a IO type. Required. + Is either a MachineExtensionUpgrade type or a IO type. Required. :type extension_upgrade_parameters: ~azure.mgmt.connectedvmware.models.MachineExtensionUpgrade or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -249,9 +246,7 @@ def begin_upgrade_extensions( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_clusters_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_clusters_operations.py index fef51f26ce64..4616dd814aba 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_clusters_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_clusters_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request, _format_url_section +from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -66,7 +60,7 @@ def build_create_request( "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "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") @@ -83,9 +77,7 @@ def build_get_request(resource_group_name: str, cluster_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +91,7 @@ def build_get_request(resource_group_name: str, cluster_name: str, subscription_ "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "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") @@ -116,9 +108,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -133,7 +123,7 @@ def build_update_request( "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "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") @@ -152,9 +142,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -168,7 +156,7 @@ def build_delete_request( "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "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") @@ -185,9 +173,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -198,7 +184,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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") @@ -213,9 +199,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -228,7 +212,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "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") @@ -276,16 +260,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Cluster] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -308,8 +290,9 @@ def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -422,7 +405,7 @@ def begin_create( :type resource_group_name: str :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a Cluster type or a IO type. Default value is None. :type body: ~azure.mgmt.connectedvmware.models.Cluster or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -442,9 +425,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Cluster] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -517,9 +498,7 @@ def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Cluster] = kwargs.pop("cls", None) request = build_get_request( @@ -534,8 +513,9 @@ def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _mo request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -630,8 +610,8 @@ def update( :type resource_group_name: str :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param body: Resource properties to update. Is either a model type or a IO type. Default value - is None. + :param body: Resource properties to update. Is either a ResourcePatch type or a IO type. + Default value is None. :type body: ~azure.mgmt.connectedvmware.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -652,16 +632,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Cluster] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -684,8 +662,9 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -720,9 +699,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -738,8 +715,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -749,8 +727,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + 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.ConnectedVMwarevSphere/clusters/{clusterName}" @@ -785,9 +767,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -842,9 +822,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Cluster"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClustersList] = kwargs.pop("cls", None) error_map = { @@ -896,8 +874,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -928,9 +907,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClustersList] = kwargs.pop("cls", None) error_map = { @@ -983,8 +960,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_datastores_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_datastores_operations.py index e36c74629aaf..a4327ea703ec 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_datastores_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_datastores_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request, _format_url_section +from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -66,7 +60,7 @@ def build_create_request( "datastoreName": _SERIALIZER.url("datastore_name", datastore_name, "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") @@ -85,9 +79,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +93,7 @@ def build_get_request( "datastoreName": _SERIALIZER.url("datastore_name", datastore_name, "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") @@ -118,9 +110,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -135,7 +125,7 @@ def build_update_request( "datastoreName": _SERIALIZER.url("datastore_name", datastore_name, "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") @@ -154,9 +144,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -170,7 +158,7 @@ def build_delete_request( "datastoreName": _SERIALIZER.url("datastore_name", datastore_name, "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") @@ -187,9 +175,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -200,7 +186,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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") @@ -215,9 +201,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -230,7 +214,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "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") @@ -278,16 +262,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Datastore] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -310,8 +292,9 @@ def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -424,7 +407,7 @@ def begin_create( :type resource_group_name: str :param datastore_name: Name of the datastore. Required. :type datastore_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a Datastore type or a IO type. Default value is None. :type body: ~azure.mgmt.connectedvmware.models.Datastore or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -444,9 +427,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Datastore] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -519,9 +500,7 @@ def get(self, resource_group_name: str, datastore_name: str, **kwargs: Any) -> _ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Datastore] = kwargs.pop("cls", None) request = build_get_request( @@ -536,8 +515,9 @@ def get(self, resource_group_name: str, datastore_name: str, **kwargs: Any) -> _ request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -632,8 +612,8 @@ def update( :type resource_group_name: str :param datastore_name: Name of the datastore. Required. :type datastore_name: str - :param body: Resource properties to update. Is either a model type or a IO type. Default value - is None. + :param body: Resource properties to update. Is either a ResourcePatch type or a IO type. + Default value is None. :type body: ~azure.mgmt.connectedvmware.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -654,16 +634,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Datastore] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -686,8 +664,9 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -722,9 +701,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -740,8 +717,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -751,8 +729,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + 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.ConnectedVMwarevSphere/datastores/{datastoreName}" @@ -787,9 +769,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -844,9 +824,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Datastore"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DatastoresList] = kwargs.pop("cls", None) error_map = { @@ -898,8 +876,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -930,9 +909,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DatastoresList] = kwargs.pop("cls", None) error_map = { @@ -985,8 +962,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_guest_agents_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_guest_agents_operations.py index 7d2db93cfded..d48f26c533cd 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_guest_agents_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_guest_agents_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request, _format_url_section +from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -67,7 +61,7 @@ def build_create_request( "name": _SERIALIZER.url("name", name, "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") @@ -86,9 +80,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -103,7 +95,7 @@ def build_get_request( "name": _SERIALIZER.url("name", name, "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") @@ -120,9 +112,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -137,7 +127,7 @@ def build_delete_request( "name": _SERIALIZER.url("name", name, "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") @@ -154,9 +144,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -170,7 +158,7 @@ def build_list_request( "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "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") @@ -219,16 +207,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.GuestAgent] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -252,8 +238,9 @@ def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -375,7 +362,7 @@ def begin_create( :type virtual_machine_name: str :param name: Name of the guestAgents. Required. :type name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a GuestAgent type or a IO type. Default value is None. :type body: ~azure.mgmt.connectedvmware.models.GuestAgent or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -395,9 +382,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.GuestAgent] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -473,9 +458,7 @@ def get(self, resource_group_name: str, virtual_machine_name: str, name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GuestAgent] = kwargs.pop("cls", None) request = build_get_request( @@ -491,8 +474,9 @@ def get(self, resource_group_name: str, virtual_machine_name: str, name: str, ** request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -527,9 +511,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -545,8 +527,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -556,8 +539,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + 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.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/guestAgents/{name}" @@ -592,9 +579,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -655,9 +640,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GuestAgentList] = kwargs.pop("cls", None) error_map = { @@ -711,8 +694,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_hosts_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_hosts_operations.py index e57a09e0e4c1..94876aecc2c6 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_hosts_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_hosts_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request, _format_url_section +from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +43,7 @@ def build_create_request(resource_group_name: str, host_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -64,7 +58,7 @@ def build_create_request(resource_group_name: str, host_name: str, subscription_ "hostName": _SERIALIZER.url("host_name", host_name, "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") @@ -81,9 +75,7 @@ def build_get_request(resource_group_name: str, host_name: str, subscription_id: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +89,7 @@ def build_get_request(resource_group_name: str, host_name: str, subscription_id: "hostName": _SERIALIZER.url("host_name", host_name, "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") @@ -112,9 +104,7 @@ def build_update_request(resource_group_name: str, host_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -129,7 +119,7 @@ def build_update_request(resource_group_name: str, host_name: str, subscription_ "hostName": _SERIALIZER.url("host_name", host_name, "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") @@ -148,9 +138,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -164,7 +152,7 @@ def build_delete_request( "hostName": _SERIALIZER.url("host_name", host_name, "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") @@ -181,9 +169,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -194,7 +180,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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") @@ -209,9 +195,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -224,7 +208,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "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") @@ -268,16 +252,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Host] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -300,8 +282,9 @@ def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -410,7 +393,7 @@ def begin_create( :type resource_group_name: str :param host_name: Name of the host. Required. :type host_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a Host type or a IO type. Default value is None. :type body: ~azure.mgmt.connectedvmware.models.Host or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -430,9 +413,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Host] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -505,9 +486,7 @@ def get(self, resource_group_name: str, host_name: str, **kwargs: Any) -> _model _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Host] = kwargs.pop("cls", None) request = build_get_request( @@ -522,8 +501,9 @@ def get(self, resource_group_name: str, host_name: str, **kwargs: Any) -> _model request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -618,8 +598,8 @@ def update( :type resource_group_name: str :param host_name: Name of the host. Required. :type host_name: str - :param body: Resource properties to update. Is either a model type or a IO type. Default value - is None. + :param body: Resource properties to update. Is either a ResourcePatch type or a IO type. + Default value is None. :type body: ~azure.mgmt.connectedvmware.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -640,16 +620,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Host] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -672,8 +650,9 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -708,9 +687,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -726,8 +703,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -737,8 +715,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + 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.ConnectedVMwarevSphere/hosts/{hostName}" @@ -773,9 +755,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -830,9 +810,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Host"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HostsList] = kwargs.pop("cls", None) error_map = { @@ -884,8 +862,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -916,9 +895,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HostsList] = kwargs.pop("cls", None) error_map = { @@ -971,8 +948,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_hybrid_identity_metadata_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_hybrid_identity_metadata_operations.py index 77eb4d3e60f2..3e381ddaecbf 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_hybrid_identity_metadata_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_hybrid_identity_metadata_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -28,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request, _format_url_section +from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +43,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -65,7 +59,7 @@ def build_create_request( "metadataName": _SERIALIZER.url("metadata_name", metadata_name, "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") @@ -84,9 +78,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +93,7 @@ def build_get_request( "metadataName": _SERIALIZER.url("metadata_name", metadata_name, "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") @@ -118,9 +110,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -135,7 +125,7 @@ def build_delete_request( "metadataName": _SERIALIZER.url("metadata_name", metadata_name, "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") @@ -152,9 +142,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -168,7 +156,7 @@ def build_list_request( "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "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") @@ -281,7 +269,8 @@ def create( :type virtual_machine_name: str :param metadata_name: Name of the hybridIdentityMetadata. Required. :type metadata_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a HybridIdentityMetadata type or a IO type. Default + value is None. :type body: ~azure.mgmt.connectedvmware.models.HybridIdentityMetadata or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -302,16 +291,14 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.HybridIdentityMetadata] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -335,8 +322,9 @@ def create( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -387,9 +375,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HybridIdentityMetadata] = kwargs.pop("cls", None) request = build_get_request( @@ -405,8 +391,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -457,9 +444,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -475,8 +460,9 @@ def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -514,9 +500,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HybridIdentityMetadataList] = kwargs.pop("cls", None) error_map = { @@ -570,8 +554,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_inventory_items_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_inventory_items_operations.py index 7a2db774aa94..af8700a7f455 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_inventory_items_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_inventory_items_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -28,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request, _format_url_section +from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +43,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -65,7 +59,7 @@ def build_create_request( "inventoryItemName": _SERIALIZER.url("inventory_item_name", inventory_item_name, "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") @@ -84,9 +78,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +93,7 @@ def build_get_request( "inventoryItemName": _SERIALIZER.url("inventory_item_name", inventory_item_name, "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") @@ -118,9 +110,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -135,7 +125,7 @@ def build_delete_request( "inventoryItemName": _SERIALIZER.url("inventory_item_name", inventory_item_name, "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") @@ -152,9 +142,7 @@ def build_list_by_v_center_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -168,7 +156,7 @@ def build_list_by_v_center_request( "vcenterName": _SERIALIZER.url("vcenter_name", vcenter_name, "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") @@ -281,7 +269,8 @@ def create( :type vcenter_name: str :param inventory_item_name: Name of the inventoryItem. Required. :type inventory_item_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a InventoryItem type or a IO type. Default value is + None. :type body: ~azure.mgmt.connectedvmware.models.InventoryItem or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -302,16 +291,14 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.InventoryItem] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -335,8 +322,9 @@ def create( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -387,9 +375,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.InventoryItem] = kwargs.pop("cls", None) request = build_get_request( @@ -405,8 +391,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -457,9 +444,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -475,8 +460,9 @@ def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -513,9 +499,7 @@ def list_by_v_center( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.InventoryItemsList] = kwargs.pop("cls", None) error_map = { @@ -569,8 +553,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_machine_extensions_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_machine_extensions_operations.py index fe9f7cc6cc63..a09ae0ec4e36 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_machine_extensions_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_machine_extensions_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request, _format_url_section +from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -67,7 +61,7 @@ def build_create_or_update_request( "extensionName": _SERIALIZER.url("extension_name", extension_name, "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") @@ -86,9 +80,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -104,7 +96,7 @@ def build_update_request( "extensionName": _SERIALIZER.url("extension_name", extension_name, "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") @@ -123,9 +115,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -140,7 +130,7 @@ def build_delete_request( "extensionName": _SERIALIZER.url("extension_name", extension_name, "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") @@ -157,9 +147,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -174,7 +162,7 @@ def build_get_request( "extensionName": _SERIALIZER.url("extension_name", extension_name, "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") @@ -196,9 +184,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -212,7 +198,7 @@ def build_list_request( "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "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") @@ -263,16 +249,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.MachineExtension] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(extension_parameters, (IO, bytes)): + if isinstance(extension_parameters, (IOBase, bytes)): _content = extension_parameters else: _json = self._serialize.body(extension_parameters, "MachineExtension") @@ -293,8 +277,9 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -418,7 +403,7 @@ def begin_create_or_update( :param extension_name: The name of the machine extension. Required. :type extension_name: str :param extension_parameters: Parameters supplied to the Create Machine Extension operation. Is - either a model type or a IO type. Required. + either a MachineExtension type or a IO type. Required. :type extension_parameters: ~azure.mgmt.connectedvmware.models.MachineExtension or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -439,9 +424,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.MachineExtension] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -508,16 +491,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.MachineExtension] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(extension_parameters, (IO, bytes)): + if isinstance(extension_parameters, (IOBase, bytes)): _content = extension_parameters else: _json = self._serialize.body(extension_parameters, "MachineExtensionUpdate") @@ -538,8 +519,9 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -663,7 +645,7 @@ def begin_update( :param extension_name: The name of the machine extension. Required. :type extension_name: str :param extension_parameters: Parameters supplied to the Create Machine Extension operation. Is - either a model type or a IO type. Required. + either a MachineExtensionUpdate type or a IO type. Required. :type extension_parameters: ~azure.mgmt.connectedvmware.models.MachineExtensionUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -684,9 +666,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.MachineExtension] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -746,9 +726,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -764,8 +742,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -775,8 +754,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + 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.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/extensions/{extensionName}" @@ -810,9 +793,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -881,9 +862,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MachineExtension] = kwargs.pop("cls", None) request = build_get_request( @@ -899,8 +878,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -941,9 +921,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MachineExtensionsListResult] = kwargs.pop("cls", None) error_map = { @@ -998,8 +976,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_operations.py index 5d8a552260d5..ff97b3fd3b0a 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +40,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,9 +86,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationsList] = kwargs.pop("cls", None) error_map = { @@ -146,8 +137,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_resource_pools_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_resource_pools_operations.py index c63c502c0139..30a88ae82c04 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_resource_pools_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_resource_pools_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request, _format_url_section +from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -66,7 +60,7 @@ def build_create_request( "resourcePoolName": _SERIALIZER.url("resource_pool_name", resource_pool_name, "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") @@ -85,9 +79,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +93,7 @@ def build_get_request( "resourcePoolName": _SERIALIZER.url("resource_pool_name", resource_pool_name, "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") @@ -118,9 +110,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -135,7 +125,7 @@ def build_update_request( "resourcePoolName": _SERIALIZER.url("resource_pool_name", resource_pool_name, "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") @@ -159,9 +149,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -175,7 +163,7 @@ def build_delete_request( "resourcePoolName": _SERIALIZER.url("resource_pool_name", resource_pool_name, "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") @@ -192,9 +180,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -205,7 +191,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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") @@ -220,9 +206,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -235,7 +219,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "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") @@ -283,16 +267,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ResourcePool] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -315,8 +297,9 @@ def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -431,7 +414,8 @@ def begin_create( :type resource_group_name: str :param resource_pool_name: Name of the resourcePool. Required. :type resource_pool_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a ResourcePool type or a IO type. Default value is + None. :type body: ~azure.mgmt.connectedvmware.models.ResourcePool or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -452,9 +436,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ResourcePool] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -527,9 +509,7 @@ def get(self, resource_group_name: str, resource_pool_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResourcePool] = kwargs.pop("cls", None) request = build_get_request( @@ -544,8 +524,9 @@ def get(self, resource_group_name: str, resource_pool_name: str, **kwargs: Any) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -640,8 +621,8 @@ def update( :type resource_group_name: str :param resource_pool_name: Name of the resourcePool. Required. :type resource_pool_name: str - :param body: Resource properties to update. Is either a model type or a IO type. Default value - is None. + :param body: Resource properties to update. Is either a ResourcePatch type or a IO type. + Default value is None. :type body: ~azure.mgmt.connectedvmware.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -662,16 +643,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ResourcePool] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -694,8 +673,9 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -730,9 +710,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -748,8 +726,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -759,8 +738,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + 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.ConnectedVMwarevSphere/resourcePools/{resourcePoolName}" @@ -795,9 +778,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -852,9 +833,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ResourcePool"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResourcePoolsList] = kwargs.pop("cls", None) error_map = { @@ -906,8 +885,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -938,9 +918,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResourcePoolsList] = kwargs.pop("cls", None) error_map = { @@ -993,8 +971,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_vcenters_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_vcenters_operations.py index 161ad15499e1..097907490f06 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_vcenters_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_vcenters_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request, _format_url_section +from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -66,7 +60,7 @@ def build_create_request( "vcenterName": _SERIALIZER.url("vcenter_name", vcenter_name, "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") @@ -83,9 +77,7 @@ def build_get_request(resource_group_name: str, vcenter_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +91,7 @@ def build_get_request(resource_group_name: str, vcenter_name: str, subscription_ "vcenterName": _SERIALIZER.url("vcenter_name", vcenter_name, "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") @@ -116,9 +108,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -133,7 +123,7 @@ def build_update_request( "vcenterName": _SERIALIZER.url("vcenter_name", vcenter_name, "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") @@ -152,9 +142,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -168,7 +156,7 @@ def build_delete_request( "vcenterName": _SERIALIZER.url("vcenter_name", vcenter_name, "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") @@ -185,9 +173,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -198,7 +184,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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") @@ -213,9 +199,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -228,7 +212,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "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") @@ -276,16 +260,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VCenter] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -308,8 +290,9 @@ def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -422,7 +405,7 @@ def begin_create( :type resource_group_name: str :param vcenter_name: Name of the vCenter. Required. :type vcenter_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a VCenter type or a IO type. Default value is None. :type body: ~azure.mgmt.connectedvmware.models.VCenter or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -442,9 +425,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VCenter] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -517,9 +498,7 @@ def get(self, resource_group_name: str, vcenter_name: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VCenter] = kwargs.pop("cls", None) request = build_get_request( @@ -534,8 +513,9 @@ def get(self, resource_group_name: str, vcenter_name: str, **kwargs: Any) -> _mo request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -630,8 +610,8 @@ def update( :type resource_group_name: str :param vcenter_name: Name of the vCenter. Required. :type vcenter_name: str - :param body: Resource properties to update. Is either a model type or a IO type. Default value - is None. + :param body: Resource properties to update. Is either a ResourcePatch type or a IO type. + Default value is None. :type body: ~azure.mgmt.connectedvmware.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -652,16 +632,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VCenter] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -684,8 +662,9 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -720,9 +699,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -738,8 +715,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -749,8 +727,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + 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.ConnectedVMwarevSphere/vcenters/{vcenterName}" @@ -785,9 +767,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -842,9 +822,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.VCenter"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VCentersList] = kwargs.pop("cls", None) error_map = { @@ -896,8 +874,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -928,9 +907,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VCentersList] = kwargs.pop("cls", None) error_map = { @@ -983,8 +960,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_virtual_machine_instances_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_virtual_machine_instances_operations.py new file mode 100644 index 000000000000..fff76b66ed24 --- /dev/null +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_virtual_machine_instances_operations.py @@ -0,0 +1,1423 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# 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 + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_or_update_request(resource_uri: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default" + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(resource_uri: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default" + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request(resource_uri: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default" + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_uri: str, *, delete_from_host: Optional[bool] = None, force: Optional[bool] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default" + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if delete_from_host is not None: + _params["deleteFromHost"] = _SERIALIZER.query("delete_from_host", delete_from_host, "bool") + if force is not None: + _params["force"] = _SERIALIZER.query("force", force, "bool") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request(resource_uri: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances" + ) + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_stop_request(resource_uri: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/stop" + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_start_request(resource_uri: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/start", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restart_request(resource_uri: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/restart", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class VirtualMachineInstancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.connectedvmware.AzureArcVMwareManagementServiceAPI`'s + :attr:`virtual_machine_instances` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _create_or_update_initial( + self, resource_uri: str, body: Optional[Union[_models.VirtualMachineInstance, IO]] = None, **kwargs: Any + ) -> _models.VirtualMachineInstance: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachineInstance] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "VirtualMachineInstance") + else: + _json = None + + request = build_create_or_update_request( + resource_uri=resource_uri, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default" + } + + @overload + def begin_create_or_update( + self, + resource_uri: str, + body: Optional[_models.VirtualMachineInstance] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualMachineInstance]: + """Implements virtual machine PUT method. + + The operation to create or update a virtual machine instance. Please note some properties can + be set only during virtual machine instance creation. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Request payload. Default value is None. + :type body: ~azure.mgmt.connectedvmware.models.VirtualMachineInstance + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either VirtualMachineInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.connectedvmware.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, resource_uri: str, body: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.VirtualMachineInstance]: + """Implements virtual machine PUT method. + + The operation to create or update a virtual machine instance. Please note some properties can + be set only during virtual machine instance creation. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Request payload. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either VirtualMachineInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.connectedvmware.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_uri: str, body: Optional[Union[_models.VirtualMachineInstance, IO]] = None, **kwargs: Any + ) -> LROPoller[_models.VirtualMachineInstance]: + """Implements virtual machine PUT method. + + The operation to create or update a virtual machine instance. Please note some properties can + be set only during virtual machine instance creation. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Request payload. Is either a VirtualMachineInstance type or a IO type. Default + value is None. + :type body: ~azure.mgmt.connectedvmware.models.VirtualMachineInstance or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either VirtualMachineInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.connectedvmware.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachineInstance] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_uri=resource_uri, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default" + } + + @distributed_trace + def get(self, resource_uri: str, **kwargs: Any) -> _models.VirtualMachineInstance: + """Gets a virtual machine. + + Retrieves information about a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineInstance or the result of cls(response) + :rtype: ~azure.mgmt.connectedvmware.models.VirtualMachineInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualMachineInstance] = kwargs.pop("cls", None) + + request = build_get_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {"url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default"} + + def _update_initial( + self, resource_uri: str, body: Optional[Union[_models.VirtualMachineInstanceUpdate, IO]] = None, **kwargs: Any + ) -> Optional[_models.VirtualMachineInstance]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.VirtualMachineInstance]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "VirtualMachineInstanceUpdate") + else: + _json = None + + request = build_update_request( + resource_uri=resource_uri, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default" + } + + @overload + def begin_update( + self, + resource_uri: str, + body: Optional[_models.VirtualMachineInstanceUpdate] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualMachineInstance]: + """Updates a virtual machine. + + The operation to update a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Resource properties to update. Default value is None. + :type body: ~azure.mgmt.connectedvmware.models.VirtualMachineInstanceUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either VirtualMachineInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.connectedvmware.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, resource_uri: str, body: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.VirtualMachineInstance]: + """Updates a virtual machine. + + The operation to update a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Resource properties to update. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either VirtualMachineInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.connectedvmware.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, resource_uri: str, body: Optional[Union[_models.VirtualMachineInstanceUpdate, IO]] = None, **kwargs: Any + ) -> LROPoller[_models.VirtualMachineInstance]: + """Updates a virtual machine. + + The operation to update a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Resource properties to update. Is either a VirtualMachineInstanceUpdate type or a + IO type. Default value is None. + :type body: ~azure.mgmt.connectedvmware.models.VirtualMachineInstanceUpdate or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either VirtualMachineInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.connectedvmware.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachineInstance] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_uri=resource_uri, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_uri: str, delete_from_host: Optional[bool] = None, force: Optional[bool] = None, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_uri=resource_uri, + delete_from_host=delete_from_host, + force=force, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default" + } + + @distributed_trace + def begin_delete( + self, resource_uri: str, delete_from_host: Optional[bool] = None, force: Optional[bool] = None, **kwargs: Any + ) -> LROPoller[None]: + """Deletes an virtual machine. + + The operation to delete a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param delete_from_host: Whether to delete the VM from the vCenter. Default value is None. + :type delete_from_host: bool + :param force: Whether force delete was specified. Default value is None. + :type force: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_uri=resource_uri, + delete_from_host=delete_from_host, + force=force, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default" + } + + @distributed_trace + def list(self, resource_uri: str, **kwargs: Any) -> Iterable["_models.VirtualMachineInstance"]: + """Implements List virtual machine instances. + + Lists all of the virtual machine instances within the specified parent resource. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineInstance or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.connectedvmware.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualMachineInstancesList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualMachineInstancesList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances"} + + def _stop_initial( # pylint: disable=inconsistent-return-statements + self, resource_uri: str, body: Optional[Union[_models.StopVirtualMachineOptions, IO]] = None, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "StopVirtualMachineOptions") + else: + _json = None + + request = build_stop_request( + resource_uri=resource_uri, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._stop_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _stop_initial.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/stop" + } + + @overload + def begin_stop( + self, + resource_uri: str, + body: Optional[_models.StopVirtualMachineOptions] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Implements the operation to stop a virtual machine. + + The operation to power off (stop) a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Virtualmachine stop action payload. Default value is None. + :type body: ~azure.mgmt.connectedvmware.models.StopVirtualMachineOptions + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_stop( + self, resource_uri: str, body: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[None]: + """Implements the operation to stop a virtual machine. + + The operation to power off (stop) a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Virtualmachine stop action payload. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_stop( + self, resource_uri: str, body: Optional[Union[_models.StopVirtualMachineOptions, IO]] = None, **kwargs: Any + ) -> LROPoller[None]: + """Implements the operation to stop a virtual machine. + + The operation to power off (stop) a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Virtualmachine stop action payload. Is either a StopVirtualMachineOptions type or + a IO type. Default value is None. + :type body: ~azure.mgmt.connectedvmware.models.StopVirtualMachineOptions or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._stop_initial( # type: ignore + resource_uri=resource_uri, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/stop" + } + + def _start_initial( # pylint: disable=inconsistent-return-statements + self, resource_uri: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_start_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self._start_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _start_initial.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/start" + } + + @distributed_trace + def begin_start(self, resource_uri: str, **kwargs: Any) -> LROPoller[None]: + """Implements the operation to start a virtual machine. + + The operation to start a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._start_initial( # type: ignore + resource_uri=resource_uri, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/start" + } + + def _restart_initial( # pylint: disable=inconsistent-return-statements + self, resource_uri: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_restart_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self._restart_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _restart_initial.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/restart" + } + + @distributed_trace + def begin_restart(self, resource_uri: str, **kwargs: Any) -> LROPoller[None]: + """Implements the operation to restart a virtual machine. + + The operation to restart a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._restart_initial( # type: ignore + resource_uri=resource_uri, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_restart.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/restart" + } diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_virtual_machine_templates_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_virtual_machine_templates_operations.py index f22625799224..2bbbbb8983d5 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_virtual_machine_templates_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_virtual_machine_templates_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request, _format_url_section +from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -68,7 +62,7 @@ def build_create_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") @@ -87,9 +81,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -105,7 +97,7 @@ def build_get_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") @@ -122,9 +114,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -141,7 +131,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") @@ -165,9 +155,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -183,7 +171,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") @@ -200,9 +188,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -214,7 +200,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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") @@ -229,9 +215,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -244,7 +228,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "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") @@ -292,16 +276,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualMachineTemplate] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -324,8 +306,9 @@ def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -442,7 +425,8 @@ def begin_create( :type resource_group_name: str :param virtual_machine_template_name: Name of the virtual machine template resource. Required. :type virtual_machine_template_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a VirtualMachineTemplate type or a IO type. Default + value is None. :type body: ~azure.mgmt.connectedvmware.models.VirtualMachineTemplate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -464,9 +448,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualMachineTemplate] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -541,9 +523,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachineTemplate] = kwargs.pop("cls", None) request = build_get_request( @@ -558,8 +538,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -654,8 +635,8 @@ def update( :type resource_group_name: str :param virtual_machine_template_name: Name of the virtual machine template resource. Required. :type virtual_machine_template_name: str - :param body: Resource properties to update. Is either a model type or a IO type. Default value - is None. + :param body: Resource properties to update. Is either a ResourcePatch type or a IO type. + Default value is None. :type body: ~azure.mgmt.connectedvmware.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -676,16 +657,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualMachineTemplate] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -708,8 +687,9 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -744,9 +724,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -762,8 +740,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -773,8 +752,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + 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.ConnectedVMwarevSphere/virtualMachineTemplates/{virtualMachineTemplateName}" @@ -809,9 +792,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -867,9 +848,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.VirtualMachineTemplate"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachineTemplatesList] = kwargs.pop("cls", None) error_map = { @@ -921,8 +900,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -958,9 +938,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachineTemplatesList] = kwargs.pop("cls", None) error_map = { @@ -1013,8 +991,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_virtual_machines_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_virtual_machines_operations.py index 6a5eb2853756..bd7441a001a6 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_virtual_machines_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_virtual_machines_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request, _format_url_section +from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_assess_patches_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +59,7 @@ def build_assess_patches_request( "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "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") @@ -82,9 +76,7 @@ def build_install_patches_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -99,7 +91,7 @@ def build_install_patches_request( "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "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") @@ -118,9 +110,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -135,7 +125,7 @@ def build_create_or_update_request( "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "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") @@ -154,9 +144,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -170,7 +158,7 @@ def build_get_request( "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "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") @@ -187,9 +175,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -204,7 +190,7 @@ def build_update_request( "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "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") @@ -222,16 +208,14 @@ def build_delete_request( virtual_machine_name: str, subscription_id: str, *, - retain: Optional[bool] = None, + delete_from_host: Optional[bool] = None, force: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -245,12 +229,12 @@ def build_delete_request( "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "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") - if retain is not None: - _params["retain"] = _SERIALIZER.query("retain", retain, "bool") + if delete_from_host is not None: + _params["deleteFromHost"] = _SERIALIZER.query("delete_from_host", delete_from_host, "bool") if force is not None: _params["force"] = _SERIALIZER.query("force", force, "bool") @@ -266,9 +250,7 @@ def build_stop_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -283,7 +265,7 @@ def build_stop_request( "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "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") @@ -302,9 +284,7 @@ def build_start_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -318,7 +298,7 @@ def build_start_request( "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "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") @@ -335,9 +315,7 @@ def build_restart_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -351,7 +329,7 @@ def build_restart_request( "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "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") @@ -366,9 +344,7 @@ def build_list_all_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -379,7 +355,7 @@ def build_list_all_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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") @@ -394,9 +370,7 @@ def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -409,7 +383,7 @@ def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "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") @@ -453,9 +427,7 @@ def _assess_patches_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.VirtualMachineAssessPatchesResult]] = kwargs.pop("cls", None) request = build_assess_patches_request( @@ -470,8 +442,9 @@ def _assess_patches_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -482,11 +455,15 @@ def _assess_patches_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("VirtualMachineAssessPatchesResult", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized @@ -521,9 +498,7 @@ def begin_assess_patches( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachineAssessPatchesResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -585,16 +560,14 @@ def _install_patches_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.VirtualMachineInstallPatchesResult]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(install_patches_input, (IO, bytes)): + if isinstance(install_patches_input, (IOBase, bytes)): _content = install_patches_input else: _json = self._serialize.body(install_patches_input, "VirtualMachineInstallPatchesParameters") @@ -614,8 +587,9 @@ def _install_patches_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -626,11 +600,15 @@ def _install_patches_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("VirtualMachineInstallPatchesResult", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized @@ -728,7 +706,7 @@ def begin_install_patches( :param virtual_machine_name: The name of the vSphere VMware machine. Required. :type virtual_machine_name: str :param install_patches_input: Input for InstallPatches as directly received by the API. Is - either a model type or a IO type. Required. + either a VirtualMachineInstallPatchesParameters type or a IO type. Required. :type install_patches_input: ~azure.mgmt.connectedvmware.models.VirtualMachineInstallPatchesParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -751,9 +729,7 @@ def begin_install_patches( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualMachineInstallPatchesResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -818,16 +794,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -850,8 +824,9 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -966,7 +941,8 @@ def begin_create_or_update( :type resource_group_name: str :param virtual_machine_name: Name of the virtual machine resource. Required. :type virtual_machine_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a VirtualMachine type or a IO type. Default value is + None. :type body: ~azure.mgmt.connectedvmware.models.VirtualMachine or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -987,9 +963,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1062,9 +1036,7 @@ def get(self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) request = build_get_request( @@ -1079,8 +1051,9 @@ def get(self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1119,16 +1092,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.VirtualMachine]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -1151,8 +1122,9 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1163,14 +1135,18 @@ def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("VirtualMachine", pipeline_response) if response.status_code == 201: deserialized = self._deserialize("VirtualMachine", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized @@ -1268,8 +1244,8 @@ def begin_update( :type resource_group_name: str :param virtual_machine_name: Name of the virtual machine resource. Required. :type virtual_machine_name: str - :param body: Resource properties to update. Is either a model type or a IO type. Default value - is None. + :param body: Resource properties to update. Is either a VirtualMachineUpdate type or a IO type. + Default value is None. :type body: ~azure.mgmt.connectedvmware.models.VirtualMachineUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1290,9 +1266,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1341,7 +1315,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, virtual_machine_name: str, - retain: Optional[bool] = None, + delete_from_host: Optional[bool] = None, force: Optional[bool] = None, **kwargs: Any ) -> None: @@ -1356,16 +1330,14 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, virtual_machine_name=virtual_machine_name, subscription_id=self._config.subscription_id, - retain=retain, + delete_from_host=delete_from_host, force=force, api_version=api_version, template_url=self._delete_initial.metadata["url"], @@ -1375,8 +1347,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1386,8 +1359,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + 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.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}" @@ -1398,7 +1375,7 @@ def begin_delete( self, resource_group_name: str, virtual_machine_name: str, - retain: Optional[bool] = None, + delete_from_host: Optional[bool] = None, force: Optional[bool] = None, **kwargs: Any ) -> LROPoller[None]: @@ -1410,9 +1387,8 @@ def begin_delete( :type resource_group_name: str :param virtual_machine_name: Name of the virtual machine resource. Required. :type virtual_machine_name: str - :param retain: Whether to just disable the VM from azure and retain the VM in the VMM. Default - value is None. - :type retain: bool + :param delete_from_host: Whether to delete the VM from the vCenter. Default value is None. + :type delete_from_host: bool :param force: Whether force delete was specified. Default value is None. :type force: bool :keyword callable cls: A custom type or function that will be passed the direct response @@ -1430,9 +1406,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -1441,7 +1415,7 @@ def begin_delete( raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, virtual_machine_name=virtual_machine_name, - retain=retain, + delete_from_host=delete_from_host, force=force, api_version=api_version, cls=lambda x, y, z: x, @@ -1492,16 +1466,14 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -1524,8 +1496,9 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1535,8 +1508,12 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _stop_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/stop" @@ -1630,8 +1607,8 @@ def begin_stop( :type resource_group_name: str :param virtual_machine_name: Name of the virtual machine resource. Required. :type virtual_machine_name: str - :param body: Virtualmachine stop action payload. Is either a model type or a IO type. Default - value is None. + :param body: Virtualmachine stop action payload. Is either a StopVirtualMachineOptions type or + a IO type. Default value is None. :type body: ~azure.mgmt.connectedvmware.models.StopVirtualMachineOptions or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1651,9 +1628,7 @@ def begin_stop( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1712,9 +1687,7 @@ def _start_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_start_request( @@ -1729,8 +1702,9 @@ def _start_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1740,8 +1714,12 @@ def _start_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _start_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/start" @@ -1772,9 +1750,7 @@ def begin_start(self, resource_group_name: str, virtual_machine_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -1830,9 +1806,7 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_restart_request( @@ -1847,8 +1821,9 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1858,8 +1833,12 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _restart_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/restart" @@ -1890,9 +1869,7 @@ def begin_restart(self, resource_group_name: str, virtual_machine_name: str, **k _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -1948,9 +1925,7 @@ def list_all(self, **kwargs: Any) -> Iterable["_models.VirtualMachine"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachinesList] = kwargs.pop("cls", None) error_map = { @@ -2002,8 +1977,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2036,9 +2012,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Vir _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachinesList] = kwargs.pop("cls", None) error_map = { @@ -2091,8 +2065,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_virtual_networks_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_virtual_networks_operations.py index 848e03a316ff..dbb8d68f04db 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_virtual_networks_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_virtual_networks_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request, _format_url_section +from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -66,7 +60,7 @@ def build_create_request( "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_name, "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") @@ -85,9 +79,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +93,7 @@ def build_get_request( "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_name, "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") @@ -118,9 +110,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -135,7 +125,7 @@ def build_update_request( "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_name, "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") @@ -159,9 +149,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -175,7 +163,7 @@ def build_delete_request( "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_name, "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") @@ -192,9 +180,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -205,7 +191,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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") @@ -220,9 +206,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -235,7 +219,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "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") @@ -283,16 +267,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -315,8 +297,9 @@ def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -431,7 +414,8 @@ def begin_create( :type resource_group_name: str :param virtual_network_name: Name of the virtual network resource. Required. :type virtual_network_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a VirtualNetwork type or a IO type. Default value is + None. :type body: ~azure.mgmt.connectedvmware.models.VirtualNetwork or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -452,9 +436,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -527,9 +509,7 @@ def get(self, resource_group_name: str, virtual_network_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) request = build_get_request( @@ -544,8 +524,9 @@ def get(self, resource_group_name: str, virtual_network_name: str, **kwargs: Any request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -640,8 +621,8 @@ def update( :type resource_group_name: str :param virtual_network_name: Name of the virtual network resource. Required. :type virtual_network_name: str - :param body: Resource properties to update. Is either a model type or a IO type. Default value - is None. + :param body: Resource properties to update. Is either a ResourcePatch type or a IO type. + Default value is None. :type body: ~azure.mgmt.connectedvmware.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -662,16 +643,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -694,8 +673,9 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -730,9 +710,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -748,8 +726,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -759,8 +738,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + 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.ConnectedVMwarevSphere/virtualNetworks/{virtualNetworkName}" @@ -795,9 +778,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -852,9 +833,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.VirtualNetwork"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualNetworksList] = kwargs.pop("cls", None) error_map = { @@ -906,8 +885,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -940,9 +920,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualNetworksList] = kwargs.pop("cls", None) error_map = { @@ -995,8 +973,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_vm_instance_guest_agents_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_vm_instance_guest_agents_operations.py new file mode 100644 index 000000000000..828fd1ba2d7a --- /dev/null +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_vm_instance_guest_agents_operations.py @@ -0,0 +1,641 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# 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 + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_request(resource_uri: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/guestAgents/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(resource_uri: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/guestAgents/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request(resource_uri: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/guestAgents/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request(resource_uri: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/guestAgents", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class VMInstanceGuestAgentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.connectedvmware.AzureArcVMwareManagementServiceAPI`'s + :attr:`vm_instance_guest_agents` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _create_initial( + self, resource_uri: str, body: Optional[Union[_models.GuestAgent, IO]] = None, **kwargs: Any + ) -> _models.GuestAgent: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GuestAgent] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "GuestAgent") + else: + _json = None + + request = build_create_request( + resource_uri=resource_uri, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("GuestAgent", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("GuestAgent", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/guestAgents/default" + } + + @overload + def begin_create( + self, + resource_uri: str, + body: Optional[_models.GuestAgent] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GuestAgent]: + """Implements GuestAgent PUT method. + + Create Or Update GuestAgent. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Request payload. Default value is None. + :type body: ~azure.mgmt.connectedvmware.models.GuestAgent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either GuestAgent or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.connectedvmware.models.GuestAgent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, resource_uri: str, body: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.GuestAgent]: + """Implements GuestAgent PUT method. + + Create Or Update GuestAgent. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Request payload. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either GuestAgent or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.connectedvmware.models.GuestAgent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, resource_uri: str, body: Optional[Union[_models.GuestAgent, IO]] = None, **kwargs: Any + ) -> LROPoller[_models.GuestAgent]: + """Implements GuestAgent PUT method. + + Create Or Update GuestAgent. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Request payload. Is either a GuestAgent type or a IO type. Default value is None. + :type body: ~azure.mgmt.connectedvmware.models.GuestAgent or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either GuestAgent or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.connectedvmware.models.GuestAgent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GuestAgent] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_uri=resource_uri, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GuestAgent", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/guestAgents/default" + } + + @distributed_trace + def get(self, resource_uri: str, **kwargs: Any) -> _models.GuestAgent: + """Gets GuestAgent. + + Implements GuestAgent GET method. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GuestAgent or the result of cls(response) + :rtype: ~azure.mgmt.connectedvmware.models.GuestAgent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GuestAgent] = kwargs.pop("cls", None) + + request = build_get_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("GuestAgent", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/guestAgents/default" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_uri: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/guestAgents/default" + } + + @distributed_trace + def begin_delete(self, resource_uri: str, **kwargs: Any) -> LROPoller[None]: + """Deletes an GuestAgent. + + Implements GuestAgent DELETE method. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_uri=resource_uri, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/guestAgents/default" + } + + @distributed_trace + def list(self, resource_uri: str, **kwargs: Any) -> Iterable["_models.GuestAgent"]: + """Implements GET GuestAgent in a vm. + + Returns the list of GuestAgent of the given vm. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GuestAgent or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.connectedvmware.models.GuestAgent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GuestAgentList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("GuestAgentList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/guestAgents" + } diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_vm_instance_hybrid_identity_metadata_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_vm_instance_hybrid_identity_metadata_operations.py new file mode 100644 index 000000000000..2f4746c18f62 --- /dev/null +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_vm_instance_hybrid_identity_metadata_operations.py @@ -0,0 +1,261 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request(resource_uri: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/hybridIdentityMetadata/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request(resource_uri: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/hybridIdentityMetadata", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class VmInstanceHybridIdentityMetadataOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.connectedvmware.AzureArcVMwareManagementServiceAPI`'s + :attr:`vm_instance_hybrid_identity_metadata` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, resource_uri: str, **kwargs: Any) -> _models.VmInstanceHybridIdentityMetadata: + """Gets HybridIdentityMetadata. + + Implements HybridIdentityMetadata GET method. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VmInstanceHybridIdentityMetadata or the result of cls(response) + :rtype: ~azure.mgmt.connectedvmware.models.VmInstanceHybridIdentityMetadata + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VmInstanceHybridIdentityMetadata] = kwargs.pop("cls", None) + + request = build_get_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VmInstanceHybridIdentityMetadata", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/hybridIdentityMetadata/default" + } + + @distributed_trace + def list(self, resource_uri: str, **kwargs: Any) -> Iterable["_models.VmInstanceHybridIdentityMetadata"]: + """Implements GET HybridIdentityMetadata in a vm. + + Returns the list of HybridIdentityMetadata of the given vm. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VmInstanceHybridIdentityMetadata or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.connectedvmware.models.VmInstanceHybridIdentityMetadata] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VmInstanceHybridIdentityMetadataList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VmInstanceHybridIdentityMetadataList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/hybridIdentityMetadata" + } diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_cluster.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_cluster.py index e34c426554ed..f626fd9eab68 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_cluster.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_cluster.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/CreateCluster.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/CreateCluster.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_datastore.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_datastore.py index 9a711f5f69f0..dfdc94ca0f75 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_datastore.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_datastore.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/CreateDatastore.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/CreateDatastore.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_guest_agent.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_guest_agent.py index b3fdf3863dcc..fe59546e14a6 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_guest_agent.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_guest_agent.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/CreateGuestAgent.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/CreateGuestAgent.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_host.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_host.py index 23dba81d67eb..0258249f28dc 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_host.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_host.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/CreateHost.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/CreateHost.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_hybrid_identity_metadata.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_hybrid_identity_metadata.py index 40e0eed1233c..ce794e23ff0f 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_hybrid_identity_metadata.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_hybrid_identity_metadata.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/CreateHybridIdentityMetadata.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/CreateHybridIdentityMetadata.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_inventory_item.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_inventory_item.py index fd450fd077c7..f2ddd87b75c0 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_inventory_item.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_inventory_item.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/CreateInventoryItem.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/CreateInventoryItem.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_resource_pool.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_resource_pool.py index 9f1966d15716..41f80712bb21 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_resource_pool.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_resource_pool.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/CreateResourcePool.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/CreateResourcePool.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_vcenter.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_vcenter.py index c0a742371d08..0bcc472851c9 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_vcenter.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_vcenter.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/CreateVCenter.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/CreateVCenter.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_virtual_machine.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_virtual_machine.py index 2a87d9656688..debec72a7d51 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_virtual_machine.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_virtual_machine.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/CreateVirtualMachine.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/CreateVirtualMachine.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_virtual_machine_instance.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_virtual_machine_instance.py new file mode 100644 index 000000000000..20da5c55455e --- /dev/null +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_virtual_machine_instance.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.connectedvmware import AzureArcVMwareManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-connectedvmware +# USAGE + python create_virtual_machine_instance.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureArcVMwareManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.virtual_machine_instances.begin_create_or_update( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + ).result() + print(response) + + +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/CreateVirtualMachineInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_virtual_machine_template.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_virtual_machine_template.py index d499d9369e7b..b4fc237baa9e 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_virtual_machine_template.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_virtual_machine_template.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/CreateVirtualMachineTemplate.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/CreateVirtualMachineTemplate.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_virtual_network.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_virtual_network.py index de8850597708..761a94d59bb7 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_virtual_network.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_virtual_network.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/CreateVirtualNetwork.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/CreateVirtualNetwork.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_vm_instance_guest_agent.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_vm_instance_guest_agent.py new file mode 100644 index 000000000000..5978874be8c0 --- /dev/null +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_vm_instance_guest_agent.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.connectedvmware import AzureArcVMwareManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-connectedvmware +# USAGE + python create_vm_instance_guest_agent.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureArcVMwareManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.vm_instance_guest_agents.begin_create( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + ).result() + print(response) + + +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/CreateVMInstanceGuestAgent.json +if __name__ == "__main__": + main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_cluster.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_cluster.py index bca97514f946..e841eb409b9a 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_cluster.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_cluster.py @@ -29,13 +29,12 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.clusters.begin_delete( + client.clusters.begin_delete( resource_group_name="testrg", cluster_name="HRCluster", ).result() - print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/DeleteCluster.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/DeleteCluster.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_datastore.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_datastore.py index 1304ca3c04f8..aa0ee5325d89 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_datastore.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_datastore.py @@ -29,13 +29,12 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.datastores.begin_delete( + client.datastores.begin_delete( resource_group_name="testrg", datastore_name="HRDatastore", ).result() - print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/DeleteDatastore.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/DeleteDatastore.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_extension.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_extension.py index 3142649176c1..812e21f99ecd 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_extension.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_extension.py @@ -29,14 +29,13 @@ def main(): subscription_id="{subscriptionId}", ) - response = client.machine_extensions.begin_delete( + client.machine_extensions.begin_delete( resource_group_name="myResourceGroup", virtual_machine_name="myMachine", extension_name="MMA", ).result() - print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/DELETEExtension.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/DELETEExtension.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_guest_agent.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_guest_agent.py index 8261ca2fcb8a..90d5ee410d79 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_guest_agent.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_guest_agent.py @@ -29,14 +29,13 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.guest_agents.begin_delete( + client.guest_agents.begin_delete( resource_group_name="testrg", virtual_machine_name="ContosoVm", name="default", ).result() - print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/DeleteGuestAgent.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/DeleteGuestAgent.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_host.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_host.py index aa0232905106..42a068f5ea4d 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_host.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_host.py @@ -29,13 +29,12 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.hosts.begin_delete( + client.hosts.begin_delete( resource_group_name="testrg", host_name="HRHost", ).result() - print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/DeleteHost.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/DeleteHost.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_hybrid_identity_metadata.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_hybrid_identity_metadata.py index cb272ffa995f..8c60d4eeec09 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_hybrid_identity_metadata.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_hybrid_identity_metadata.py @@ -29,14 +29,13 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.hybrid_identity_metadata.delete( + client.hybrid_identity_metadata.delete( resource_group_name="testrg", virtual_machine_name="ContosoVm", metadata_name="default", ) - print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/DeleteHybridIdentityMetadata.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/DeleteHybridIdentityMetadata.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_inventory_item.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_inventory_item.py index 78c72ca2c563..e921fc80f75f 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_inventory_item.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_inventory_item.py @@ -29,14 +29,13 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.inventory_items.delete( + client.inventory_items.delete( resource_group_name="testrg", vcenter_name="ContosoVCenter", inventory_item_name="testItem", ) - print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/DeleteInventoryItem.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/DeleteInventoryItem.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_resource_pool.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_resource_pool.py index 30acd08d5092..4a6540f7d330 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_resource_pool.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_resource_pool.py @@ -29,13 +29,12 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.resource_pools.begin_delete( + client.resource_pools.begin_delete( resource_group_name="testrg", resource_pool_name="HRPool", ).result() - print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/DeleteResourcePool.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/DeleteResourcePool.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_vcenter.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_vcenter.py index 79f3655cd1f4..1b546289e2e0 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_vcenter.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_vcenter.py @@ -29,13 +29,12 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.vcenters.begin_delete( + client.vcenters.begin_delete( resource_group_name="testrg", vcenter_name="ContosoVCenter", ).result() - print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/DeleteVCenter.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/DeleteVCenter.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_virtual_machine.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_virtual_machine.py index 85217b86cff3..1ea5333bdb47 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_virtual_machine.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_virtual_machine.py @@ -29,13 +29,12 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.virtual_machines.begin_delete( + client.virtual_machines.begin_delete( resource_group_name="testrg", virtual_machine_name="DemoVM", ).result() - print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/DeleteVirtualMachine.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/DeleteVirtualMachine.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_virtual_machine_instance.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_virtual_machine_instance.py new file mode 100644 index 000000000000..a3fb04a53666 --- /dev/null +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_virtual_machine_instance.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.connectedvmware import AzureArcVMwareManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-connectedvmware +# USAGE + python delete_virtual_machine_instance.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureArcVMwareManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.virtual_machine_instances.begin_delete( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + ).result() + + +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/DeleteVirtualMachineInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_virtual_machine_template.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_virtual_machine_template.py index 9e9c05b0fe98..cc55f6c8ed65 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_virtual_machine_template.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_virtual_machine_template.py @@ -29,13 +29,12 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.virtual_machine_templates.begin_delete( + client.virtual_machine_templates.begin_delete( resource_group_name="testrg", virtual_machine_template_name="WebFrontEndTemplate", ).result() - print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/DeleteVirtualMachineTemplate.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/DeleteVirtualMachineTemplate.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_virtual_network.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_virtual_network.py index 976002f1b108..74f8c800050f 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_virtual_network.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_virtual_network.py @@ -29,13 +29,12 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.virtual_networks.begin_delete( + client.virtual_networks.begin_delete( resource_group_name="testrg", virtual_network_name="ProdNetwork", ).result() - print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/DeleteVirtualNetwork.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/DeleteVirtualNetwork.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_vm_instance_guest_agent.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_vm_instance_guest_agent.py new file mode 100644 index 000000000000..abe3e7b62b64 --- /dev/null +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_vm_instance_guest_agent.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.connectedvmware import AzureArcVMwareManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-connectedvmware +# USAGE + python delete_vm_instance_guest_agent.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureArcVMwareManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.vm_instance_guest_agents.begin_delete( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + ).result() + + +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/DeleteVMInstanceGuestAgent.json +if __name__ == "__main__": + main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/extensions_upgrade.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/extensions_upgrade.py index 336cb7bc7041..34f02a2ee6f9 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/extensions_upgrade.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/extensions_upgrade.py @@ -29,7 +29,7 @@ def main(): subscription_id="{subscriptionId}", ) - response = client.begin_upgrade_extensions( + client.begin_upgrade_extensions( resource_group_name="myResourceGroup", virtual_machine_name="myMachine", extension_upgrade_parameters={ @@ -39,9 +39,8 @@ def main(): } }, ).result() - print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/Extensions_Upgrade.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/Extensions_Upgrade.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_cluster.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_cluster.py index 3d9008d3971c..2285b749832b 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_cluster.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_cluster.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/GetCluster.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/GetCluster.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_datastore.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_datastore.py index 89b59de01aed..25f6f8fe17ff 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_datastore.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_datastore.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/GetDatastore.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/GetDatastore.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_extension.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_extension.py index d70603c9b1f5..6179c736558c 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_extension.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_extension.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/GETExtension.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/GETExtension.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_guest_agent.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_guest_agent.py index c502ab229c89..10758d628cc3 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_guest_agent.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_guest_agent.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/GetGuestAgent.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/GetGuestAgent.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_host.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_host.py index 4dd64ecceff7..961619176f25 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_host.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_host.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/GetHost.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/GetHost.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_hybrid_identity_metadata.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_hybrid_identity_metadata.py index 65f394824b82..e06d2e453286 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_hybrid_identity_metadata.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_hybrid_identity_metadata.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/GetHybridIdentityMetadata.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/GetHybridIdentityMetadata.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_inventory_item.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_inventory_item.py index 2679f736a71d..0feda85a5f43 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_inventory_item.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_inventory_item.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/GetInventoryItem.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/GetInventoryItem.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_resource_pool.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_resource_pool.py index e0b1968dc3ee..4b28b72ef0e9 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_resource_pool.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_resource_pool.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/GetResourcePool.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/GetResourcePool.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_vcenter.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_vcenter.py index 3cdc2e756a43..8bb957114a29 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_vcenter.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_vcenter.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/GetVCenter.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/GetVCenter.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_virtual_machine.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_virtual_machine.py index 2d2d89a34f1d..6d4d51a98dcc 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_virtual_machine.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_virtual_machine.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/GetVirtualMachine.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/GetVirtualMachine.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_virtual_machine_instance.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_virtual_machine_instance.py new file mode 100644 index 000000000000..7032adf38e83 --- /dev/null +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_virtual_machine_instance.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.connectedvmware import AzureArcVMwareManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-connectedvmware +# USAGE + python get_virtual_machine_instance.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureArcVMwareManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.virtual_machine_instances.get( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + ) + print(response) + + +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/GetVirtualMachineInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_virtual_machine_template.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_virtual_machine_template.py index 058e707473a5..5a417cbb596b 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_virtual_machine_template.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_virtual_machine_template.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/GetVirtualMachineTemplate.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/GetVirtualMachineTemplate.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_virtual_network.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_virtual_network.py index 275bdd48edbe..9a61098cac54 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_virtual_network.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_virtual_network.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/GetVirtualNetwork.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/GetVirtualNetwork.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_vm_instance_guest_agent.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_vm_instance_guest_agent.py new file mode 100644 index 000000000000..b503ee99c935 --- /dev/null +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_vm_instance_guest_agent.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.connectedvmware import AzureArcVMwareManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-connectedvmware +# USAGE + python get_vm_instance_guest_agent.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureArcVMwareManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.vm_instance_guest_agents.get( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + ) + print(response) + + +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/GetVMInstanceGuestAgent.json +if __name__ == "__main__": + main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_vm_instance_hybrid_identity_metadata.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_vm_instance_hybrid_identity_metadata.py new file mode 100644 index 000000000000..71476946a7b8 --- /dev/null +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_vm_instance_hybrid_identity_metadata.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.connectedvmware import AzureArcVMwareManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-connectedvmware +# USAGE + python get_vm_instance_hybrid_identity_metadata.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureArcVMwareManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.vm_instance_hybrid_identity_metadata.get( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + ) + print(response) + + +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/GetVmInstanceHybridIdentityMetadata.json +if __name__ == "__main__": + main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/guest_agent_list_by_vm.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/guest_agent_list_by_vm.py index 29337051e12d..e8611f14406e 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/guest_agent_list_by_vm.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/guest_agent_list_by_vm.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/GuestAgent_ListByVm.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/GuestAgent_ListByVm.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/hybrid_identity_metadata_list_by_vm.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/hybrid_identity_metadata_list_by_vm.py index 8d17dc802263..950723734ef7 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/hybrid_identity_metadata_list_by_vm.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/hybrid_identity_metadata_list_by_vm.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/HybridIdentityMetadata_ListByVm.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/HybridIdentityMetadata_ListByVm.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/hybrid_identity_metadata_list_by_vm_instance.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/hybrid_identity_metadata_list_by_vm_instance.py new file mode 100644 index 000000000000..7b623e87cbc8 --- /dev/null +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/hybrid_identity_metadata_list_by_vm_instance.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.connectedvmware import AzureArcVMwareManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-connectedvmware +# USAGE + python hybrid_identity_metadata_list_by_vm_instance.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureArcVMwareManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.vm_instance_hybrid_identity_metadata.list( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/HybridIdentityMetadata_ListByVmInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/inventory_items_list_by_vcenter.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/inventory_items_list_by_vcenter.py index bc4ff3957b34..4a77d9d7cb04 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/inventory_items_list_by_vcenter.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/inventory_items_list_by_vcenter.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/InventoryItems_ListByVCenter.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/InventoryItems_ListByVCenter.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_clusters.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_clusters.py index 1b8d0d6ff8a9..ddf815f611a5 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_clusters.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_clusters.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/ListClusters.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/ListClusters.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_clusters_by_resource_group.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_clusters_by_resource_group.py index 5fba75d28eaf..dad9d2c77434 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_clusters_by_resource_group.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_clusters_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/ListClustersByResourceGroup.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/ListClustersByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_datastores.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_datastores.py index 86be50d13c2b..58c25e1b1e59 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_datastores.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_datastores.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/ListDatastores.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/ListDatastores.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_datastores_by_resource_group.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_datastores_by_resource_group.py index 14f72e1ab4ad..306a5dea55fb 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_datastores_by_resource_group.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_datastores_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/ListDatastoresByResourceGroup.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/ListDatastoresByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_extension.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_extension.py index 29822da4fd85..b70224badcde 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_extension.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_extension.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/LISTExtension.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/LISTExtension.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_hosts.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_hosts.py index cf99a608b885..6872e80907b9 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_hosts.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_hosts.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/ListHosts.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/ListHosts.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_hosts_by_resource_group.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_hosts_by_resource_group.py index 4e14a01e0be9..25fec3fa943e 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_hosts_by_resource_group.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_hosts_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/ListHostsByResourceGroup.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/ListHostsByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_operations.py index 07f3251c0f98..ef861fd776e8 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_operations.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/ListOperations.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/ListOperations.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_resource_pools.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_resource_pools.py index fd10bd54baa8..5eaa814e2aa4 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_resource_pools.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_resource_pools.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/ListResourcePools.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/ListResourcePools.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_resource_pools_by_resource_group.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_resource_pools_by_resource_group.py index 182d7a8f57ca..177bd9da48ad 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_resource_pools_by_resource_group.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_resource_pools_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/ListResourcePoolsByResourceGroup.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/ListResourcePoolsByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_vcenters.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_vcenters.py index bdfd5c139fbe..2a6f6f13bce6 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_vcenters.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_vcenters.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/ListVCenters.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/ListVCenters.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_vcenters_by_resource_group.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_vcenters_by_resource_group.py index af7610ff8cea..28ffac12ad6e 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_vcenters_by_resource_group.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_vcenters_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/ListVCentersByResourceGroup.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/ListVCentersByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machine_instances.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machine_instances.py new file mode 100644 index 000000000000..8a6f8fe48086 --- /dev/null +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machine_instances.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.connectedvmware import AzureArcVMwareManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-connectedvmware +# USAGE + python list_virtual_machine_instances.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureArcVMwareManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.virtual_machine_instances.list( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/ListVirtualMachineInstances.json +if __name__ == "__main__": + main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machine_templates.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machine_templates.py index eede81e5f7b6..cec08850a4a1 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machine_templates.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machine_templates.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/ListVirtualMachineTemplates.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/ListVirtualMachineTemplates.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machine_templates_by_resource_group.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machine_templates_by_resource_group.py index 4d16a053b14f..d2497eb53997 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machine_templates_by_resource_group.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machine_templates_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/ListVirtualMachineTemplatesByResourceGroup.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/ListVirtualMachineTemplatesByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machines.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machines.py index 2f8f452c9aca..0f31b737e611 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machines.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machines.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/ListVirtualMachines.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/ListVirtualMachines.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machines_by_resource_group.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machines_by_resource_group.py index a3d548989c2c..f43524650f99 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machines_by_resource_group.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machines_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/ListVirtualMachinesByResourceGroup.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/ListVirtualMachinesByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_networks.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_networks.py index dec0c803b02f..676c47ae8ba0 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_networks.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_networks.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/ListVirtualNetworks.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/ListVirtualNetworks.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_networks_by_resource_group.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_networks_by_resource_group.py index 990e80704282..733d25e5bccc 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_networks_by_resource_group.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_networks_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/ListVirtualNetworksByResourceGroup.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/ListVirtualNetworksByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/put_extension.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/put_extension.py index 8155107bb3cd..5bb0a8e18107 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/put_extension.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/put_extension.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/PUTExtension.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/PUTExtension.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/restart_virtual_machine.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/restart_virtual_machine.py index 09782dd86ce5..d22e86ff14da 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/restart_virtual_machine.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/restart_virtual_machine.py @@ -29,13 +29,12 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.virtual_machines.begin_restart( + client.virtual_machines.begin_restart( resource_group_name="testrg", virtual_machine_name="DemoVM", ).result() - print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/RestartVirtualMachine.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/RestartVirtualMachine.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/restart_virtual_machine_instance.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/restart_virtual_machine_instance.py new file mode 100644 index 000000000000..e0e93ff45549 --- /dev/null +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/restart_virtual_machine_instance.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.connectedvmware import AzureArcVMwareManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-connectedvmware +# USAGE + python restart_virtual_machine_instance.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureArcVMwareManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.virtual_machine_instances.begin_restart( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + ).result() + + +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/RestartVirtualMachineInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/start_virtual_machine.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/start_virtual_machine.py index b73beb930dc0..d51194dc3551 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/start_virtual_machine.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/start_virtual_machine.py @@ -29,13 +29,12 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.virtual_machines.begin_start( + client.virtual_machines.begin_start( resource_group_name="testrg", virtual_machine_name="DemoVM", ).result() - print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/StartVirtualMachine.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/StartVirtualMachine.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/start_virtual_machine_instance.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/start_virtual_machine_instance.py new file mode 100644 index 000000000000..88e830d26088 --- /dev/null +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/start_virtual_machine_instance.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.connectedvmware import AzureArcVMwareManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-connectedvmware +# USAGE + python start_virtual_machine_instance.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureArcVMwareManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.virtual_machine_instances.begin_start( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + ).result() + + +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/StartVirtualMachineInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/stop_virtual_machine.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/stop_virtual_machine.py index 0b731b5561a2..eac14e9ffa4d 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/stop_virtual_machine.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/stop_virtual_machine.py @@ -29,13 +29,12 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.virtual_machines.begin_stop( + client.virtual_machines.begin_stop( resource_group_name="testrg", virtual_machine_name="DemoVM", ).result() - print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/StopVirtualMachine.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/StopVirtualMachine.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/stop_virtual_machine_instance.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/stop_virtual_machine_instance.py new file mode 100644 index 000000000000..1f98cb2741fc --- /dev/null +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/stop_virtual_machine_instance.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.connectedvmware import AzureArcVMwareManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-connectedvmware +# USAGE + python stop_virtual_machine_instance.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureArcVMwareManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.virtual_machine_instances.begin_stop( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + ).result() + + +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/StopVirtualMachineInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_cluster.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_cluster.py index e30ba3e60a0c..9c9800795cee 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_cluster.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_cluster.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/UpdateCluster.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/UpdateCluster.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_datastore.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_datastore.py index a444ab7924ff..07a84f4657b4 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_datastore.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_datastore.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/UpdateDatastore.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/UpdateDatastore.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_extension.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_extension.py index 42d975fafbe8..4443d3da2608 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_extension.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_extension.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/UpdateExtension.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/UpdateExtension.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_host.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_host.py index 0cad59443d4f..cc6731c4fa36 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_host.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_host.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/UpdateHost.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/UpdateHost.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_resource_pool.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_resource_pool.py index eb4688b60e9f..6d6b7102d97b 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_resource_pool.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_resource_pool.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/UpdateResourcePool.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/UpdateResourcePool.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_vcenter.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_vcenter.py index 6c23bacb2822..540f31cc32cb 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_vcenter.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_vcenter.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/UpdateVCenter.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/UpdateVCenter.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_virtual_machine.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_virtual_machine.py index 91ef376feb7e..81bd020bbf32 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_virtual_machine.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_virtual_machine.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/UpdateVirtualMachine.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/UpdateVirtualMachine.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_virtual_machine_instance.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_virtual_machine_instance.py new file mode 100644 index 000000000000..2c0fc95f04c4 --- /dev/null +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_virtual_machine_instance.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.connectedvmware import AzureArcVMwareManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-connectedvmware +# USAGE + python update_virtual_machine_instance.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureArcVMwareManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.virtual_machine_instances.begin_update( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + ).result() + print(response) + + +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/UpdateVirtualMachineInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_virtual_machine_template.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_virtual_machine_template.py index 40dc8889dd63..5ba07b4b21b5 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_virtual_machine_template.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_virtual_machine_template.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/UpdateVirtualMachineTemplate.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/UpdateVirtualMachineTemplate.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_virtual_network.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_virtual_network.py index 7cf06cb2373a..a04146b94983 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_virtual_network.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_virtual_network.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/UpdateVirtualNetwork.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/UpdateVirtualNetwork.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/virtual_machine_assess_patches.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/virtual_machine_assess_patches.py index aedc90c57f78..c069b65afb52 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/virtual_machine_assess_patches.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/virtual_machine_assess_patches.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/VirtualMachineAssessPatches.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/VirtualMachineAssessPatches.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/virtual_machine_install_patches.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/virtual_machine_install_patches.py index 5eab4379e4a4..dbc17ea6fdab 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/virtual_machine_install_patches.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/virtual_machine_install_patches.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/VirtualMachineInstallPatches.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/VirtualMachineInstallPatches.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/vm_instance_guest_agent_list_by_vm.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/vm_instance_guest_agent_list_by_vm.py new file mode 100644 index 000000000000..bc8c3d30bbb4 --- /dev/null +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/vm_instance_guest_agent_list_by_vm.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.connectedvmware import AzureArcVMwareManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-connectedvmware +# USAGE + python vm_instance_guest_agent_list_by_vm.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureArcVMwareManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.vm_instance_guest_agents.list( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2023-03-01-preview/examples/VMInstanceGuestAgent_ListByVm.json +if __name__ == "__main__": + main()