diff --git a/sdk/scvmm/azure-mgmt-scvmm/_meta.json b/sdk/scvmm/azure-mgmt-scvmm/_meta.json index e15dc37325e5..181ffba60940 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/_meta.json +++ b/sdk/scvmm/azure-mgmt-scvmm/_meta.json @@ -1,11 +1,11 @@ { - "commit": "7a54c1a83d14da431c0ae48c4315cba143084bce", + "commit": "6062fba978a4b1ac455cca9bab0027cd54832bf7", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.7", + "@autorest/python@6.4.6", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/scvmm/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/scvmm/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.4.6 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/scvmm/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_configuration.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_configuration.py index 687786dd317d..a83c14934a0c 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_configuration.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_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 @@ -36,14 +30,14 @@ class SCVMMConfiguration(Configuration): # pylint: disable=too-many-instance-at :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2020-06-05-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-05-21-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(SCVMMConfiguration, self).__init__(**kwargs) - api_version: Literal["2020-06-05-preview"] = kwargs.pop("api_version", "2020-06-05-preview") + api_version: str = kwargs.pop("api_version", "2022-05-21-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_scvmm.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_scvmm.py index f5da3dd74c0a..2d7b2f97eaca 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_scvmm.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_scvmm.py @@ -18,7 +18,10 @@ from .operations import ( AvailabilitySetsOperations, CloudsOperations, + GuestAgentsOperations, + HybridIdentityMetadatasOperations, InventoryItemsOperations, + MachineExtensionsOperations, Operations, VirtualMachineTemplatesOperations, VirtualMachinesOperations, @@ -51,6 +54,13 @@ class SCVMM: # pylint: disable=client-accepts-api-version-keyword,too-many-inst :vartype availability_sets: azure.mgmt.scvmm.operations.AvailabilitySetsOperations :ivar inventory_items: InventoryItemsOperations operations :vartype inventory_items: azure.mgmt.scvmm.operations.InventoryItemsOperations + :ivar hybrid_identity_metadatas: HybridIdentityMetadatasOperations operations + :vartype hybrid_identity_metadatas: + azure.mgmt.scvmm.operations.HybridIdentityMetadatasOperations + :ivar machine_extensions: MachineExtensionsOperations operations + :vartype machine_extensions: azure.mgmt.scvmm.operations.MachineExtensionsOperations + :ivar guest_agents: GuestAgentsOperations operations + :vartype guest_agents: azure.mgmt.scvmm.operations.GuestAgentsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. @@ -58,7 +68,7 @@ class SCVMM: # pylint: disable=client-accepts-api-version-keyword,too-many-inst :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 "2020-06-05-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-05-21-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 @@ -73,7 +83,7 @@ def __init__( **kwargs: Any ) -> None: self._config = SCVMMConfiguration(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) @@ -95,6 +105,13 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.inventory_items = InventoryItemsOperations(self._client, self._config, self._serialize, self._deserialize) + self.hybrid_identity_metadatas = HybridIdentityMetadatasOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.machine_extensions = MachineExtensionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.guest_agents = GuestAgentsOperations(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. @@ -125,5 +142,5 @@ def __enter__(self) -> "SCVMM": 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/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_serialization.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_serialization.py index 2c170e28dbca..842ae727fbbc 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_serialization.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_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 @@ -656,8 +682,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: @@ -777,6 +803,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) @@ -1161,7 +1189,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 +1271,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 +1295,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 +1361,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 +1381,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 +1500,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 +1515,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 +1525,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/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_vendor.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_vendor.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_version.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_version.py index dfa6ee022f15..e5754a47ce68 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_version.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b2" +VERSION = "1.0.0b1" diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/_configuration.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/_configuration.py index cb32a846720c..bc9a5c1f12b2 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/_configuration.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/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 @@ -36,14 +30,14 @@ class SCVMMConfiguration(Configuration): # pylint: disable=too-many-instance-at :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2020-06-05-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-05-21-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(SCVMMConfiguration, self).__init__(**kwargs) - api_version: Literal["2020-06-05-preview"] = kwargs.pop("api_version", "2020-06-05-preview") + api_version: str = kwargs.pop("api_version", "2022-05-21-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/_scvmm.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/_scvmm.py index 32781d965ae5..b0034fa54345 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/_scvmm.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/_scvmm.py @@ -18,7 +18,10 @@ from .operations import ( AvailabilitySetsOperations, CloudsOperations, + GuestAgentsOperations, + HybridIdentityMetadatasOperations, InventoryItemsOperations, + MachineExtensionsOperations, Operations, VirtualMachineTemplatesOperations, VirtualMachinesOperations, @@ -51,6 +54,13 @@ class SCVMM: # pylint: disable=client-accepts-api-version-keyword,too-many-inst :vartype availability_sets: azure.mgmt.scvmm.aio.operations.AvailabilitySetsOperations :ivar inventory_items: InventoryItemsOperations operations :vartype inventory_items: azure.mgmt.scvmm.aio.operations.InventoryItemsOperations + :ivar hybrid_identity_metadatas: HybridIdentityMetadatasOperations operations + :vartype hybrid_identity_metadatas: + azure.mgmt.scvmm.aio.operations.HybridIdentityMetadatasOperations + :ivar machine_extensions: MachineExtensionsOperations operations + :vartype machine_extensions: azure.mgmt.scvmm.aio.operations.MachineExtensionsOperations + :ivar guest_agents: GuestAgentsOperations operations + :vartype guest_agents: azure.mgmt.scvmm.aio.operations.GuestAgentsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. @@ -58,7 +68,7 @@ class SCVMM: # pylint: disable=client-accepts-api-version-keyword,too-many-inst :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 "2020-06-05-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-05-21-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 @@ -73,7 +83,7 @@ def __init__( **kwargs: Any ) -> None: self._config = SCVMMConfiguration(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) @@ -95,6 +105,13 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.inventory_items = InventoryItemsOperations(self._client, self._config, self._serialize, self._deserialize) + self.hybrid_identity_metadatas = HybridIdentityMetadatasOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.machine_extensions = MachineExtensionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.guest_agents = GuestAgentsOperations(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. @@ -125,5 +142,5 @@ async def __aenter__(self) -> "SCVMM": 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/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/__init__.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/__init__.py index 69f4eb5e8c3e..0e4248a47c56 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/__init__.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/__init__.py @@ -14,6 +14,9 @@ from ._virtual_machine_templates_operations import VirtualMachineTemplatesOperations from ._availability_sets_operations import AvailabilitySetsOperations from ._inventory_items_operations import InventoryItemsOperations +from ._hybrid_identity_metadatas_operations import HybridIdentityMetadatasOperations +from ._machine_extensions_operations import MachineExtensionsOperations +from ._guest_agents_operations import GuestAgentsOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -28,6 +31,9 @@ "VirtualMachineTemplatesOperations", "AvailabilitySetsOperations", "InventoryItemsOperations", + "HybridIdentityMetadatasOperations", + "MachineExtensionsOperations", + "GuestAgentsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_availability_sets_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_availability_sets_operations.py index 02bd502ef2c0..6c82f8d43e11 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_availability_sets_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_availability_sets_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, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -40,10 +39,6 @@ build_update_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, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -93,9 +88,7 @@ async def get(self, resource_group_name: str, availability_set_name: str, **kwar _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.AvailabilitySet] = kwargs.pop("cls", None) request = build_get_request( @@ -110,8 +103,9 @@ async def get(self, resource_group_name: str, availability_set_name: str, **kwar 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 @@ -150,9 +144,7 @@ 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["2020-06-05-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.AvailabilitySet] = kwargs.pop("cls", None) @@ -179,8 +171,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 @@ -300,7 +293,7 @@ async def begin_create_or_update( :type resource_group_name: str :param availability_set_name: Name of the AvailabilitySet. Required. :type availability_set_name: str - :param body: Request payload. Is either a model type or a IO type. Required. + :param body: Request payload. Is either a AvailabilitySet type or a IO type. Required. :type body: ~azure.mgmt.scvmm.models.AvailabilitySet or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -321,9 +314,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["2020-06-05-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.AvailabilitySet] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -385,9 +376,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["2020-06-05-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( @@ -403,8 +392,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 @@ -457,9 +447,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -518,9 +506,7 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.AvailabilitySet]] = kwargs.pop("cls", None) @@ -547,8 +533,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 @@ -664,7 +651,8 @@ async def begin_update( :type resource_group_name: str :param availability_set_name: Name of the AvailabilitySet. Required. :type availability_set_name: str - :param body: AvailabilitySets patch payload. Is either a model type or a IO type. Required. + :param body: AvailabilitySets patch payload. Is either a ResourcePatch type or a IO type. + Required. :type body: ~azure.mgmt.scvmm.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -685,9 +673,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.AvailabilitySet] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -753,9 +739,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.AvailabilitySetListResult] = kwargs.pop("cls", None) error_map = { @@ -808,8 +792,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 @@ -840,9 +825,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Availabi _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.AvailabilitySetListResult] = kwargs.pop("cls", None) error_map = { @@ -894,8 +877,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/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_clouds_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_clouds_operations.py index c9451ffa0869..8d9ce62ae884 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_clouds_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_clouds_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, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -40,10 +39,6 @@ build_update_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, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -93,9 +88,7 @@ async def get(self, resource_group_name: str, cloud_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.Cloud] = kwargs.pop("cls", None) request = build_get_request( @@ -110,8 +103,9 @@ async def get(self, resource_group_name: str, cloud_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 @@ -146,9 +140,7 @@ 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["2020-06-05-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.Cloud] = kwargs.pop("cls", None) @@ -175,8 +167,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 @@ -285,7 +278,7 @@ async def begin_create_or_update( :type resource_group_name: str :param cloud_name: Name of the Cloud. Required. :type cloud_name: str - :param body: Request payload. Is either a model type or a IO type. Required. + :param body: Request payload. Is either a Cloud type or a IO type. Required. :type body: ~azure.mgmt.scvmm.models.Cloud or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -305,9 +298,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["2020-06-05-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.Cloud] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -369,9 +360,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["2020-06-05-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( @@ -387,8 +376,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 @@ -435,9 +425,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -495,9 +483,7 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.Cloud]] = kwargs.pop("cls", None) @@ -524,8 +510,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 @@ -635,7 +622,7 @@ async def begin_update( :type resource_group_name: str :param cloud_name: Name of the Cloud. Required. :type cloud_name: str - :param body: Clouds patch payload. Is either a model type or a IO type. Required. + :param body: Clouds patch payload. Is either a ResourcePatch type or a IO type. Required. :type body: ~azure.mgmt.scvmm.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -655,9 +642,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.Cloud] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -721,9 +706,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["2020-06-05-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.CloudListResult] = kwargs.pop("cls", None) error_map = { @@ -776,8 +759,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 @@ -808,9 +792,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Cloud"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.CloudListResult] = kwargs.pop("cls", None) error_map = { @@ -862,8 +844,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/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_guest_agents_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_guest_agents_operations.py new file mode 100644 index 000000000000..1b920f204d6b --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_guest_agents_operations.py @@ -0,0 +1,588 @@ +# 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, 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._guest_agents_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_vm_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class GuestAgentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.scvmm.aio.SCVMM`'s + :attr:`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_group_name: str, + virtual_machine_name: str, + guest_agent_name: 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, (IO, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "GuestAgent") + else: + _json = None + + request = build_create_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + guest_agent_name=guest_agent_name, + subscription_id=self._config.subscription_id, + 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": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/guestAgents/{guestAgentName}" + } + + @overload + async def begin_create( + self, + resource_group_name: str, + virtual_machine_name: str, + guest_agent_name: 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_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: Name of the vm. Required. + :type virtual_machine_name: str + :param guest_agent_name: Name of the guestAgents. Required. + :type guest_agent_name: str + :param body: Request payload. Default value is None. + :type body: ~azure.mgmt.scvmm.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.scvmm.models.GuestAgent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + virtual_machine_name: str, + guest_agent_name: 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_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: Name of the vm. Required. + :type virtual_machine_name: str + :param guest_agent_name: Name of the guestAgents. Required. + :type guest_agent_name: 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.scvmm.models.GuestAgent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + virtual_machine_name: str, + guest_agent_name: str, + body: Optional[Union[_models.GuestAgent, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.GuestAgent]: + """Implements GuestAgent PUT method. + + Create Or Update GuestAgent. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: Name of the vm. Required. + :type virtual_machine_name: str + :param guest_agent_name: Name of the guestAgents. Required. + :type guest_agent_name: str + :param body: Request payload. Is either a GuestAgent type or a IO type. Default value is None. + :type body: ~azure.mgmt.scvmm.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.scvmm.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_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + guest_agent_name=guest_agent_name, + 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": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/guestAgents/{guestAgentName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, virtual_machine_name: str, guest_agent_name: str, **kwargs: Any + ) -> _models.GuestAgent: + """Gets GuestAgent. + + Implements GuestAgent GET method. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: Name of the vm. Required. + :type virtual_machine_name: str + :param guest_agent_name: Name of the GuestAgent. Required. + :type guest_agent_name: 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.scvmm.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_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + guest_agent_name=guest_agent_name, + subscription_id=self._config.subscription_id, + 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": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/guestAgents/{guestAgentName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_machine_name: str, guest_agent_name: 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_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + guest_agent_name=guest_agent_name, + subscription_id=self._config.subscription_id, + 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 [200, 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) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/guestAgents/{guestAgentName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, virtual_machine_name: str, guest_agent_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an GuestAgent. + + Implements GuestAgent DELETE method. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: Name of the vm. Required. + :type virtual_machine_name: str + :param guest_agent_name: Name of the GuestAgent. Required. + :type guest_agent_name: 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_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + guest_agent_name=guest_agent_name, + 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": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/guestAgents/{guestAgentName}" + } + + @distributed_trace + def list_by_vm( + self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any + ) -> AsyncIterable["_models.GuestAgent"]: + """Implements GET GuestAgent in a vm. + + Returns the list of GuestAgent of the given vm. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: Name of the vm. Required. + :type virtual_machine_name: 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.scvmm.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_by_vm_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_vm.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_by_vm.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/guestAgents" + } diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_hybrid_identity_metadatas_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_hybrid_identity_metadatas_operations.py new file mode 100644 index 000000000000..2ab486a770ec --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_hybrid_identity_metadatas_operations.py @@ -0,0 +1,447 @@ +# 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, IO, Optional, TypeVar, Union, 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.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._hybrid_identity_metadatas_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_vm_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class HybridIdentityMetadatasOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.scvmm.aio.SCVMM`'s + :attr:`hybrid_identity_metadatas` 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") + + @overload + async def create( + self, + resource_group_name: str, + virtual_machine_name: str, + metadata_name: str, + body: Optional[_models.HybridIdentityMetadata] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HybridIdentityMetadata: + """Implements HybridIdentityMetadata PUT method. + + Create Or Update HybridIdentityMetadata. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: Name of the vm. Required. + :type virtual_machine_name: str + :param metadata_name: Name of the hybridIdentityMetadata. Required. + :type metadata_name: str + :param body: Request payload. Default value is None. + :type body: ~azure.mgmt.scvmm.models.HybridIdentityMetadata + :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 + :return: HybridIdentityMetadata or the result of cls(response) + :rtype: ~azure.mgmt.scvmm.models.HybridIdentityMetadata + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + virtual_machine_name: str, + metadata_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HybridIdentityMetadata: + """Implements HybridIdentityMetadata PUT method. + + Create Or Update HybridIdentityMetadata. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: Name of the vm. Required. + :type virtual_machine_name: str + :param metadata_name: Name of the hybridIdentityMetadata. Required. + :type metadata_name: 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 + :return: HybridIdentityMetadata or the result of cls(response) + :rtype: ~azure.mgmt.scvmm.models.HybridIdentityMetadata + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + virtual_machine_name: str, + metadata_name: str, + body: Optional[Union[_models.HybridIdentityMetadata, IO]] = None, + **kwargs: Any + ) -> _models.HybridIdentityMetadata: + """Implements HybridIdentityMetadata PUT method. + + Create Or Update HybridIdentityMetadata. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: Name of the vm. Required. + :type virtual_machine_name: str + :param metadata_name: Name of the hybridIdentityMetadata. Required. + :type metadata_name: str + :param body: Request payload. Is either a HybridIdentityMetadata type or a IO type. Default + value is None. + :type body: ~azure.mgmt.scvmm.models.HybridIdentityMetadata 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 + :return: HybridIdentityMetadata or the result of cls(response) + :rtype: ~azure.mgmt.scvmm.models.HybridIdentityMetadata + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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.HybridIdentityMetadata] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "HybridIdentityMetadata") + else: + _json = None + + request = build_create_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + metadata_name=metadata_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create.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("HybridIdentityMetadata", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, virtual_machine_name: str, metadata_name: str, **kwargs: Any + ) -> _models.HybridIdentityMetadata: + """Gets HybridIdentityMetadata. + + Implements HybridIdentityMetadata GET method. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: Name of the vm. Required. + :type virtual_machine_name: str + :param metadata_name: Name of the HybridIdentityMetadata. Required. + :type metadata_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridIdentityMetadata or the result of cls(response) + :rtype: ~azure.mgmt.scvmm.models.HybridIdentityMetadata + :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.HybridIdentityMetadata] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + metadata_name=metadata_name, + subscription_id=self._config.subscription_id, + 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("HybridIdentityMetadata", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_machine_name: str, metadata_name: str, **kwargs: Any + ) -> None: + """Deletes an HybridIdentityMetadata. + + Implements HybridIdentityMetadata DELETE method. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: Name of the vm. Required. + :type virtual_machine_name: str + :param metadata_name: Name of the HybridIdentityMetadata. Required. + :type metadata_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :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[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + metadata_name=metadata_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.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, 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) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}" + } + + @distributed_trace + def list_by_vm( + self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any + ) -> AsyncIterable["_models.HybridIdentityMetadata"]: + """Implements GET HybridIdentityMetadata in a vm. + + Returns the list of HybridIdentityMetadata of the given vm. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: Name of the vm. Required. + :type virtual_machine_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HybridIdentityMetadata or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.scvmm.models.HybridIdentityMetadata] + :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.HybridIdentityMetadataList] = 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_by_vm_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_vm.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("HybridIdentityMetadataList", 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_by_vm.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/hybridIdentityMetadata" + } diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_inventory_items_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_inventory_items_operations.py index 9323641f8a14..1e74b0ec6cd5 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_inventory_items_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_inventory_items_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, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -36,10 +35,6 @@ build_list_by_vmm_server_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, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -146,7 +141,8 @@ async def create( :type vmm_server_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.scvmm.models.InventoryItem or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -167,9 +163,7 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -200,8 +194,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 @@ -252,9 +247,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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( @@ -270,8 +263,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 @@ -322,9 +316,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["2020-06-05-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( @@ -340,8 +332,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 @@ -378,9 +371,7 @@ def list_by_vmm_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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 = { @@ -434,8 +425,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/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_machine_extensions_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_machine_extensions_operations.py new file mode 100644 index 000000000000..3d731908f063 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_machine_extensions_operations.py @@ -0,0 +1,830 @@ +# 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, 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._machine_extensions_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class MachineExtensionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.scvmm.aio.SCVMM`'s + :attr:`machine_extensions` 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_group_name: str, + virtual_machine_name: str, + extension_name: str, + extension_parameters: Union[_models.MachineExtension, IO], + **kwargs: Any + ) -> _models.MachineExtension: + 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.MachineExtension] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(extension_parameters, (IO, bytes)): + _content = extension_parameters + else: + _json = self._serialize.body(extension_parameters, "MachineExtension") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + extension_name=extension_name, + subscription_id=self._config.subscription_id, + 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("MachineExtension", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("MachineExtension", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/extensions/{extensionName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_machine_name: str, + extension_name: str, + extension_parameters: _models.MachineExtension, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MachineExtension]: + """The operation to create or update the extension. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the machine where the extension should be created or + updated. Required. + :type virtual_machine_name: str + :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. + Required. + :type extension_parameters: ~azure.mgmt.scvmm.models.MachineExtension + :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 MachineExtension or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.scvmm.models.MachineExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_machine_name: str, + extension_name: str, + extension_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MachineExtension]: + """The operation to create or update the extension. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the machine where the extension should be created or + updated. Required. + :type virtual_machine_name: str + :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. + Required. + :type extension_parameters: 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 MachineExtension or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.scvmm.models.MachineExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_machine_name: str, + extension_name: str, + extension_parameters: Union[_models.MachineExtension, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.MachineExtension]: + """The operation to create or update the extension. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the machine where the extension should be created or + updated. Required. + :type virtual_machine_name: str + :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 MachineExtension type or a IO type. Required. + :type extension_parameters: ~azure.mgmt.scvmm.models.MachineExtension 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 MachineExtension or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.scvmm.models.MachineExtension] + :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.MachineExtension] = 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_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + extension_name=extension_name, + extension_parameters=extension_parameters, + 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("MachineExtension", 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": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/extensions/{extensionName}" + } + + async def _update_initial( + self, + resource_group_name: str, + virtual_machine_name: str, + extension_name: str, + extension_parameters: Union[_models.MachineExtensionUpdate, IO], + **kwargs: Any + ) -> Optional[_models.MachineExtension]: + 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.MachineExtension]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(extension_parameters, (IO, bytes)): + _content = extension_parameters + else: + _json = self._serialize.body(extension_parameters, "MachineExtensionUpdate") + + request = build_update_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + extension_name=extension_name, + subscription_id=self._config.subscription_id, + 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("MachineExtension", pipeline_response) + + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/extensions/{extensionName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + virtual_machine_name: str, + extension_name: str, + extension_parameters: _models.MachineExtensionUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MachineExtension]: + """The operation to update the extension. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the machine where the extension should be created or + updated. Required. + :type virtual_machine_name: str + :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. + Required. + :type extension_parameters: ~azure.mgmt.scvmm.models.MachineExtensionUpdate + :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 MachineExtension or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.scvmm.models.MachineExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + virtual_machine_name: str, + extension_name: str, + extension_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MachineExtension]: + """The operation to update the extension. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the machine where the extension should be created or + updated. Required. + :type virtual_machine_name: str + :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. + Required. + :type extension_parameters: 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 MachineExtension or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.scvmm.models.MachineExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + virtual_machine_name: str, + extension_name: str, + extension_parameters: Union[_models.MachineExtensionUpdate, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.MachineExtension]: + """The operation to update the extension. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the machine where the extension should be created or + updated. Required. + :type virtual_machine_name: str + :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 MachineExtensionUpdate type or a IO type. Required. + :type extension_parameters: ~azure.mgmt.scvmm.models.MachineExtensionUpdate 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 MachineExtension or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.scvmm.models.MachineExtension] + :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.MachineExtension] = 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_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + extension_name=extension_name, + extension_parameters=extension_parameters, + 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("MachineExtension", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + 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_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/extensions/{extensionName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_machine_name: str, extension_name: 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_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + extension_name=extension_name, + subscription_id=self._config.subscription_id, + 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 [200, 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) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/extensions/{extensionName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, virtual_machine_name: str, extension_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to delete the extension. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the machine where the extension should be created or + updated. Required. + :type virtual_machine_name: str + :param extension_name: The name of the machine extension. Required. + :type extension_name: 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_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + extension_name=extension_name, + 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": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/extensions/{extensionName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, virtual_machine_name: str, extension_name: str, **kwargs: Any + ) -> _models.MachineExtension: + """The operation to get the extension. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the machine where the extension should be created or + updated. Required. + :type virtual_machine_name: str + :param extension_name: The name of the machine extension. Required. + :type extension_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MachineExtension or the result of cls(response) + :rtype: ~azure.mgmt.scvmm.models.MachineExtension + :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.MachineExtension] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + extension_name=extension_name, + subscription_id=self._config.subscription_id, + 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("MachineExtension", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/extensions/{extensionName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, virtual_machine_name: str, expand: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.MachineExtension"]: + """The operation to get all extensions of a non-Azure machine. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the machine where the extension should be created or + updated. Required. + :type virtual_machine_name: str + :param expand: The expand expression to apply on the operation. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MachineExtension or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.scvmm.models.MachineExtension] + :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.MachineExtensionsListResult] = 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_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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("MachineExtensionsListResult", 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": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/extensions" + } diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_operations.py index 2633d340433a..19f0d11fa602 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/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 @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_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, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,9 +66,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperatio _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.ResourceProviderOperationList] = kwargs.pop("cls", None) error_map = { @@ -124,8 +117,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/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_machine_templates_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_machine_templates_operations.py index ec8695ee33ed..2c833da6ad76 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_machine_templates_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_machine_templates_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, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -40,10 +39,6 @@ build_update_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, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -95,9 +90,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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( @@ -112,8 +105,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 @@ -152,9 +146,7 @@ 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["2020-06-05-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) @@ -181,8 +173,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 @@ -297,7 +290,7 @@ async def begin_create_or_update( :type resource_group_name: str :param virtual_machine_template_name: Name of the VirtualMachineTemplate. Required. :type virtual_machine_template_name: str - :param body: Request payload. Is either a model type or a IO type. Required. + :param body: Request payload. Is either a VirtualMachineTemplate type or a IO type. Required. :type body: ~azure.mgmt.scvmm.models.VirtualMachineTemplate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -318,9 +311,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["2020-06-05-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) @@ -382,9 +373,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["2020-06-05-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( @@ -400,8 +389,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 @@ -448,9 +438,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -512,9 +500,7 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.VirtualMachineTemplate]] = kwargs.pop("cls", None) @@ -541,8 +527,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 @@ -658,8 +645,8 @@ async def begin_update( :type resource_group_name: str :param virtual_machine_template_name: Name of the VirtualMachineTemplate. Required. :type virtual_machine_template_name: str - :param body: VirtualMachineTemplates patch details. Is either a model type or a IO type. - Required. + :param body: VirtualMachineTemplates patch details. Is either a ResourcePatch type or a IO + type. Required. :type body: ~azure.mgmt.scvmm.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -680,9 +667,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -750,9 +735,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.VirtualMachineTemplateListResult] = kwargs.pop("cls", None) error_map = { @@ -805,8 +788,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 @@ -839,9 +823,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.VirtualM _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.VirtualMachineTemplateListResult] = kwargs.pop("cls", None) error_map = { @@ -893,8 +875,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/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_machines_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_machines_operations.py index ee013db6947c..eb31cdbbe56f 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_machines_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_machines_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, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -46,10 +45,6 @@ build_update_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, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -99,9 +94,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["2020-06-05-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( @@ -116,8 +109,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 @@ -156,9 +150,7 @@ 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["2020-06-05-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) @@ -185,8 +177,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 @@ -301,7 +294,7 @@ async def begin_create_or_update( :type resource_group_name: str :param virtual_machine_name: Name of the VirtualMachine. Required. :type virtual_machine_name: str - :param body: Request payload. Is either a model type or a IO type. Required. + :param body: Request payload. Is either a VirtualMachine type or a IO type. Required. :type body: ~azure.mgmt.scvmm.models.VirtualMachine or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -322,9 +315,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["2020-06-05-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) @@ -378,6 +369,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements virtual_machine_name: str, retain: Optional[bool] = None, force: Optional[bool] = None, + delete_from_host: Optional[bool] = None, **kwargs: Any ) -> None: error_map = { @@ -391,9 +383,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["2020-06-05-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( @@ -402,6 +392,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, retain=retain, force=force, + delete_from_host=delete_from_host, api_version=api_version, template_url=self._delete_initial.metadata["url"], headers=_headers, @@ -410,8 +401,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 @@ -435,6 +427,7 @@ async def begin_delete( virtual_machine_name: str, retain: Optional[bool] = None, force: Optional[bool] = None, + delete_from_host: Optional[bool] = None, **kwargs: Any ) -> AsyncLROPoller[None]: """Implements VirtualMachine DELETE method. @@ -451,6 +444,9 @@ async def begin_delete( :param force: Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted too. Default value is None. :type force: bool + :param delete_from_host: Whether to disable the VM from azure and also delete it from VMM. + Default value is None. + :type delete_from_host: 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 @@ -466,9 +462,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -479,6 +473,7 @@ async def begin_delete( virtual_machine_name=virtual_machine_name, retain=retain, force=force, + delete_from_host=delete_from_host, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -531,9 +526,7 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -560,8 +553,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 @@ -677,7 +671,8 @@ async def begin_update( :type resource_group_name: str :param virtual_machine_name: Name of the VirtualMachine. Required. :type virtual_machine_name: str - :param body: VirtualMachines patch payload. Is either a model type or a IO type. Required. + :param body: VirtualMachines patch payload. Is either a VirtualMachineUpdate type or a IO type. + Required. :type body: ~azure.mgmt.scvmm.models.VirtualMachineUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -698,9 +693,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -766,9 +759,7 @@ 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["2020-06-05-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) @@ -798,8 +789,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 @@ -904,8 +896,8 @@ async def begin_stop( :type resource_group_name: str :param virtual_machine_name: Name of the VirtualMachine. 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.scvmm.models.StopVirtualMachineOptions or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -925,9 +917,7 @@ async def begin_stop( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -984,9 +974,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["2020-06-05-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( @@ -1001,8 +989,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 @@ -1046,9 +1035,7 @@ async def begin_start( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -1102,9 +1089,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["2020-06-05-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( @@ -1119,8 +1104,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 @@ -1164,9 +1150,7 @@ async def begin_restart( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -1224,9 +1208,7 @@ async def _create_checkpoint_initial( # pylint: disable=inconsistent-return-sta _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -1256,8 +1238,9 @@ async def _create_checkpoint_initial( # pylint: disable=inconsistent-return-sta 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 @@ -1362,8 +1345,8 @@ async def begin_create_checkpoint( :type resource_group_name: str :param virtual_machine_name: Name of the VirtualMachine. Required. :type virtual_machine_name: str - :param body: Virtualmachine create checkpoint action payload. Is either a model type or a IO - type. Default value is None. + :param body: Virtualmachine create checkpoint action payload. Is either a + VirtualMachineCreateCheckpoint type or a IO type. Default value is None. :type body: ~azure.mgmt.scvmm.models.VirtualMachineCreateCheckpoint or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1383,9 +1366,7 @@ async def begin_create_checkpoint( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -1446,9 +1427,7 @@ async def _delete_checkpoint_initial( # pylint: disable=inconsistent-return-sta _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -1478,8 +1457,9 @@ async def _delete_checkpoint_initial( # pylint: disable=inconsistent-return-sta 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 @@ -1584,8 +1564,8 @@ async def begin_delete_checkpoint( :type resource_group_name: str :param virtual_machine_name: Name of the VirtualMachine. Required. :type virtual_machine_name: str - :param body: Virtualmachine delete checkpoint action payload. Is either a model type or a IO - type. Default value is None. + :param body: Virtualmachine delete checkpoint action payload. Is either a + VirtualMachineDeleteCheckpoint type or a IO type. Default value is None. :type body: ~azure.mgmt.scvmm.models.VirtualMachineDeleteCheckpoint or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1605,9 +1585,7 @@ async def begin_delete_checkpoint( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -1668,9 +1646,7 @@ async def _restore_checkpoint_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["2020-06-05-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) @@ -1700,8 +1676,9 @@ async def _restore_checkpoint_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( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1806,8 +1783,8 @@ async def begin_restore_checkpoint( :type resource_group_name: str :param virtual_machine_name: Name of the VirtualMachine. Required. :type virtual_machine_name: str - :param body: Virtualmachine restore checkpoint action payload. Is either a model type or a IO - type. Default value is None. + :param body: Virtualmachine restore checkpoint action payload. Is either a + VirtualMachineRestoreCheckpoint type or a IO type. Default value is None. :type body: ~azure.mgmt.scvmm.models.VirtualMachineRestoreCheckpoint or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1827,9 +1804,7 @@ async def begin_restore_checkpoint( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -1890,9 +1865,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.VirtualMachineListResult] = kwargs.pop("cls", None) error_map = { @@ -1945,8 +1918,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 @@ -1977,9 +1951,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.VirtualM _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.VirtualMachineListResult] = kwargs.pop("cls", None) error_map = { @@ -2031,8 +2003,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/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_networks_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_networks_operations.py index f90a1f745c50..effcc18f66d4 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_networks_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_networks_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, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -40,10 +39,6 @@ build_update_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, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -93,9 +88,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["2020-06-05-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( @@ -110,8 +103,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 @@ -150,9 +144,7 @@ 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["2020-06-05-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) @@ -179,8 +171,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 @@ -295,7 +288,7 @@ async def begin_create_or_update( :type resource_group_name: str :param virtual_network_name: Name of the VirtualNetwork. Required. :type virtual_network_name: str - :param body: Request payload. Is either a model type or a IO type. Required. + :param body: Request payload. Is either a VirtualNetwork type or a IO type. Required. :type body: ~azure.mgmt.scvmm.models.VirtualNetwork or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -316,9 +309,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["2020-06-05-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) @@ -380,9 +371,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["2020-06-05-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( @@ -398,8 +387,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 @@ -446,9 +436,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -506,9 +494,7 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.VirtualNetwork]] = kwargs.pop("cls", None) @@ -535,8 +521,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 @@ -648,7 +635,8 @@ async def begin_update( :type resource_group_name: str :param virtual_network_name: Name of the VirtualNetwork. Required. :type virtual_network_name: str - :param body: VirtualNetworks patch payload. Is either a model type or a IO type. Required. + :param body: VirtualNetworks patch payload. Is either a ResourcePatch type or a IO type. + Required. :type body: ~azure.mgmt.scvmm.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -669,9 +657,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -737,9 +723,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.VirtualNetworkListResult] = kwargs.pop("cls", None) error_map = { @@ -792,8 +776,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 @@ -824,9 +809,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.VirtualN _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.VirtualNetworkListResult] = kwargs.pop("cls", None) error_map = { @@ -878,8 +861,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/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_vmm_servers_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_vmm_servers_operations.py index 1d897b760988..fa67771e5d6d 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_vmm_servers_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_vmm_servers_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, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -40,10 +39,6 @@ build_update_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, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -93,9 +88,7 @@ async def get(self, resource_group_name: str, vmm_server_name: str, **kwargs: An _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.VMMServer] = kwargs.pop("cls", None) request = build_get_request( @@ -110,8 +103,9 @@ async def get(self, resource_group_name: str, vmm_server_name: str, **kwargs: An 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 @@ -146,9 +140,7 @@ 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["2020-06-05-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.VMMServer] = kwargs.pop("cls", None) @@ -175,8 +167,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 @@ -287,7 +280,7 @@ async def begin_create_or_update( :type resource_group_name: str :param vmm_server_name: Name of the VMMServer. Required. :type vmm_server_name: str - :param body: Request payload. Is either a model type or a IO type. Required. + :param body: Request payload. Is either a VMMServer type or a IO type. Required. :type body: ~azure.mgmt.scvmm.models.VMMServer or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -308,9 +301,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["2020-06-05-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.VMMServer] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -372,9 +363,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["2020-06-05-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( @@ -390,8 +379,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 @@ -438,9 +428,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -498,9 +486,7 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.VMMServer]] = kwargs.pop("cls", None) @@ -527,8 +513,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 @@ -640,7 +627,7 @@ async def begin_update( :type resource_group_name: str :param vmm_server_name: Name of the VMMServer. Required. :type vmm_server_name: str - :param body: VmmServers patch payload. Is either a model type or a IO type. Required. + :param body: VmmServers patch payload. Is either a ResourcePatch type or a IO type. Required. :type body: ~azure.mgmt.scvmm.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -661,9 +648,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.VMMServer] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -727,9 +712,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["2020-06-05-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.VMMServerListResult] = kwargs.pop("cls", None) error_map = { @@ -782,8 +765,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 @@ -814,9 +798,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.VMMServe _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.VMMServerListResult] = kwargs.pop("cls", None) error_map = { @@ -868,8 +850,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/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/models/__init__.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/models/__init__.py index 3175f63e5b6e..197ab1be6873 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/models/__init__.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/models/__init__.py @@ -14,15 +14,31 @@ from ._models_py3 import CloudCapacity from ._models_py3 import CloudInventoryItem from ._models_py3 import CloudListResult +from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ErrorDefinition +from ._models_py3 import ErrorDetail from ._models_py3 import ErrorResponse from ._models_py3 import ExtendedLocation +from ._models_py3 import GuestAgent +from ._models_py3 import GuestAgentList +from ._models_py3 import GuestAgentProfile +from ._models_py3 import GuestCredential from ._models_py3 import HardwareProfile from ._models_py3 import HardwareProfileUpdate +from ._models_py3 import HttpProxyConfiguration +from ._models_py3 import HybridIdentityMetadata +from ._models_py3 import HybridIdentityMetadataList +from ._models_py3 import Identity from ._models_py3 import InventoryItem from ._models_py3 import InventoryItemDetails from ._models_py3 import InventoryItemProperties from ._models_py3 import InventoryItemsList +from ._models_py3 import MachineExtension +from ._models_py3 import MachineExtensionInstanceView +from ._models_py3 import MachineExtensionInstanceViewStatus +from ._models_py3 import MachineExtensionPropertiesInstanceView +from ._models_py3 import MachineExtensionUpdate +from ._models_py3 import MachineExtensionsListResult from ._models_py3 import NetworkInterfaces from ._models_py3 import NetworkInterfacesUpdate from ._models_py3 import NetworkProfile @@ -40,6 +56,7 @@ from ._models_py3 import StorageQoSPolicy from ._models_py3 import StorageQoSPolicyDetails from ._models_py3 import SystemData +from ._models_py3 import TrackedResource from ._models_py3 import VMMServer from ._models_py3 import VMMServerListResult from ._models_py3 import VMMServerPropertiesCredentials @@ -64,10 +81,14 @@ from ._scvmm_enums import CreateDiffDisk from ._scvmm_enums import CreatedByType from ._scvmm_enums import DynamicMemoryEnabled +from ._scvmm_enums import IdentityType from ._scvmm_enums import InventoryType from ._scvmm_enums import IsCustomizable from ._scvmm_enums import LimitCpuForMigration from ._scvmm_enums import OsType +from ._scvmm_enums import ProvisioningAction +from ._scvmm_enums import StatusLevelTypes +from ._scvmm_enums import StatusTypes from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk @@ -81,15 +102,31 @@ "CloudCapacity", "CloudInventoryItem", "CloudListResult", + "ErrorAdditionalInfo", "ErrorDefinition", + "ErrorDetail", "ErrorResponse", "ExtendedLocation", + "GuestAgent", + "GuestAgentList", + "GuestAgentProfile", + "GuestCredential", "HardwareProfile", "HardwareProfileUpdate", + "HttpProxyConfiguration", + "HybridIdentityMetadata", + "HybridIdentityMetadataList", + "Identity", "InventoryItem", "InventoryItemDetails", "InventoryItemProperties", "InventoryItemsList", + "MachineExtension", + "MachineExtensionInstanceView", + "MachineExtensionInstanceViewStatus", + "MachineExtensionPropertiesInstanceView", + "MachineExtensionUpdate", + "MachineExtensionsListResult", "NetworkInterfaces", "NetworkInterfacesUpdate", "NetworkProfile", @@ -107,6 +144,7 @@ "StorageQoSPolicy", "StorageQoSPolicyDetails", "SystemData", + "TrackedResource", "VMMServer", "VMMServerListResult", "VMMServerPropertiesCredentials", @@ -130,10 +168,14 @@ "CreateDiffDisk", "CreatedByType", "DynamicMemoryEnabled", + "IdentityType", "InventoryType", "IsCustomizable", "LimitCpuForMigration", "OsType", + "ProvisioningAction", + "StatusLevelTypes", + "StatusTypes", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/models/_models_py3.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/models/_models_py3.py index 852ced1b43f1..282a9e617ad7 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/models/_models_py3.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/models/_models_py3.py @@ -8,13 +8,20 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, TYPE_CHECKING, Union +import sys +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from .. import _serialization +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from .. import models as _models +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object class AvailabilitySet(_serialization.Model): @@ -74,8 +81,8 @@ def __init__( extended_location: Optional["_models.ExtendedLocation"] = None, availability_set_name: Optional[str] = None, vmm_server_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Gets or sets the location. :paramtype location: str @@ -116,8 +123,12 @@ class AvailabilitySetListItem(_serialization.Model): } def __init__( - self, *, id: Optional[str] = None, name: Optional[str] = None, **kwargs # pylint: disable=redefined-builtin - ): + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword id: Gets the ARM Id of the microsoft.scvmm/availabilitySets resource. :paramtype id: str @@ -144,8 +155,8 @@ class AvailabilitySetListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.AvailabilitySet"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.AvailabilitySet"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of AvailabilitySets. :paramtype value: list[~azure.mgmt.scvmm.models.AvailabilitySet] @@ -184,8 +195,8 @@ def __init__( checkpoint_id: Optional[str] = None, name: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword parent_checkpoint_id: Gets ID of parent of the checkpoint. :paramtype parent_checkpoint_id: str @@ -280,8 +291,8 @@ def __init__( inventory_item_id: Optional[str] = None, uuid: Optional[str] = None, vmm_server_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Gets or sets the location. Required. :paramtype location: str @@ -337,8 +348,8 @@ def __init__( cpu_count: Optional[int] = None, memory_mb: Optional[int] = None, vm_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword cpu_count: CPUCount specifies the maximum number of CPUs that can be allocated in the cloud. @@ -404,7 +415,7 @@ class InventoryItemProperties(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.inventory_type: Optional[str] = None @@ -451,7 +462,7 @@ class CloudInventoryItem(InventoryItemProperties): "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.inventory_type: str = "Cloud" @@ -471,7 +482,9 @@ class CloudListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Cloud"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Cloud"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of Clouds. :paramtype value: list[~azure.mgmt.scvmm.models.Cloud] @@ -483,6 +496,34 @@ def __init__(self, *, value: Optional[List["_models.Cloud"]] = None, next_link: self.next_link = next_link +class ErrorAdditionalInfo(_serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: JSON + """ + + _validation = { + "type": {"readonly": True}, + "info": {"readonly": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "info": {"key": "info", "type": "object"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.type = None + self.info = None + + class ErrorDefinition(_serialization.Model): """Error definition. @@ -508,7 +549,7 @@ class ErrorDefinition(_serialization.Model): "details": {"key": "details", "type": "[ErrorDefinition]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -516,6 +557,49 @@ def __init__(self, **kwargs): self.details = None +class ErrorDetail(_serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.scvmm.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.scvmm.models.ErrorAdditionalInfo] + """ + + _validation = { + "code": {"readonly": True}, + "message": {"readonly": True}, + "target": {"readonly": True}, + "details": {"readonly": True}, + "additional_info": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ErrorDetail]"}, + "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + class ErrorResponse(_serialization.Model): """Error response. @@ -527,7 +611,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDefinition"}, } - def __init__(self, *, error: Optional["_models.ErrorDefinition"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDefinition"] = None, **kwargs: Any) -> None: """ :keyword error: The error details. :paramtype error: ~azure.mgmt.scvmm.models.ErrorDefinition @@ -550,7 +634,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 @@ -562,6 +646,281 @@ def __init__(self, *, type: Optional[str] = None, name: Optional[str] = None, ** self.name = name +class Resource(_serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + 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}. + :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.scvmm.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: 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. + + 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}. + :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.scvmm.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: Any) -> None: + """ """ + super().__init__(**kwargs) + + +class GuestAgent(ProxyResource): # pylint: disable=too-many-instance-attributes + """Defines the GuestAgent. + + 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}. + :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.scvmm.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.scvmm.models.GuestCredential + :ivar http_proxy_config: HTTP Proxy configuration for the VM. + :vartype http_proxy_config: ~azure.mgmt.scvmm.models.HttpProxyConfiguration + :ivar provisioning_action: Gets or sets the guest agent provisioning action. Known values are: + "install", "uninstall", and "repair". + :vartype provisioning_action: str or ~azure.mgmt.scvmm.models.ProvisioningAction + :ivar status: Gets or sets the guest agent status. + :vartype status: str + :ivar custom_resource_name: Gets the name of the corresponding resource in Kubernetes. + :vartype custom_resource_name: str + :ivar provisioning_state: Gets or sets the provisioning state. + :vartype provisioning_state: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "uuid": {"readonly": True}, + "status": {"readonly": True}, + "custom_resource_name": {"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"}, + "uuid": {"key": "properties.uuid", "type": "str"}, + "credentials": {"key": "properties.credentials", "type": "GuestCredential"}, + "http_proxy_config": {"key": "properties.httpProxyConfig", "type": "HttpProxyConfiguration"}, + "provisioning_action": {"key": "properties.provisioningAction", "type": "str"}, + "status": {"key": "properties.status", "type": "str"}, + "custom_resource_name": {"key": "properties.customResourceName", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + credentials: Optional["_models.GuestCredential"] = None, + http_proxy_config: Optional["_models.HttpProxyConfiguration"] = None, + provisioning_action: Optional[Union[str, "_models.ProvisioningAction"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword credentials: Username / Password Credentials to provision guest agent. + :paramtype credentials: ~azure.mgmt.scvmm.models.GuestCredential + :keyword http_proxy_config: HTTP Proxy configuration for the VM. + :paramtype http_proxy_config: ~azure.mgmt.scvmm.models.HttpProxyConfiguration + :keyword provisioning_action: Gets or sets the guest agent provisioning action. Known values + are: "install", "uninstall", and "repair". + :paramtype provisioning_action: str or ~azure.mgmt.scvmm.models.ProvisioningAction + """ + super().__init__(**kwargs) + self.uuid = None + self.credentials = credentials + self.http_proxy_config = http_proxy_config + self.provisioning_action = provisioning_action + self.status = None + self.custom_resource_name = None + self.provisioning_state = None + + +class GuestAgentList(_serialization.Model): + """List of GuestAgent. + + All required parameters must be populated in order to send to Azure. + + :ivar next_link: Url to follow for getting next page of GuestAgent. + :vartype next_link: str + :ivar value: Array of GuestAgent. Required. + :vartype value: list[~azure.mgmt.scvmm.models.GuestAgent] + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[GuestAgent]"}, + } + + 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 + :keyword value: Array of GuestAgent. Required. + :paramtype value: list[~azure.mgmt.scvmm.models.GuestAgent] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class GuestAgentProfile(_serialization.Model): + """Defines the resource properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar vm_uuid: Specifies the VM's unique SMBIOS ID. + :vartype vm_uuid: str + :ivar status: The status of the hybrid machine agent. Known values are: "Connected", + "Disconnected", and "Error". + :vartype status: str or ~azure.mgmt.scvmm.models.StatusTypes + :ivar last_status_change: The time of the last status change. + :vartype last_status_change: ~datetime.datetime + :ivar client_public_key: Gets or sets the Public Key provided by the client for enabling guest + management. + :vartype client_public_key: str + :ivar agent_version: The hybrid machine agent full version. + :vartype agent_version: str + :ivar error_details: Details about the error state. + :vartype error_details: list[~azure.mgmt.scvmm.models.ErrorDetail] + """ + + _validation = { + "vm_uuid": {"readonly": True}, + "status": {"readonly": True}, + "last_status_change": {"readonly": True}, + "agent_version": {"readonly": True}, + "error_details": {"readonly": True}, + } + + _attribute_map = { + "vm_uuid": {"key": "vmUuid", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "last_status_change": {"key": "lastStatusChange", "type": "iso-8601"}, + "client_public_key": {"key": "clientPublicKey", "type": "str"}, + "agent_version": {"key": "agentVersion", "type": "str"}, + "error_details": {"key": "errorDetails", "type": "[ErrorDetail]"}, + } + + 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. + :paramtype client_public_key: str + """ + super().__init__(**kwargs) + self.vm_uuid = None + self.status = None + self.last_status_change = None + self.client_public_key = client_public_key + self.agent_version = None + self.error_details = None + + +class GuestCredential(_serialization.Model): + """Username / Password Credentials to connect to guest. + + :ivar username: Gets or sets username to connect with the guest. + :vartype username: str + :ivar password: Gets or sets the password to connect with the guest. + :vartype password: str + """ + + _attribute_map = { + "username": {"key": "username", "type": "str"}, + "password": {"key": "password", "type": "str"}, + } + + 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 + :keyword password: Gets or sets the password to connect with the guest. + :paramtype password: str + """ + super().__init__(**kwargs) + self.username = username + self.password = password + + class HardwareProfile(_serialization.Model): """Defines the resource properties. @@ -603,8 +962,8 @@ def __init__( dynamic_memory_max_mb: Optional[int] = None, dynamic_memory_min_mb: Optional[int] = None, is_highly_available: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword memory_mb: MemoryMB is the size of a virtual machine's memory, in MB. :paramtype memory_mb: int @@ -670,8 +1029,8 @@ def __init__( dynamic_memory_enabled: Optional[Union[str, "_models.DynamicMemoryEnabled"]] = None, dynamic_memory_max_mb: Optional[int] = None, dynamic_memory_min_mb: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword memory_mb: MemoryMB is the size of a virtual machine's memory, in MB. :paramtype memory_mb: int @@ -689,19 +1048,313 @@ def __init__( :paramtype dynamic_memory_min_mb: int """ super().__init__(**kwargs) - self.memory_mb = memory_mb - self.cpu_count = cpu_count - self.limit_cpu_for_migration = limit_cpu_for_migration - self.dynamic_memory_enabled = dynamic_memory_enabled - self.dynamic_memory_max_mb = dynamic_memory_max_mb - self.dynamic_memory_min_mb = dynamic_memory_min_mb + self.memory_mb = memory_mb + self.cpu_count = cpu_count + self.limit_cpu_for_migration = limit_cpu_for_migration + self.dynamic_memory_enabled = dynamic_memory_enabled + self.dynamic_memory_max_mb = dynamic_memory_max_mb + self.dynamic_memory_min_mb = dynamic_memory_min_mb + + +class HttpProxyConfiguration(_serialization.Model): + """HTTP Proxy configuration for the VM. + + :ivar https_proxy: Gets or sets httpsProxy url. + :vartype https_proxy: str + """ + + _attribute_map = { + "https_proxy": {"key": "httpsProxy", "type": "str"}, + } + + def __init__(self, *, https_proxy: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword https_proxy: Gets or sets httpsProxy url. + :paramtype https_proxy: str + """ + super().__init__(**kwargs) + self.https_proxy = https_proxy + + +class HybridIdentityMetadata(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. Ex - + /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.scvmm.models.SystemData + :ivar resource_uid: Gets or sets the Vm Id. + :vartype resource_uid: str + :ivar public_key: Gets or sets the Public Key. + :vartype public_key: str + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.scvmm.models.Identity + :ivar provisioning_state: Gets or sets the provisioning state. + :vartype provisioning_state: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "identity": {"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"}, + "identity": {"key": "properties.identity", "type": "Identity"}, + "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: Gets or sets the Vm Id. + :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.identity = None + self.provisioning_state = None + + +class HybridIdentityMetadataList(_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.scvmm.models.HybridIdentityMetadata] + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[HybridIdentityMetadata]"}, + } + + 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 + :keyword value: Array of HybridIdentityMetadata. Required. + :paramtype value: list[~azure.mgmt.scvmm.models.HybridIdentityMetadata] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class Identity(_serialization.Model): + """Managed service identity. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar principal_id: The principal id of managed service identity. + :vartype principal_id: str + :ivar tenant_id: The tenant of managed service identity. + :vartype tenant_id: str + :ivar type: The type of managed service identity. Required. Known values are: "None" and + "SystemAssigned". + :vartype type: str or ~azure.mgmt.scvmm.models.IdentityType + """ + + _validation = { + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, + "type": {"required": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + } + + 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". + :paramtype type: str or ~azure.mgmt.scvmm.models.IdentityType + """ + super().__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + + +class InventoryItem(ProxyResource): + """Defines the inventory item. + + Variables are only populated by the server, and will be ignored when sending a request. + + 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}. + :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.scvmm.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, + the resource provider must validate and persist this value. + :vartype kind: str + :ivar inventory_type: They inventory type. Required. Known values are: "Cloud", + "VirtualNetwork", "VirtualMachineTemplate", and "VirtualMachine". + :vartype inventory_type: str or ~azure.mgmt.scvmm.models.InventoryType + :ivar managed_resource_id: Gets the tracked resource id corresponding to the inventory + resource. + :vartype managed_resource_id: str + :ivar uuid: Gets the UUID (which is assigned by VMM) for the inventory item. + :vartype uuid: str + :ivar inventory_item_name: Gets the Managed Object name in VMM for the inventory item. + :vartype inventory_item_name: str + :ivar provisioning_state: Gets the provisioning state. + :vartype provisioning_state: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "inventory_type": {"required": True}, + "managed_resource_id": {"readonly": True}, + "uuid": {"readonly": True}, + "inventory_item_name": {"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"}, + "kind": {"key": "kind", "type": "str"}, + "inventory_type": {"key": "properties.inventoryType", "type": "str"}, + "managed_resource_id": {"key": "properties.managedResourceId", "type": "str"}, + "uuid": {"key": "properties.uuid", "type": "str"}, + "inventory_item_name": {"key": "properties.inventoryItemName", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__(self, *, kind: Optional[str] = None, **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, + the resource provider must validate and persist this value. + :paramtype kind: str + """ + super().__init__(**kwargs) + self.kind = kind + self.inventory_type: Optional[str] = None + self.managed_resource_id = None + self.uuid = None + self.inventory_item_name = None + self.provisioning_state = None + + +class InventoryItemDetails(_serialization.Model): + """Defines the resource properties. + + :ivar inventory_item_id: Gets or sets the inventory Item ID for the resource. + :vartype inventory_item_id: str + :ivar inventory_item_name: Gets or sets the Managed Object name in VMM for the resource. + :vartype inventory_item_name: str + """ + + _attribute_map = { + "inventory_item_id": {"key": "inventoryItemId", "type": "str"}, + "inventory_item_name": {"key": "inventoryItemName", "type": "str"}, + } + + def __init__( + self, *, inventory_item_id: Optional[str] = None, inventory_item_name: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword inventory_item_id: Gets or sets the inventory Item ID for the resource. + :paramtype inventory_item_id: str + :keyword inventory_item_name: Gets or sets the Managed Object name in VMM for the resource. + :paramtype inventory_item_name: str + """ + super().__init__(**kwargs) + self.inventory_item_id = inventory_item_id + self.inventory_item_name = inventory_item_name + + +class InventoryItemsList(_serialization.Model): + """List of InventoryItems. + + All required parameters must be populated in order to send to Azure. + + :ivar next_link: Url to follow for getting next page of InventoryItems. + :vartype next_link: str + :ivar value: Array of InventoryItems. Required. + :vartype value: list[~azure.mgmt.scvmm.models.InventoryItem] + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[InventoryItem]"}, + } + + 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 + :keyword value: Array of InventoryItems. Required. + :paramtype value: list[~azure.mgmt.scvmm.models.InventoryItem] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value -class Resource(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. Variables are only populated by the server, and will be ignored when sending a request. + 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}. :vartype id: str @@ -710,33 +1363,51 @@ class Resource(_serialization.Model): :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.scvmm.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, } - def __init__(self, **kwargs): - """ """ + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.tags = tags + self.location = location -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. +class MachineExtension(TrackedResource): # pylint: disable=too-many-instance-attributes + """Describes a Machine Extension. Variables are only populated by the server, and will be ignored when sending a request. + 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}. :vartype id: str @@ -745,158 +1416,389 @@ class ProxyResource(Resource): :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.scvmm.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version available. + :vartype enable_automatic_upgrade: bool + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: JSON + :ivar protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :vartype protected_settings: JSON + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :ivar instance_view: The machine extension instance view. + :vartype instance_view: ~azure.mgmt.scvmm.models.MachineExtensionPropertiesInstanceView """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": 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"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "force_update_tag": {"key": "properties.forceUpdateTag", "type": "str"}, + "publisher": {"key": "properties.publisher", "type": "str"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "type_handler_version": {"key": "properties.typeHandlerVersion", "type": "str"}, + "enable_automatic_upgrade": {"key": "properties.enableAutomaticUpgrade", "type": "bool"}, + "auto_upgrade_minor_version": {"key": "properties.autoUpgradeMinorVersion", "type": "bool"}, + "settings": {"key": "properties.settings", "type": "object"}, + "protected_settings": {"key": "properties.protectedSettings", "type": "object"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "instance_view": {"key": "properties.instanceView", "type": "MachineExtensionPropertiesInstanceView"}, } - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + force_update_tag: Optional[str] = None, + publisher: Optional[str] = None, + type_properties_type: Optional[str] = None, + type_handler_version: Optional[str] = None, + enable_automatic_upgrade: Optional[bool] = None, + auto_upgrade_minor_version: Optional[bool] = None, + settings: Optional[JSON] = None, + protected_settings: Optional[JSON] = None, + instance_view: Optional["_models.MachineExtensionPropertiesInstanceView"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version available. + :paramtype enable_automatic_upgrade: bool + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: JSON + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: JSON + :keyword instance_view: The machine extension instance view. + :paramtype instance_view: ~azure.mgmt.scvmm.models.MachineExtensionPropertiesInstanceView + """ + super().__init__(tags=tags, location=location, **kwargs) + self.force_update_tag = force_update_tag + self.publisher = publisher + self.type_properties_type = type_properties_type + self.type_handler_version = type_handler_version + self.enable_automatic_upgrade = enable_automatic_upgrade + self.auto_upgrade_minor_version = auto_upgrade_minor_version + self.settings = settings + self.protected_settings = protected_settings + self.provisioning_state = None + self.instance_view = instance_view -class InventoryItem(ProxyResource): - """Defines the inventory item. +class MachineExtensionInstanceView(_serialization.Model): + """Describes the Machine Extension Instance View. Variables are only populated by the server, and will be ignored when sending a request. - 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}. - :vartype id: str - :ivar name: The name of the resource. + :ivar name: The machine extension name. :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". :vartype type: str - :ivar system_data: The system data. - :vartype system_data: ~azure.mgmt.scvmm.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, - the resource provider must validate and persist this value. - :vartype kind: str - :ivar inventory_type: They inventory type. Required. Known values are: "Cloud", - "VirtualNetwork", "VirtualMachineTemplate", and "VirtualMachine". - :vartype inventory_type: str or ~azure.mgmt.scvmm.models.InventoryType - :ivar managed_resource_id: Gets the tracked resource id corresponding to the inventory - resource. - :vartype managed_resource_id: str - :ivar uuid: Gets the UUID (which is assigned by VMM) for the inventory item. - :vartype uuid: str - :ivar inventory_item_name: Gets the Managed Object name in VMM for the inventory item. - :vartype inventory_item_name: str - :ivar provisioning_state: Gets the provisioning state. - :vartype provisioning_state: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar status: Instance view status. + :vartype status: ~azure.mgmt.scvmm.models.MachineExtensionInstanceViewStatus """ _validation = { - "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "system_data": {"readonly": True}, - "inventory_type": {"required": True}, - "managed_resource_id": {"readonly": True}, - "uuid": {"readonly": True}, - "inventory_item_name": {"readonly": True}, - "provisioning_state": {"readonly": True}, + "type_handler_version": {"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"}, - "kind": {"key": "kind", "type": "str"}, - "inventory_type": {"key": "properties.inventoryType", "type": "str"}, - "managed_resource_id": {"key": "properties.managedResourceId", "type": "str"}, - "uuid": {"key": "properties.uuid", "type": "str"}, - "inventory_item_name": {"key": "properties.inventoryItemName", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "type_handler_version": {"key": "typeHandlerVersion", "type": "str"}, + "status": {"key": "status", "type": "MachineExtensionInstanceViewStatus"}, } - def __init__(self, *, kind: Optional[str] = None, **kwargs): + def __init__(self, *, status: Optional["_models.MachineExtensionInstanceViewStatus"] = None, **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, - the resource provider must validate and persist this value. - :paramtype kind: str + :keyword status: Instance view status. + :paramtype status: ~azure.mgmt.scvmm.models.MachineExtensionInstanceViewStatus """ super().__init__(**kwargs) - self.system_data = None - self.kind = kind - self.inventory_type: Optional[str] = None - self.managed_resource_id = None - self.uuid = None - self.inventory_item_name = None - self.provisioning_state = None + self.name = None + self.type = None + self.type_handler_version = None + self.status = status -class InventoryItemDetails(_serialization.Model): - """Defines the resource properties. +class MachineExtensionInstanceViewStatus(_serialization.Model): + """Instance view status. - :ivar inventory_item_id: Gets or sets the inventory Item ID for the resource. - :vartype inventory_item_id: str - :ivar inventory_item_name: Gets or sets the Managed Object name in VMM for the resource. - :vartype inventory_item_name: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The status code. + :vartype code: str + :ivar level: The level code. Known values are: "Info", "Warning", and "Error". + :vartype level: str or ~azure.mgmt.scvmm.models.StatusLevelTypes + :ivar display_status: The short localizable label for the status. + :vartype display_status: str + :ivar message: The detailed status message, including for alerts and error messages. + :vartype message: str + :ivar time: The time of the status. + :vartype time: ~datetime.datetime """ + _validation = { + "code": {"readonly": True}, + "level": {"readonly": True}, + "display_status": {"readonly": True}, + "message": {"readonly": True}, + "time": {"readonly": True}, + } + _attribute_map = { - "inventory_item_id": {"key": "inventoryItemId", "type": "str"}, - "inventory_item_name": {"key": "inventoryItemName", "type": "str"}, + "code": {"key": "code", "type": "str"}, + "level": {"key": "level", "type": "str"}, + "display_status": {"key": "displayStatus", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "time": {"key": "time", "type": "iso-8601"}, } - def __init__(self, *, inventory_item_id: Optional[str] = None, inventory_item_name: Optional[str] = None, **kwargs): - """ - :keyword inventory_item_id: Gets or sets the inventory Item ID for the resource. - :paramtype inventory_item_id: str - :keyword inventory_item_name: Gets or sets the Managed Object name in VMM for the resource. - :paramtype inventory_item_name: str - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.inventory_item_id = inventory_item_id - self.inventory_item_name = inventory_item_name + self.code = None + self.level = None + self.display_status = None + self.message = None + self.time = None -class InventoryItemsList(_serialization.Model): - """List of InventoryItems. +class MachineExtensionPropertiesInstanceView(MachineExtensionInstanceView): + """The machine extension instance view. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar next_link: Url to follow for getting next page of InventoryItems. - :vartype next_link: str - :ivar value: Array of InventoryItems. Required. - :vartype value: list[~azure.mgmt.scvmm.models.InventoryItem] + :ivar name: The machine extension name. + :vartype name: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar status: Instance view status. + :vartype status: ~azure.mgmt.scvmm.models.MachineExtensionInstanceViewStatus """ _validation = { - "value": {"required": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "type_handler_version": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "type_handler_version": {"key": "typeHandlerVersion", "type": "str"}, + "status": {"key": "status", "type": "MachineExtensionInstanceViewStatus"}, } + def __init__(self, *, status: Optional["_models.MachineExtensionInstanceViewStatus"] = None, **kwargs: Any) -> None: + """ + :keyword status: Instance view status. + :paramtype status: ~azure.mgmt.scvmm.models.MachineExtensionInstanceViewStatus + """ + super().__init__(status=status, **kwargs) + + +class MachineExtensionsListResult(_serialization.Model): + """Describes the Machine Extensions List Result. + + :ivar value: The list of extensions. + :vartype value: list[~azure.mgmt.scvmm.models.MachineExtension] + :ivar next_link: The uri to fetch the next page of machine extensions. Call ListNext() with + this to fetch the next page of extensions. + :vartype next_link: str + """ + _attribute_map = { + "value": {"key": "value", "type": "[MachineExtension]"}, "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[InventoryItem]"}, } - def __init__(self, *, value: List["_models.InventoryItem"], next_link: Optional[str] = None, **kwargs): + def __init__( + self, + *, + value: Optional[List["_models.MachineExtension"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword next_link: Url to follow for getting next page of InventoryItems. + :keyword value: The list of extensions. + :paramtype value: list[~azure.mgmt.scvmm.models.MachineExtension] + :keyword next_link: The uri to fetch the next page of machine extensions. Call ListNext() with + this to fetch the next page of extensions. :paramtype next_link: str - :keyword value: Array of InventoryItems. Required. - :paramtype value: list[~azure.mgmt.scvmm.models.InventoryItem] """ super().__init__(**kwargs) - self.next_link = next_link self.value = value + self.next_link = next_link + + +class ResourcePatch(_serialization.Model): + """Object containing tags updates for patch operations. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.tags = tags + + +class MachineExtensionUpdate(ResourcePatch): + """Describes a Machine Extension Update. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version available. + :vartype enable_automatic_upgrade: bool + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: JSON + :ivar protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :vartype protected_settings: JSON + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "force_update_tag": {"key": "properties.forceUpdateTag", "type": "str"}, + "publisher": {"key": "properties.publisher", "type": "str"}, + "type": {"key": "properties.type", "type": "str"}, + "type_handler_version": {"key": "properties.typeHandlerVersion", "type": "str"}, + "enable_automatic_upgrade": {"key": "properties.enableAutomaticUpgrade", "type": "bool"}, + "auto_upgrade_minor_version": {"key": "properties.autoUpgradeMinorVersion", "type": "bool"}, + "settings": {"key": "properties.settings", "type": "object"}, + "protected_settings": {"key": "properties.protectedSettings", "type": "object"}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + force_update_tag: Optional[str] = None, + publisher: Optional[str] = None, + type: Optional[str] = None, + type_handler_version: Optional[str] = None, + enable_automatic_upgrade: Optional[bool] = None, + auto_upgrade_minor_version: Optional[bool] = None, + settings: Optional[JSON] = None, + protected_settings: Optional[JSON] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version available. + :paramtype enable_automatic_upgrade: bool + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: JSON + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: JSON + """ + super().__init__(tags=tags, **kwargs) + self.force_update_tag = force_update_tag + self.publisher = publisher + self.type = type + self.type_handler_version = type_handler_version + self.enable_automatic_upgrade = enable_automatic_upgrade + self.auto_upgrade_minor_version = auto_upgrade_minor_version + self.settings = settings + self.protected_settings = protected_settings class NetworkInterfaces(_serialization.Model): # pylint: disable=too-many-instance-attributes @@ -965,8 +1867,8 @@ def __init__( ipv6_address_type: Optional[Union[str, "_models.AllocationMethod"]] = None, mac_address_type: Optional[Union[str, "_models.AllocationMethod"]] = None, nic_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the network interface. :paramtype name: str @@ -1044,8 +1946,8 @@ def __init__( ipv6_address_type: Optional[Union[str, "_models.AllocationMethod"]] = None, mac_address_type: Optional[Union[str, "_models.AllocationMethod"]] = None, nic_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the network interface. :paramtype name: str @@ -1088,7 +1990,9 @@ class NetworkProfile(_serialization.Model): "network_interfaces": {"key": "networkInterfaces", "type": "[NetworkInterfaces]"}, } - def __init__(self, *, network_interfaces: Optional[List["_models.NetworkInterfaces"]] = None, **kwargs): + def __init__( + self, *, network_interfaces: Optional[List["_models.NetworkInterfaces"]] = None, **kwargs: Any + ) -> None: """ :keyword network_interfaces: Gets or sets the list of network interfaces associated with the virtual machine. @@ -1110,7 +2014,9 @@ class NetworkProfileUpdate(_serialization.Model): "network_interfaces": {"key": "networkInterfaces", "type": "[NetworkInterfacesUpdate]"}, } - def __init__(self, *, network_interfaces: Optional[List["_models.NetworkInterfacesUpdate"]] = None, **kwargs): + def __init__( + self, *, network_interfaces: Optional[List["_models.NetworkInterfacesUpdate"]] = None, **kwargs: Any + ) -> None: """ :keyword network_interfaces: Gets or sets the list of network interfaces associated with the virtual machine. @@ -1148,7 +2054,9 @@ class OsProfile(_serialization.Model): "os_name": {"key": "osName", "type": "str"}, } - def __init__(self, *, admin_password: Optional[str] = None, computer_name: Optional[str] = None, **kwargs): + def __init__( + self, *, admin_password: Optional[str] = None, computer_name: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword admin_password: Admin password of the virtual machine. :paramtype admin_password: str @@ -1162,26 +2070,6 @@ def __init__(self, *, admin_password: Optional[str] = None, computer_name: Optio self.os_name = None -class ResourcePatch(_serialization.Model): - """Object containing tags updates for patch operations. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - class ResourceProviderOperation(_serialization.Model): """Results of the request to list operations. @@ -1205,8 +2093,8 @@ def __init__( is_data_action: Optional[str] = None, name: Optional[str] = None, display: Optional["_models.ResourceProviderOperationDisplay"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_data_action: Indicates whether the operation applies to data-plane. :paramtype is_data_action: str @@ -1248,8 +2136,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: The resource provider. :paramtype provider: str @@ -1286,8 +2174,8 @@ def __init__( *, value: Optional[List["_models.ResourceProviderOperation"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: List of Operations. :paramtype value: list[~azure.mgmt.scvmm.models.ResourceProviderOperation] @@ -1312,7 +2200,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 @@ -1334,7 +2222,7 @@ class StorageProfile(_serialization.Model): "disks": {"key": "disks", "type": "[VirtualDisk]"}, } - 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.scvmm.models.VirtualDisk] @@ -1354,7 +2242,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.scvmm.models.VirtualDiskUpdate] @@ -1398,8 +2286,8 @@ def __init__( iops_minimum: Optional[int] = None, bandwidth_limit: Optional[int] = None, policy_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the policy. :paramtype name: str @@ -1438,8 +2326,12 @@ class StorageQoSPolicyDetails(_serialization.Model): } def __init__( - self, *, name: Optional[str] = None, id: Optional[str] = None, **kwargs # pylint: disable=redefined-builtin - ): + self, + *, + name: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + **kwargs: Any + ) -> None: """ :keyword name: The name of the policy. :paramtype name: str @@ -1488,8 +2380,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 @@ -1589,8 +2481,8 @@ def __init__( template_disk_id: Optional[str] = None, storage_qo_s_policy: Optional["_models.StorageQoSPolicyDetails"] = None, create_diff_disk: Optional[Union[str, "_models.CreateDiffDisk"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the disk. :paramtype name: str @@ -1674,8 +2566,8 @@ def __init__( bus_type: Optional[str] = None, vhd_type: Optional[str] = None, storage_qo_s_policy: Optional["_models.StorageQoSPolicyDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the disk. :paramtype name: str @@ -1726,6 +2618,8 @@ class VirtualMachine(_serialization.Model): # pylint: disable=too-many-instance :vartype system_data: ~azure.mgmt.scvmm.models.SystemData :ivar extended_location: The extended location. Required. :vartype extended_location: ~azure.mgmt.scvmm.models.ExtendedLocation + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.scvmm.models.Identity :ivar inventory_item_id: Gets or sets the inventory Item ID for the resource. :vartype inventory_item_id: str :ivar vmm_server_id: ARM Id of the vmmServer resource in which this resource resides. @@ -1736,6 +2630,8 @@ class VirtualMachine(_serialization.Model): # pylint: disable=too-many-instance :vartype template_id: str :ivar checkpoint_type: Type of checkpoint supported for the vm. :vartype checkpoint_type: str + :ivar last_restored_vm_checkpoint: Last restored checkpoint in the vm. + :vartype last_restored_vm_checkpoint: ~azure.mgmt.scvmm.models.Checkpoint :ivar checkpoints: Checkpoints in the vm. :vartype checkpoints: list[~azure.mgmt.scvmm.models.Checkpoint] :ivar availability_sets: Availability Sets in vm. @@ -1756,6 +2652,8 @@ class VirtualMachine(_serialization.Model): # pylint: disable=too-many-instance :vartype generation: int :ivar power_state: Gets the power state of the virtual machine. :vartype power_state: str + :ivar guest_agent_profile: Guest agent status properties. + :vartype guest_agent_profile: ~azure.mgmt.scvmm.models.GuestAgentProfile :ivar provisioning_state: Gets or sets the provisioning state. :vartype provisioning_state: str """ @@ -1767,6 +2665,7 @@ class VirtualMachine(_serialization.Model): # pylint: disable=too-many-instance "location": {"required": True}, "system_data": {"readonly": True}, "extended_location": {"required": True}, + "last_restored_vm_checkpoint": {"readonly": True}, "vm_name": {"min_length": 1}, "power_state": {"readonly": True}, "provisioning_state": {"readonly": True}, @@ -1780,11 +2679,13 @@ class VirtualMachine(_serialization.Model): # pylint: disable=too-many-instance "tags": {"key": "tags", "type": "{str}"}, "system_data": {"key": "systemData", "type": "SystemData"}, "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "identity": {"key": "identity", "type": "Identity"}, "inventory_item_id": {"key": "properties.inventoryItemId", "type": "str"}, "vmm_server_id": {"key": "properties.vmmServerId", "type": "str"}, "cloud_id": {"key": "properties.cloudId", "type": "str"}, "template_id": {"key": "properties.templateId", "type": "str"}, "checkpoint_type": {"key": "properties.checkpointType", "type": "str"}, + "last_restored_vm_checkpoint": {"key": "properties.lastRestoredVMCheckpoint", "type": "Checkpoint"}, "checkpoints": {"key": "properties.checkpoints", "type": "[Checkpoint]"}, "availability_sets": {"key": "properties.availabilitySets", "type": "[AvailabilitySetListItem]"}, "os_profile": {"key": "properties.osProfile", "type": "OsProfile"}, @@ -1795,15 +2696,17 @@ class VirtualMachine(_serialization.Model): # pylint: disable=too-many-instance "uuid": {"key": "properties.uuid", "type": "str"}, "generation": {"key": "properties.generation", "type": "int"}, "power_state": {"key": "properties.powerState", "type": "str"}, + "guest_agent_profile": {"key": "properties.guestAgentProfile", "type": "GuestAgentProfile"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, location: str, extended_location: "_models.ExtendedLocation", tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.Identity"] = None, inventory_item_id: Optional[str] = None, vmm_server_id: Optional[str] = None, cloud_id: Optional[str] = None, @@ -1818,8 +2721,9 @@ def __init__( vm_name: Optional[str] = None, uuid: Optional[str] = None, generation: Optional[int] = None, - **kwargs - ): + guest_agent_profile: Optional["_models.GuestAgentProfile"] = None, + **kwargs: Any + ) -> None: """ :keyword location: Gets or sets the location. Required. :paramtype location: str @@ -1827,6 +2731,8 @@ def __init__( :paramtype tags: dict[str, str] :keyword extended_location: The extended location. Required. :paramtype extended_location: ~azure.mgmt.scvmm.models.ExtendedLocation + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.scvmm.models.Identity :keyword inventory_item_id: Gets or sets the inventory Item ID for the resource. :paramtype inventory_item_id: str :keyword vmm_server_id: ARM Id of the vmmServer resource in which this resource resides. @@ -1855,6 +2761,8 @@ def __init__( :paramtype uuid: str :keyword generation: Gets or sets the generation for the vm. :paramtype generation: int + :keyword guest_agent_profile: Guest agent status properties. + :paramtype guest_agent_profile: ~azure.mgmt.scvmm.models.GuestAgentProfile """ super().__init__(**kwargs) self.id = None @@ -1864,11 +2772,13 @@ def __init__( self.tags = tags self.system_data = None self.extended_location = extended_location + self.identity = identity self.inventory_item_id = inventory_item_id self.vmm_server_id = vmm_server_id self.cloud_id = cloud_id self.template_id = template_id self.checkpoint_type = checkpoint_type + self.last_restored_vm_checkpoint = None self.checkpoints = checkpoints self.availability_sets = availability_sets self.os_profile = os_profile @@ -1879,6 +2789,7 @@ def __init__( self.uuid = uuid self.generation = generation self.power_state = None + self.guest_agent_profile = guest_agent_profile self.provisioning_state = None @@ -1896,7 +2807,7 @@ class VirtualMachineCreateCheckpoint(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, description: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, description: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: Name of the checkpoint. :paramtype name: str @@ -1919,7 +2830,7 @@ class VirtualMachineDeleteCheckpoint(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: ID of the checkpoint to be deleted. :paramtype id: str @@ -1989,8 +2900,8 @@ def __init__( *, ip_addresses: Optional[List[str]] = None, cloud: Optional["_models.InventoryItemDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword ip_addresses: Gets or sets the nic ip addresses. :paramtype ip_addresses: list[str] @@ -2021,8 +2932,8 @@ class VirtualMachineListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.VirtualMachine"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.VirtualMachine"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of VirtualMachines. :paramtype value: list[~azure.mgmt.scvmm.models.VirtualMachine] @@ -2045,7 +2956,7 @@ class VirtualMachineRestoreCheckpoint(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: ID of the checkpoint to be restored to. :paramtype id: str @@ -2179,8 +3090,8 @@ def __init__( # pylint: disable=too-many-locals inventory_item_id: Optional[str] = None, uuid: Optional[str] = None, vmm_server_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Gets or sets the location. Required. :paramtype location: str @@ -2277,7 +3188,7 @@ class VirtualMachineTemplateInventoryItem(InventoryItemProperties): "os_name": {"key": "osName", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.inventory_type: str = "VirtualMachineTemplate" @@ -2306,8 +3217,8 @@ def __init__( *, value: Optional[List["_models.VirtualMachineTemplate"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: List of VirtualMachineTemplates. :paramtype value: list[~azure.mgmt.scvmm.models.VirtualMachineTemplate] @@ -2326,11 +3237,14 @@ class VirtualMachineUpdate(_serialization.Model): :vartype properties: ~azure.mgmt.scvmm.models.VirtualMachineUpdateProperties :ivar tags: Gets or sets the Resource tags. :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.scvmm.models.Identity """ _attribute_map = { "properties": {"key": "properties", "type": "VirtualMachineUpdateProperties"}, "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "Identity"}, } def __init__( @@ -2338,17 +3252,21 @@ def __init__( *, properties: Optional["_models.VirtualMachineUpdateProperties"] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + identity: Optional["_models.Identity"] = None, + **kwargs: Any + ) -> None: """ :keyword properties: Defines the resource properties. :paramtype properties: ~azure.mgmt.scvmm.models.VirtualMachineUpdateProperties :keyword tags: Gets or sets the Resource tags. :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.scvmm.models.Identity """ super().__init__(**kwargs) self.properties = properties self.tags = tags + self.identity = identity class VirtualMachineUpdateProperties(_serialization.Model): @@ -2362,6 +3280,8 @@ class VirtualMachineUpdateProperties(_serialization.Model): :vartype network_profile: ~azure.mgmt.scvmm.models.NetworkProfileUpdate :ivar availability_sets: Availability Sets in vm. :vartype availability_sets: list[~azure.mgmt.scvmm.models.AvailabilitySetListItem] + :ivar checkpoint_type: Type of checkpoint supported for the vm. + :vartype checkpoint_type: str """ _attribute_map = { @@ -2369,6 +3289,7 @@ class VirtualMachineUpdateProperties(_serialization.Model): "storage_profile": {"key": "storageProfile", "type": "StorageProfileUpdate"}, "network_profile": {"key": "networkProfile", "type": "NetworkProfileUpdate"}, "availability_sets": {"key": "availabilitySets", "type": "[AvailabilitySetListItem]"}, + "checkpoint_type": {"key": "checkpointType", "type": "str"}, } def __init__( @@ -2378,8 +3299,9 @@ def __init__( storage_profile: Optional["_models.StorageProfileUpdate"] = None, network_profile: Optional["_models.NetworkProfileUpdate"] = None, availability_sets: Optional[List["_models.AvailabilitySetListItem"]] = None, - **kwargs - ): + checkpoint_type: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword hardware_profile: Defines the resource properties. :paramtype hardware_profile: ~azure.mgmt.scvmm.models.HardwareProfileUpdate @@ -2389,12 +3311,15 @@ def __init__( :paramtype network_profile: ~azure.mgmt.scvmm.models.NetworkProfileUpdate :keyword availability_sets: Availability Sets in vm. :paramtype availability_sets: list[~azure.mgmt.scvmm.models.AvailabilitySetListItem] + :keyword checkpoint_type: Type of checkpoint supported for the vm. + :paramtype checkpoint_type: str """ super().__init__(**kwargs) self.hardware_profile = hardware_profile self.storage_profile = storage_profile self.network_profile = network_profile self.availability_sets = availability_sets + self.checkpoint_type = checkpoint_type class VirtualNetwork(_serialization.Model): # pylint: disable=too-many-instance-attributes @@ -2466,8 +3391,8 @@ def __init__( inventory_item_id: Optional[str] = None, uuid: Optional[str] = None, vmm_server_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Gets or sets the location. Required. :paramtype location: str @@ -2534,7 +3459,7 @@ class VirtualNetworkInventoryItem(InventoryItemProperties): "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.inventory_type: str = "VirtualNetwork" @@ -2555,8 +3480,8 @@ class VirtualNetworkListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.VirtualNetwork"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.VirtualNetwork"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of VirtualNetworks. :paramtype value: list[~azure.mgmt.scvmm.models.VirtualNetwork] @@ -2651,8 +3576,8 @@ def __init__( tags: Optional[Dict[str, str]] = None, credentials: Optional["_models.VMMServerPropertiesCredentials"] = None, port: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Gets or sets the location. Required. :paramtype location: str @@ -2699,7 +3624,9 @@ class VMMServerListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.VMMServer"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.VMMServer"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of VmmServers. :paramtype value: list[~azure.mgmt.scvmm.models.VMMServer] @@ -2725,7 +3652,7 @@ class VMMServerPropertiesCredentials(_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: Username to use to connect to VMMServer. :paramtype username: str diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/models/_scvmm_enums.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/models/_scvmm_enums.py index 5546a5c05432..e9bbdf879806 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/models/_scvmm_enums.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/models/_scvmm_enums.py @@ -40,6 +40,13 @@ class DynamicMemoryEnabled(str, Enum, metaclass=CaseInsensitiveEnumMeta): TRUE = "true" +class IdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of managed service identity.""" + + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + + class InventoryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The inventory type.""" @@ -71,3 +78,27 @@ class OsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): WINDOWS = "Windows" LINUX = "Linux" OTHER = "Other" + + +class ProvisioningAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Defines the different types of operations for guest agent.""" + + INSTALL = "install" + UNINSTALL = "uninstall" + REPAIR = "repair" + + +class StatusLevelTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The level code.""" + + INFO = "Info" + WARNING = "Warning" + ERROR = "Error" + + +class StatusTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The status of the hybrid machine agent.""" + + CONNECTED = "Connected" + DISCONNECTED = "Disconnected" + ERROR = "Error" diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/__init__.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/__init__.py index 69f4eb5e8c3e..0e4248a47c56 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/__init__.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/__init__.py @@ -14,6 +14,9 @@ from ._virtual_machine_templates_operations import VirtualMachineTemplatesOperations from ._availability_sets_operations import AvailabilitySetsOperations from ._inventory_items_operations import InventoryItemsOperations +from ._hybrid_identity_metadatas_operations import HybridIdentityMetadatasOperations +from ._machine_extensions_operations import MachineExtensionsOperations +from ._guest_agents_operations import GuestAgentsOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -28,6 +31,9 @@ "VirtualMachineTemplatesOperations", "AvailabilitySetsOperations", "InventoryItemsOperations", + "HybridIdentityMetadatasOperations", + "MachineExtensionsOperations", + "GuestAgentsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_availability_sets_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_availability_sets_operations.py index 8e5bdbe2c5ec..40b6adecdd07 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_availability_sets_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_availability_sets_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, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +31,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -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 +44,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,9 +75,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["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -123,9 +114,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,9 +147,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -192,9 +179,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["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -222,9 +207,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -289,9 +272,7 @@ def get(self, resource_group_name: str, availability_set_name: str, **kwargs: An _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.AvailabilitySet] = kwargs.pop("cls", None) request = build_get_request( @@ -306,8 +287,9 @@ def get(self, resource_group_name: str, availability_set_name: str, **kwargs: An 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 @@ -346,9 +328,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.AvailabilitySet] = kwargs.pop("cls", None) @@ -375,8 +355,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 @@ -496,7 +477,7 @@ def begin_create_or_update( :type resource_group_name: str :param availability_set_name: Name of the AvailabilitySet. Required. :type availability_set_name: str - :param body: Request payload. Is either a model type or a IO type. Required. + :param body: Request payload. Is either a AvailabilitySet type or a IO type. Required. :type body: ~azure.mgmt.scvmm.models.AvailabilitySet or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -517,9 +498,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["2020-06-05-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.AvailabilitySet] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -580,9 +559,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["2020-06-05-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( @@ -598,8 +575,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 @@ -652,9 +630,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -713,9 +689,7 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.AvailabilitySet]] = kwargs.pop("cls", None) @@ -742,8 +716,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 @@ -859,7 +834,8 @@ def begin_update( :type resource_group_name: str :param availability_set_name: Name of the AvailabilitySet. Required. :type availability_set_name: str - :param body: AvailabilitySets patch payload. Is either a model type or a IO type. Required. + :param body: AvailabilitySets patch payload. Is either a ResourcePatch type or a IO type. + Required. :type body: ~azure.mgmt.scvmm.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -880,9 +856,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.AvailabilitySet] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -945,9 +919,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["2020-06-05-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.AvailabilitySetListResult] = kwargs.pop("cls", None) error_map = { @@ -1000,8 +972,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 @@ -1032,9 +1005,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.AvailabilityS _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.AvailabilitySetListResult] = kwargs.pop("cls", None) error_map = { @@ -1086,8 +1057,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/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_clouds_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_clouds_operations.py index a8bfcc164abd..b1838654814e 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_clouds_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_clouds_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, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +31,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -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 +42,7 @@ def build_get_request(resource_group_name: str, cloud_name: str, subscription_id _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -80,9 +73,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["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -116,9 +107,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -149,9 +138,7 @@ def build_update_request(resource_group_name: str, cloud_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -183,9 +170,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["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -213,9 +198,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -280,9 +263,7 @@ def get(self, resource_group_name: str, cloud_name: str, **kwargs: Any) -> _mode _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.Cloud] = kwargs.pop("cls", None) request = build_get_request( @@ -297,8 +278,9 @@ def get(self, resource_group_name: str, cloud_name: str, **kwargs: Any) -> _mode 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 @@ -333,9 +315,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.Cloud] = kwargs.pop("cls", None) @@ -362,8 +342,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 @@ -472,7 +453,7 @@ def begin_create_or_update( :type resource_group_name: str :param cloud_name: Name of the Cloud. Required. :type cloud_name: str - :param body: Request payload. Is either a model type or a IO type. Required. + :param body: Request payload. Is either a Cloud type or a IO type. Required. :type body: ~azure.mgmt.scvmm.models.Cloud or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -492,9 +473,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["2020-06-05-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.Cloud] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -555,9 +534,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["2020-06-05-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( @@ -573,8 +550,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 @@ -621,9 +599,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -680,9 +656,7 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.Cloud]] = kwargs.pop("cls", None) @@ -709,8 +683,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 @@ -820,7 +795,7 @@ def begin_update( :type resource_group_name: str :param cloud_name: Name of the Cloud. Required. :type cloud_name: str - :param body: Clouds patch payload. Is either a model type or a IO type. Required. + :param body: Clouds patch payload. Is either a ResourcePatch type or a IO type. Required. :type body: ~azure.mgmt.scvmm.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -840,9 +815,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.Cloud] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -905,9 +878,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["2020-06-05-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.CloudListResult] = kwargs.pop("cls", None) error_map = { @@ -960,8 +931,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 @@ -992,9 +964,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Cloud"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.CloudListResult] = kwargs.pop("cls", None) error_map = { @@ -1046,8 +1016,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/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_guest_agents_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_guest_agents_operations.py new file mode 100644 index 000000000000..64b6b37bc1c0 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_guest_agents_operations.py @@ -0,0 +1,711 @@ +# 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, 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 _convert_request, _format_url_section + +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_group_name: str, virtual_machine_name: str, guest_agent_name: str, subscription_id: 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", "2022-05-21-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", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/guestAgents/{guestAgentName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + "guestAgentName": _SERIALIZER.url("guest_agent_name", guest_agent_name, "str"), + } + + _url: str = _format_url_section(_url, **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_group_name: str, virtual_machine_name: str, guest_agent_name: str, subscription_id: 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", "2022-05-21-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/guestAgents/{guestAgentName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + "guestAgentName": _SERIALIZER.url("guest_agent_name", guest_agent_name, "str"), + } + + _url: str = _format_url_section(_url, **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_group_name: str, virtual_machine_name: str, guest_agent_name: str, subscription_id: 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", "2022-05-21-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/guestAgents/{guestAgentName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + "guestAgentName": _SERIALIZER.url("guest_agent_name", guest_agent_name, "str"), + } + + _url: str = _format_url_section(_url, **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_by_vm_request( + resource_group_name: str, virtual_machine_name: str, subscription_id: 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", "2022-05-21-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/guestAgents", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + } + + _url: str = _format_url_section(_url, **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 GuestAgentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.scvmm.SCVMM`'s + :attr:`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_group_name: str, + virtual_machine_name: str, + guest_agent_name: 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, (IO, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "GuestAgent") + else: + _json = None + + request = build_create_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + guest_agent_name=guest_agent_name, + subscription_id=self._config.subscription_id, + 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": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/guestAgents/{guestAgentName}" + } + + @overload + def begin_create( + self, + resource_group_name: str, + virtual_machine_name: str, + guest_agent_name: 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_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: Name of the vm. Required. + :type virtual_machine_name: str + :param guest_agent_name: Name of the guestAgents. Required. + :type guest_agent_name: str + :param body: Request payload. Default value is None. + :type body: ~azure.mgmt.scvmm.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.scvmm.models.GuestAgent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + virtual_machine_name: str, + guest_agent_name: 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_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: Name of the vm. Required. + :type virtual_machine_name: str + :param guest_agent_name: Name of the guestAgents. Required. + :type guest_agent_name: 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.scvmm.models.GuestAgent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + virtual_machine_name: str, + guest_agent_name: str, + body: Optional[Union[_models.GuestAgent, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.GuestAgent]: + """Implements GuestAgent PUT method. + + Create Or Update GuestAgent. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: Name of the vm. Required. + :type virtual_machine_name: str + :param guest_agent_name: Name of the guestAgents. Required. + :type guest_agent_name: str + :param body: Request payload. Is either a GuestAgent type or a IO type. Default value is None. + :type body: ~azure.mgmt.scvmm.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.scvmm.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_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + guest_agent_name=guest_agent_name, + 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": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/guestAgents/{guestAgentName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, virtual_machine_name: str, guest_agent_name: str, **kwargs: Any + ) -> _models.GuestAgent: + """Gets GuestAgent. + + Implements GuestAgent GET method. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: Name of the vm. Required. + :type virtual_machine_name: str + :param guest_agent_name: Name of the GuestAgent. Required. + :type guest_agent_name: 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.scvmm.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_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + guest_agent_name=guest_agent_name, + subscription_id=self._config.subscription_id, + 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": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/guestAgents/{guestAgentName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_machine_name: str, guest_agent_name: 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_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + guest_agent_name=guest_agent_name, + subscription_id=self._config.subscription_id, + 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 [200, 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) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/guestAgents/{guestAgentName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, virtual_machine_name: str, guest_agent_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes an GuestAgent. + + Implements GuestAgent DELETE method. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: Name of the vm. Required. + :type virtual_machine_name: str + :param guest_agent_name: Name of the GuestAgent. Required. + :type guest_agent_name: 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_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + guest_agent_name=guest_agent_name, + 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": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/guestAgents/{guestAgentName}" + } + + @distributed_trace + def list_by_vm( + self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any + ) -> Iterable["_models.GuestAgent"]: + """Implements GET GuestAgent in a vm. + + Returns the list of GuestAgent of the given vm. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: Name of the vm. Required. + :type virtual_machine_name: 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.scvmm.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_by_vm_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_vm.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_by_vm.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/guestAgents" + } diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_hybrid_identity_metadatas_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_hybrid_identity_metadatas_operations.py new file mode 100644 index 000000000000..ec7cdea61475 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_hybrid_identity_metadatas_operations.py @@ -0,0 +1,573 @@ +# 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, IO, Iterable, Optional, TypeVar, Union, 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.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 _convert_request, _format_url_section + +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_group_name: str, virtual_machine_name: str, metadata_name: str, subscription_id: 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", "2022-05-21-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", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + "metadataName": _SERIALIZER.url("metadata_name", metadata_name, "str"), + } + + _url: str = _format_url_section(_url, **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_group_name: str, virtual_machine_name: str, metadata_name: str, subscription_id: 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", "2022-05-21-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + "metadataName": _SERIALIZER.url("metadata_name", metadata_name, "str"), + } + + _url: str = _format_url_section(_url, **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_group_name: str, virtual_machine_name: str, metadata_name: str, subscription_id: 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", "2022-05-21-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + "metadataName": _SERIALIZER.url("metadata_name", metadata_name, "str"), + } + + _url: str = _format_url_section(_url, **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_by_vm_request( + resource_group_name: str, virtual_machine_name: str, subscription_id: 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", "2022-05-21-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/hybridIdentityMetadata", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + } + + _url: str = _format_url_section(_url, **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 HybridIdentityMetadatasOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.scvmm.SCVMM`'s + :attr:`hybrid_identity_metadatas` 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") + + @overload + def create( + self, + resource_group_name: str, + virtual_machine_name: str, + metadata_name: str, + body: Optional[_models.HybridIdentityMetadata] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HybridIdentityMetadata: + """Implements HybridIdentityMetadata PUT method. + + Create Or Update HybridIdentityMetadata. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: Name of the vm. Required. + :type virtual_machine_name: str + :param metadata_name: Name of the hybridIdentityMetadata. Required. + :type metadata_name: str + :param body: Request payload. Default value is None. + :type body: ~azure.mgmt.scvmm.models.HybridIdentityMetadata + :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 + :return: HybridIdentityMetadata or the result of cls(response) + :rtype: ~azure.mgmt.scvmm.models.HybridIdentityMetadata + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + virtual_machine_name: str, + metadata_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HybridIdentityMetadata: + """Implements HybridIdentityMetadata PUT method. + + Create Or Update HybridIdentityMetadata. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: Name of the vm. Required. + :type virtual_machine_name: str + :param metadata_name: Name of the hybridIdentityMetadata. Required. + :type metadata_name: 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 + :return: HybridIdentityMetadata or the result of cls(response) + :rtype: ~azure.mgmt.scvmm.models.HybridIdentityMetadata + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + virtual_machine_name: str, + metadata_name: str, + body: Optional[Union[_models.HybridIdentityMetadata, IO]] = None, + **kwargs: Any + ) -> _models.HybridIdentityMetadata: + """Implements HybridIdentityMetadata PUT method. + + Create Or Update HybridIdentityMetadata. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: Name of the vm. Required. + :type virtual_machine_name: str + :param metadata_name: Name of the hybridIdentityMetadata. Required. + :type metadata_name: str + :param body: Request payload. Is either a HybridIdentityMetadata type or a IO type. Default + value is None. + :type body: ~azure.mgmt.scvmm.models.HybridIdentityMetadata 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 + :return: HybridIdentityMetadata or the result of cls(response) + :rtype: ~azure.mgmt.scvmm.models.HybridIdentityMetadata + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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.HybridIdentityMetadata] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "HybridIdentityMetadata") + else: + _json = None + + request = build_create_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + metadata_name=metadata_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create.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("HybridIdentityMetadata", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, virtual_machine_name: str, metadata_name: str, **kwargs: Any + ) -> _models.HybridIdentityMetadata: + """Gets HybridIdentityMetadata. + + Implements HybridIdentityMetadata GET method. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: Name of the vm. Required. + :type virtual_machine_name: str + :param metadata_name: Name of the HybridIdentityMetadata. Required. + :type metadata_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridIdentityMetadata or the result of cls(response) + :rtype: ~azure.mgmt.scvmm.models.HybridIdentityMetadata + :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.HybridIdentityMetadata] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + metadata_name=metadata_name, + subscription_id=self._config.subscription_id, + 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("HybridIdentityMetadata", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_machine_name: str, metadata_name: str, **kwargs: Any + ) -> None: + """Deletes an HybridIdentityMetadata. + + Implements HybridIdentityMetadata DELETE method. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: Name of the vm. Required. + :type virtual_machine_name: str + :param metadata_name: Name of the HybridIdentityMetadata. Required. + :type metadata_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :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[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + metadata_name=metadata_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.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, 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) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}" + } + + @distributed_trace + def list_by_vm( + self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any + ) -> Iterable["_models.HybridIdentityMetadata"]: + """Implements GET HybridIdentityMetadata in a vm. + + Returns the list of HybridIdentityMetadata of the given vm. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: Name of the vm. Required. + :type virtual_machine_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HybridIdentityMetadata or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.scvmm.models.HybridIdentityMetadata] + :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.HybridIdentityMetadataList] = 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_by_vm_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_vm.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("HybridIdentityMetadataList", 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_by_vm.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/hybridIdentityMetadata" + } diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_inventory_items_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_inventory_items_operations.py index 2a513f9a7840..bc309c72ae89 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_inventory_items_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_inventory_items_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, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -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 +42,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -84,9 +77,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -118,9 +109,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -152,9 +141,7 @@ def build_list_by_vmm_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -281,7 +268,8 @@ def create( :type vmm_server_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.scvmm.models.InventoryItem or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -302,9 +290,7 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -335,8 +321,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 +374,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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 +390,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 +443,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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 +459,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 +498,7 @@ def list_by_vmm_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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 +552,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/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_machine_extensions_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_machine_extensions_operations.py new file mode 100644 index 000000000000..4047dcec2b61 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_machine_extensions_operations.py @@ -0,0 +1,997 @@ +# 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, 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 _convert_request, _format_url_section + +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_group_name: str, virtual_machine_name: str, extension_name: str, subscription_id: 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", "2022-05-21-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", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/extensions/{extensionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), + } + + _url: str = _format_url_section(_url, **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_update_request( + resource_group_name: str, virtual_machine_name: str, extension_name: str, subscription_id: 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", "2022-05-21-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", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/extensions/{extensionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), + } + + _url: str = _format_url_section(_url, **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_group_name: str, virtual_machine_name: str, extension_name: str, subscription_id: 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", "2022-05-21-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/extensions/{extensionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), + } + + _url: str = _format_url_section(_url, **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_get_request( + resource_group_name: str, virtual_machine_name: str, extension_name: str, subscription_id: 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", "2022-05-21-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/extensions/{extensionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), + } + + _url: str = _format_url_section(_url, **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_group_name: str, + virtual_machine_name: str, + subscription_id: str, + *, + expand: Optional[str] = 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", "2022-05-21-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/extensions", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class MachineExtensionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.scvmm.SCVMM`'s + :attr:`machine_extensions` 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_group_name: str, + virtual_machine_name: str, + extension_name: str, + extension_parameters: Union[_models.MachineExtension, IO], + **kwargs: Any + ) -> _models.MachineExtension: + 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.MachineExtension] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(extension_parameters, (IO, bytes)): + _content = extension_parameters + else: + _json = self._serialize.body(extension_parameters, "MachineExtension") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + extension_name=extension_name, + subscription_id=self._config.subscription_id, + 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("MachineExtension", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("MachineExtension", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/extensions/{extensionName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_machine_name: str, + extension_name: str, + extension_parameters: _models.MachineExtension, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MachineExtension]: + """The operation to create or update the extension. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the machine where the extension should be created or + updated. Required. + :type virtual_machine_name: str + :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. + Required. + :type extension_parameters: ~azure.mgmt.scvmm.models.MachineExtension + :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 MachineExtension or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.scvmm.models.MachineExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_machine_name: str, + extension_name: str, + extension_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MachineExtension]: + """The operation to create or update the extension. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the machine where the extension should be created or + updated. Required. + :type virtual_machine_name: str + :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. + Required. + :type extension_parameters: 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 MachineExtension or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.scvmm.models.MachineExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + virtual_machine_name: str, + extension_name: str, + extension_parameters: Union[_models.MachineExtension, IO], + **kwargs: Any + ) -> LROPoller[_models.MachineExtension]: + """The operation to create or update the extension. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the machine where the extension should be created or + updated. Required. + :type virtual_machine_name: str + :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 MachineExtension type or a IO type. Required. + :type extension_parameters: ~azure.mgmt.scvmm.models.MachineExtension 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 MachineExtension or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.scvmm.models.MachineExtension] + :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.MachineExtension] = 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_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + extension_name=extension_name, + extension_parameters=extension_parameters, + 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("MachineExtension", 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": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/extensions/{extensionName}" + } + + def _update_initial( + self, + resource_group_name: str, + virtual_machine_name: str, + extension_name: str, + extension_parameters: Union[_models.MachineExtensionUpdate, IO], + **kwargs: Any + ) -> Optional[_models.MachineExtension]: + 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.MachineExtension]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(extension_parameters, (IO, bytes)): + _content = extension_parameters + else: + _json = self._serialize.body(extension_parameters, "MachineExtensionUpdate") + + request = build_update_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + extension_name=extension_name, + subscription_id=self._config.subscription_id, + 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("MachineExtension", pipeline_response) + + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/extensions/{extensionName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + virtual_machine_name: str, + extension_name: str, + extension_parameters: _models.MachineExtensionUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MachineExtension]: + """The operation to update the extension. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the machine where the extension should be created or + updated. Required. + :type virtual_machine_name: str + :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. + Required. + :type extension_parameters: ~azure.mgmt.scvmm.models.MachineExtensionUpdate + :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 MachineExtension or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.scvmm.models.MachineExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + virtual_machine_name: str, + extension_name: str, + extension_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MachineExtension]: + """The operation to update the extension. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the machine where the extension should be created or + updated. Required. + :type virtual_machine_name: str + :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. + Required. + :type extension_parameters: 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 MachineExtension or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.scvmm.models.MachineExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + virtual_machine_name: str, + extension_name: str, + extension_parameters: Union[_models.MachineExtensionUpdate, IO], + **kwargs: Any + ) -> LROPoller[_models.MachineExtension]: + """The operation to update the extension. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the machine where the extension should be created or + updated. Required. + :type virtual_machine_name: str + :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 MachineExtensionUpdate type or a IO type. Required. + :type extension_parameters: ~azure.mgmt.scvmm.models.MachineExtensionUpdate 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 MachineExtension or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.scvmm.models.MachineExtension] + :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.MachineExtension] = 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_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + extension_name=extension_name, + extension_parameters=extension_parameters, + 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("MachineExtension", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + 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_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/extensions/{extensionName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_machine_name: str, extension_name: 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_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + extension_name=extension_name, + subscription_id=self._config.subscription_id, + 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 [200, 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) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/extensions/{extensionName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, virtual_machine_name: str, extension_name: str, **kwargs: Any + ) -> LROPoller[None]: + """The operation to delete the extension. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the machine where the extension should be created or + updated. Required. + :type virtual_machine_name: str + :param extension_name: The name of the machine extension. Required. + :type extension_name: 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_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + extension_name=extension_name, + 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": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/extensions/{extensionName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, virtual_machine_name: str, extension_name: str, **kwargs: Any + ) -> _models.MachineExtension: + """The operation to get the extension. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the machine where the extension should be created or + updated. Required. + :type virtual_machine_name: str + :param extension_name: The name of the machine extension. Required. + :type extension_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MachineExtension or the result of cls(response) + :rtype: ~azure.mgmt.scvmm.models.MachineExtension + :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.MachineExtension] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + extension_name=extension_name, + subscription_id=self._config.subscription_id, + 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("MachineExtension", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/extensions/{extensionName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, virtual_machine_name: str, expand: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.MachineExtension"]: + """The operation to get all extensions of a non-Azure machine. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the machine where the extension should be created or + updated. Required. + :type virtual_machine_name: str + :param expand: The expand expression to apply on the operation. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MachineExtension or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.scvmm.models.MachineExtension] + :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.MachineExtensionsListResult] = 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_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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("MachineExtensionsListResult", 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": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/extensions" + } diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_operations.py index 9309903e2e33..28fd53c34486 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/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 _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["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94,9 +87,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.ResourceProviderOperationList] = kwargs.pop("cls", None) error_map = { @@ -147,8 +138,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/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_machine_templates_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_machine_templates_operations.py index 4514da8ea8d5..2cd6d707511c 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_machine_templates_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_machine_templates_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, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +31,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -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 +44,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -84,9 +77,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["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -127,9 +118,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -164,9 +153,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -200,9 +187,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["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -230,9 +215,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -301,9 +284,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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( @@ -318,8 +299,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 @@ -358,9 +340,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -387,8 +367,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 @@ -503,7 +484,7 @@ def begin_create_or_update( :type resource_group_name: str :param virtual_machine_template_name: Name of the VirtualMachineTemplate. Required. :type virtual_machine_template_name: str - :param body: Request payload. Is either a model type or a IO type. Required. + :param body: Request payload. Is either a VirtualMachineTemplate type or a IO type. Required. :type body: ~azure.mgmt.scvmm.models.VirtualMachineTemplate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -524,9 +505,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["2020-06-05-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) @@ -587,9 +566,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["2020-06-05-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( @@ -605,8 +582,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 @@ -653,9 +631,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -716,9 +692,7 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.VirtualMachineTemplate]] = kwargs.pop("cls", None) @@ -745,8 +719,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 @@ -862,8 +837,8 @@ def begin_update( :type resource_group_name: str :param virtual_machine_template_name: Name of the VirtualMachineTemplate. Required. :type virtual_machine_template_name: str - :param body: VirtualMachineTemplates patch details. Is either a model type or a IO type. - Required. + :param body: VirtualMachineTemplates patch details. Is either a ResourcePatch type or a IO + type. Required. :type body: ~azure.mgmt.scvmm.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -884,9 +859,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -952,9 +925,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.VirtualMachineTemplateListResult] = kwargs.pop("cls", None) error_map = { @@ -1007,8 +978,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 @@ -1040,9 +1012,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.VirtualMachin _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.VirtualMachineTemplateListResult] = kwargs.pop("cls", None) error_map = { @@ -1094,8 +1064,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/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_machines_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_machines_operations.py index 135c35326583..a8a6d5f4c14f 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_machines_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_machines_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, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +31,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -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 +44,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,9 +75,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["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -119,14 +110,13 @@ def build_delete_request( *, retain: Optional[bool] = None, force: Optional[bool] = None, + delete_from_host: 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["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -148,6 +138,8 @@ def build_delete_request( _params["retain"] = _SERIALIZER.query("retain", retain, "bool") if force is not None: _params["force"] = _SERIALIZER.query("force", force, "bool") + if delete_from_host is not None: + _params["deleteFromHost"] = _SERIALIZER.query("delete_from_host", delete_from_host, "bool") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -161,9 +153,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -197,9 +187,7 @@ def build_stop_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -233,9 +221,7 @@ def build_start_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -266,9 +252,7 @@ def build_restart_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -299,9 +283,7 @@ def build_create_checkpoint_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -335,9 +317,7 @@ def build_delete_checkpoint_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -371,9 +351,7 @@ def build_restore_checkpoint_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -405,9 +383,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["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -435,9 +411,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -502,9 +476,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["2020-06-05-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( @@ -519,8 +491,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 @@ -559,9 +532,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -588,8 +559,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 @@ -704,7 +676,7 @@ def begin_create_or_update( :type resource_group_name: str :param virtual_machine_name: Name of the VirtualMachine. Required. :type virtual_machine_name: str - :param body: Request payload. Is either a model type or a IO type. Required. + :param body: Request payload. Is either a VirtualMachine type or a IO type. Required. :type body: ~azure.mgmt.scvmm.models.VirtualMachine or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -725,9 +697,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["2020-06-05-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) @@ -780,6 +750,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements virtual_machine_name: str, retain: Optional[bool] = None, force: Optional[bool] = None, + delete_from_host: Optional[bool] = None, **kwargs: Any ) -> None: error_map = { @@ -793,9 +764,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["2020-06-05-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( @@ -804,6 +773,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, retain=retain, force=force, + delete_from_host=delete_from_host, api_version=api_version, template_url=self._delete_initial.metadata["url"], headers=_headers, @@ -812,8 +782,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 @@ -837,6 +808,7 @@ def begin_delete( virtual_machine_name: str, retain: Optional[bool] = None, force: Optional[bool] = None, + delete_from_host: Optional[bool] = None, **kwargs: Any ) -> LROPoller[None]: """Implements VirtualMachine DELETE method. @@ -853,6 +825,9 @@ def begin_delete( :param force: Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted too. Default value is None. :type force: bool + :param delete_from_host: Whether to disable the VM from azure and also delete it from VMM. + Default value is None. + :type delete_from_host: 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 @@ -868,9 +843,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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,6 +854,7 @@ def begin_delete( virtual_machine_name=virtual_machine_name, retain=retain, force=force, + delete_from_host=delete_from_host, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -932,9 +906,7 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -961,8 +933,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 @@ -1078,7 +1051,8 @@ def begin_update( :type resource_group_name: str :param virtual_machine_name: Name of the VirtualMachine. Required. :type virtual_machine_name: str - :param body: VirtualMachines patch payload. Is either a model type or a IO type. Required. + :param body: VirtualMachines patch payload. Is either a VirtualMachineUpdate type or a IO type. + Required. :type body: ~azure.mgmt.scvmm.models.VirtualMachineUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1099,9 +1073,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -1166,9 +1138,7 @@ 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["2020-06-05-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) @@ -1198,8 +1168,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 @@ -1304,8 +1275,8 @@ def begin_stop( :type resource_group_name: str :param virtual_machine_name: Name of the VirtualMachine. 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.scvmm.models.StopVirtualMachineOptions or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1325,9 +1296,7 @@ def begin_stop( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -1384,9 +1353,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["2020-06-05-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( @@ -1401,8 +1368,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 @@ -1444,9 +1412,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["2020-06-05-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) @@ -1500,9 +1466,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["2020-06-05-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( @@ -1517,8 +1481,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 @@ -1560,9 +1525,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["2020-06-05-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) @@ -1620,9 +1583,7 @@ def _create_checkpoint_initial( # pylint: disable=inconsistent-return-statement _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -1652,8 +1613,9 @@ def _create_checkpoint_initial( # pylint: disable=inconsistent-return-statement 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 @@ -1758,8 +1720,8 @@ def begin_create_checkpoint( :type resource_group_name: str :param virtual_machine_name: Name of the VirtualMachine. Required. :type virtual_machine_name: str - :param body: Virtualmachine create checkpoint action payload. Is either a model type or a IO - type. Default value is None. + :param body: Virtualmachine create checkpoint action payload. Is either a + VirtualMachineCreateCheckpoint type or a IO type. Default value is None. :type body: ~azure.mgmt.scvmm.models.VirtualMachineCreateCheckpoint or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1779,9 +1741,7 @@ def begin_create_checkpoint( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -1842,9 +1802,7 @@ def _delete_checkpoint_initial( # pylint: disable=inconsistent-return-statement _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -1874,8 +1832,9 @@ def _delete_checkpoint_initial( # pylint: disable=inconsistent-return-statement 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 @@ -1980,8 +1939,8 @@ def begin_delete_checkpoint( :type resource_group_name: str :param virtual_machine_name: Name of the VirtualMachine. Required. :type virtual_machine_name: str - :param body: Virtualmachine delete checkpoint action payload. Is either a model type or a IO - type. Default value is None. + :param body: Virtualmachine delete checkpoint action payload. Is either a + VirtualMachineDeleteCheckpoint type or a IO type. Default value is None. :type body: ~azure.mgmt.scvmm.models.VirtualMachineDeleteCheckpoint or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2001,9 +1960,7 @@ def begin_delete_checkpoint( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -2064,9 +2021,7 @@ def _restore_checkpoint_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["2020-06-05-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) @@ -2096,8 +2051,9 @@ def _restore_checkpoint_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 @@ -2202,8 +2158,8 @@ def begin_restore_checkpoint( :type resource_group_name: str :param virtual_machine_name: Name of the VirtualMachine. Required. :type virtual_machine_name: str - :param body: Virtualmachine restore checkpoint action payload. Is either a model type or a IO - type. Default value is None. + :param body: Virtualmachine restore checkpoint action payload. Is either a + VirtualMachineRestoreCheckpoint type or a IO type. Default value is None. :type body: ~azure.mgmt.scvmm.models.VirtualMachineRestoreCheckpoint or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2223,9 +2179,7 @@ def begin_restore_checkpoint( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -2284,9 +2238,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["2020-06-05-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.VirtualMachineListResult] = kwargs.pop("cls", None) error_map = { @@ -2339,8 +2291,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 @@ -2371,9 +2324,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.VirtualMachin _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.VirtualMachineListResult] = kwargs.pop("cls", None) error_map = { @@ -2425,8 +2376,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/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_networks_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_networks_operations.py index 77ed816f6569..a45a3ecd4ebd 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_networks_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_networks_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, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +31,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -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 +44,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,9 +75,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["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -123,9 +114,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,9 +147,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -192,9 +179,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["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -222,9 +207,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -289,9 +272,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["2020-06-05-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( @@ -306,8 +287,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 @@ -346,9 +328,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -375,8 +355,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 @@ -491,7 +472,7 @@ def begin_create_or_update( :type resource_group_name: str :param virtual_network_name: Name of the VirtualNetwork. Required. :type virtual_network_name: str - :param body: Request payload. Is either a model type or a IO type. Required. + :param body: Request payload. Is either a VirtualNetwork type or a IO type. Required. :type body: ~azure.mgmt.scvmm.models.VirtualNetwork or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -512,9 +493,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["2020-06-05-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) @@ -575,9 +554,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["2020-06-05-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( @@ -593,8 +570,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 @@ -641,9 +619,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -700,9 +676,7 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.VirtualNetwork]] = kwargs.pop("cls", None) @@ -729,8 +703,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 @@ -842,7 +817,8 @@ def begin_update( :type resource_group_name: str :param virtual_network_name: Name of the VirtualNetwork. Required. :type virtual_network_name: str - :param body: VirtualNetworks patch payload. Is either a model type or a IO type. Required. + :param body: VirtualNetworks patch payload. Is either a ResourcePatch type or a IO type. + Required. :type body: ~azure.mgmt.scvmm.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -863,9 +839,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -928,9 +902,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["2020-06-05-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.VirtualNetworkListResult] = kwargs.pop("cls", None) error_map = { @@ -983,8 +955,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 @@ -1015,9 +988,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.VirtualNetwor _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.VirtualNetworkListResult] = kwargs.pop("cls", None) error_map = { @@ -1069,8 +1040,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/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_vmm_servers_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_vmm_servers_operations.py index c49e89f68ea7..5e52083e1fc9 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_vmm_servers_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_vmm_servers_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, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +31,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -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 +44,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,9 +75,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["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -118,9 +109,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -153,9 +142,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -187,9 +174,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["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -217,9 +202,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-21-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -284,9 +267,7 @@ def get(self, resource_group_name: str, vmm_server_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.VMMServer] = kwargs.pop("cls", None) request = build_get_request( @@ -301,8 +282,9 @@ def get(self, resource_group_name: str, vmm_server_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 @@ -337,9 +319,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.VMMServer] = kwargs.pop("cls", None) @@ -366,8 +346,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 @@ -476,7 +457,7 @@ def begin_create_or_update( :type resource_group_name: str :param vmm_server_name: Name of the VMMServer. Required. :type vmm_server_name: str - :param body: Request payload. Is either a model type or a IO type. Required. + :param body: Request payload. Is either a VMMServer type or a IO type. Required. :type body: ~azure.mgmt.scvmm.models.VMMServer or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -496,9 +477,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["2020-06-05-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.VMMServer] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -559,9 +538,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["2020-06-05-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( @@ -577,8 +554,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 @@ -625,9 +603,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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) @@ -684,9 +660,7 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.VMMServer]] = kwargs.pop("cls", None) @@ -713,8 +687,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 @@ -824,7 +799,7 @@ def begin_update( :type resource_group_name: str :param vmm_server_name: Name of the VMMServer. Required. :type vmm_server_name: str - :param body: VmmServers patch payload. Is either a model type or a IO type. Required. + :param body: VmmServers patch payload. Is either a ResourcePatch type or a IO type. Required. :type body: ~azure.mgmt.scvmm.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -844,9 +819,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.VMMServer] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -909,9 +882,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["2020-06-05-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.VMMServerListResult] = kwargs.pop("cls", None) error_map = { @@ -964,8 +935,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 @@ -996,9 +968,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.VMMServer"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-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.VMMServerListResult] = kwargs.pop("cls", None) error_map = { @@ -1050,8 +1020,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/scvmm/azure-mgmt-scvmm/generated_samples/create_availability_set.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_availability_set.py index 09aec99952ca..d5092f5c686a 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_availability_set.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_availability_set.py @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/CreateAvailabilitySet.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/CreateAvailabilitySet.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_checkpoint_virtual_machine.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_checkpoint_virtual_machine.py index 019b69ea9186..278403abae1e 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_checkpoint_virtual_machine.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_checkpoint_virtual_machine.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/CreateCheckpointVirtualMachine.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/CreateCheckpointVirtualMachine.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_cloud.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_cloud.py index 41adcb45c5b9..e5ab7cce4c78 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_cloud.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_cloud.py @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/CreateCloud.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/CreateCloud.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_guest_agent.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_guest_agent.py new file mode 100644 index 000000000000..6b05ee3143f4 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_guest_agent.py @@ -0,0 +1,42 @@ +# 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.scvmm import SCVMM + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-scvmm +# USAGE + python create_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 = SCVMM( + credential=DefaultAzureCredential(), + subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + ) + + response = client.guest_agents.begin_create( + resource_group_name="testrg", + virtual_machine_name="ContosoVm", + guest_agent_name="default", + ).result() + print(response) + + +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/CreateGuestAgent.json +if __name__ == "__main__": + main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_hybrid_identity_metadata.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_hybrid_identity_metadata.py new file mode 100644 index 000000000000..8488aa907602 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_hybrid_identity_metadata.py @@ -0,0 +1,42 @@ +# 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.scvmm import SCVMM + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-scvmm +# USAGE + python create_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 = SCVMM( + credential=DefaultAzureCredential(), + subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + ) + + response = client.hybrid_identity_metadatas.create( + resource_group_name="testrg", + virtual_machine_name="ContosoVm", + metadata_name="default", + ) + print(response) + + +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/CreateHybridIdentityMetadata.json +if __name__ == "__main__": + main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_inventory_item.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_inventory_item.py index 36b1578a9690..91039666ffb2 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_inventory_item.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_inventory_item.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/CreateInventoryItem.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/CreateInventoryItem.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_virtual_machine.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_virtual_machine.py index 5679ed55d3ed..b9b5c51428d6 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_virtual_machine.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_virtual_machine.py @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/CreateVirtualMachine.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/CreateVirtualMachine.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_virtual_machine_template.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_virtual_machine_template.py index b1d17a5afc9f..82d03a034d7f 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_virtual_machine_template.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_virtual_machine_template.py @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/CreateVirtualMachineTemplate.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/CreateVirtualMachineTemplate.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_virtual_network.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_virtual_network.py index f7667df8ebf3..21b8ec83102d 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_virtual_network.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_virtual_network.py @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/CreateVirtualNetwork.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/CreateVirtualNetwork.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_vmm_server.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_vmm_server.py index 298aa7396382..15b913ae0aaf 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_vmm_server.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_vmm_server.py @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/CreateVMMServer.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/CreateVMMServer.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_availability_set.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_availability_set.py index 7001248e9f7d..b75f0e95ccdd 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_availability_set.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_availability_set.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/DeleteAvailabilitySet.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/DeleteAvailabilitySet.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_checkpoint_virtual_machine.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_checkpoint_virtual_machine.py index 76084a1b9129..6c973f7b680c 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_checkpoint_virtual_machine.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_checkpoint_virtual_machine.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/DeleteCheckpointVirtualMachine.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/DeleteCheckpointVirtualMachine.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_cloud.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_cloud.py index fd345e085d25..69485944bfe3 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_cloud.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_cloud.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/DeleteCloud.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/DeleteCloud.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_extension.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_extension.py new file mode 100644 index 000000000000..42047c09f621 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_extension.py @@ -0,0 +1,42 @@ +# 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.scvmm import SCVMM + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-scvmm +# USAGE + python delete_extension.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 = SCVMM( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.machine_extensions.begin_delete( + resource_group_name="myResourceGroup", + virtual_machine_name="myMachine", + extension_name="MMA", + ).result() + print(response) + + +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/DeleteExtension.json +if __name__ == "__main__": + main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_guest_agent.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_guest_agent.py new file mode 100644 index 000000000000..fb2f2f9f4776 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_guest_agent.py @@ -0,0 +1,42 @@ +# 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.scvmm import SCVMM + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-scvmm +# USAGE + python delete_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 = SCVMM( + credential=DefaultAzureCredential(), + subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + ) + + response = client.guest_agents.begin_delete( + resource_group_name="testrg", + virtual_machine_name="ContosoVm", + guest_agent_name="default", + ).result() + print(response) + + +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/DeleteGuestAgent.json +if __name__ == "__main__": + main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_hybrid_identity_metadata.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_hybrid_identity_metadata.py new file mode 100644 index 000000000000..5eeacc28266b --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_hybrid_identity_metadata.py @@ -0,0 +1,42 @@ +# 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.scvmm import SCVMM + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-scvmm +# USAGE + python delete_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 = SCVMM( + credential=DefaultAzureCredential(), + subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + ) + + response = client.hybrid_identity_metadatas.delete( + resource_group_name="testrg", + virtual_machine_name="ContosoVm", + metadata_name="default", + ) + print(response) + + +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/DeleteHybridIdentityMetadata.json +if __name__ == "__main__": + main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_inventory_item.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_inventory_item.py index 7c690d4e1a08..cfff78796e53 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_inventory_item.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_inventory_item.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/DeleteInventoryItem.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/DeleteInventoryItem.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_virtual_machine.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_virtual_machine.py index 72e98c835370..b44ccd3a916e 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_virtual_machine.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_virtual_machine.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/DeleteVirtualMachine.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/DeleteVirtualMachine.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_virtual_machine_template.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_virtual_machine_template.py index 7a01b0aedeea..3c324bda9b11 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_virtual_machine_template.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_virtual_machine_template.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/DeleteVirtualMachineTemplate.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/DeleteVirtualMachineTemplate.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_virtual_network.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_virtual_network.py index 405a98921563..d460cbfc9f3b 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_virtual_network.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_virtual_network.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/DeleteVirtualNetwork.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/DeleteVirtualNetwork.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_vmm_server.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_vmm_server.py index c3404a219776..24401db20c92 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_vmm_server.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_vmm_server.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/DeleteVMMServer.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/DeleteVMMServer.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_availability_set.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_availability_set.py index 3479e2ac7730..a0a8df896807 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_availability_set.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_availability_set.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/GetAvailabilitySet.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/GetAvailabilitySet.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_cloud.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_cloud.py index 789b98c1d299..24235e9ba747 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_cloud.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_cloud.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/GetCloud.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/GetCloud.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_extension.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_extension.py new file mode 100644 index 000000000000..b5c3812084d5 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_extension.py @@ -0,0 +1,42 @@ +# 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.scvmm import SCVMM + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-scvmm +# USAGE + python get_extension.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 = SCVMM( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.machine_extensions.get( + resource_group_name="myResourceGroup", + virtual_machine_name="myMachine", + extension_name="CustomScriptExtension", + ) + print(response) + + +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/GETExtension.json +if __name__ == "__main__": + main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_guest_agent.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_guest_agent.py new file mode 100644 index 000000000000..e117fde7682a --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_guest_agent.py @@ -0,0 +1,42 @@ +# 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.scvmm import SCVMM + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-scvmm +# USAGE + python get_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 = SCVMM( + credential=DefaultAzureCredential(), + subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + ) + + response = client.guest_agents.get( + resource_group_name="testrg", + virtual_machine_name="ContosoVm", + guest_agent_name="default", + ) + print(response) + + +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/GetGuestAgent.json +if __name__ == "__main__": + main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_hybrid_identity_metadata.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_hybrid_identity_metadata.py new file mode 100644 index 000000000000..b1b56556d816 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_hybrid_identity_metadata.py @@ -0,0 +1,42 @@ +# 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.scvmm import SCVMM + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-scvmm +# USAGE + python get_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 = SCVMM( + credential=DefaultAzureCredential(), + subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + ) + + response = client.hybrid_identity_metadatas.get( + resource_group_name="testrg", + virtual_machine_name="ContosoVm", + metadata_name="default", + ) + print(response) + + +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/GetHybridIdentityMetadata.json +if __name__ == "__main__": + main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_inventory_item.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_inventory_item.py index 64395ae730ca..8f78f5b1811c 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_inventory_item.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_inventory_item.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/GetInventoryItem.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/GetInventoryItem.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_virtual_machine.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_virtual_machine.py index d97c7cd87e2e..0d840fe1c66e 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_virtual_machine.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_virtual_machine.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/GetVirtualMachine.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/GetVirtualMachine.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_virtual_machine_template.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_virtual_machine_template.py index d6d986e23815..20e288081d15 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_virtual_machine_template.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_virtual_machine_template.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/GetVirtualMachineTemplate.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/GetVirtualMachineTemplate.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_virtual_network.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_virtual_network.py index 625426056ba5..971e15133a67 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_virtual_network.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_virtual_network.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/GetVirtualNetwork.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/GetVirtualNetwork.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_vmm_server.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_vmm_server.py index e56728fba2c6..1bd5c8a92db3 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_vmm_server.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_vmm_server.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/GetVMMServer.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/GetVMMServer.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/guest_agent_list_by_vm.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/guest_agent_list_by_vm.py new file mode 100644 index 000000000000..4c9a386757ed --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/guest_agent_list_by_vm.py @@ -0,0 +1,42 @@ +# 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.scvmm import SCVMM + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-scvmm +# USAGE + python 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 = SCVMM( + credential=DefaultAzureCredential(), + subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + ) + + response = client.guest_agents.list_by_vm( + resource_group_name="testrg", + virtual_machine_name="ContosoVm", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/GuestAgent_ListByVm.json +if __name__ == "__main__": + main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/hybrid_identity_metadata_list_by_vm.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/hybrid_identity_metadata_list_by_vm.py new file mode 100644 index 000000000000..f5f6443be11a --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/hybrid_identity_metadata_list_by_vm.py @@ -0,0 +1,42 @@ +# 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.scvmm import SCVMM + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-scvmm +# USAGE + python hybrid_identity_metadata_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 = SCVMM( + credential=DefaultAzureCredential(), + subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + ) + + response = client.hybrid_identity_metadatas.list_by_vm( + resource_group_name="testrg", + virtual_machine_name="ContosoVm", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/HybridIdentityMetadata_ListByVm.json +if __name__ == "__main__": + main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_availability_sets_by_resource_group.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_availability_sets_by_resource_group.py index cf19f30ca076..06a05b5bf025 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_availability_sets_by_resource_group.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_availability_sets_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListAvailabilitySetsByResourceGroup.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/ListAvailabilitySetsByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_availability_sets_by_subscription.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_availability_sets_by_subscription.py index fe48ff92976b..04e927cb342f 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_availability_sets_by_subscription.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_availability_sets_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListAvailabilitySetsBySubscription.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/ListAvailabilitySetsBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_clouds_by_resource_group.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_clouds_by_resource_group.py index 1d5d832e52a8..f7fee4ca4834 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_clouds_by_resource_group.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_clouds_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListCloudsByResourceGroup.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/ListCloudsByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_clouds_by_subscription.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_clouds_by_subscription.py index f52eb9215a2d..43dbb467d711 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_clouds_by_subscription.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_clouds_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListCloudsBySubscription.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/ListCloudsBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_extension.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_extension.py new file mode 100644 index 000000000000..c805cdf80aa2 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_extension.py @@ -0,0 +1,42 @@ +# 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.scvmm import SCVMM + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-scvmm +# USAGE + python list_extension.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 = SCVMM( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.machine_extensions.list( + resource_group_name="myResourceGroup", + virtual_machine_name="myMachine", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/ListExtension.json +if __name__ == "__main__": + main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_inventory_items_by_vmm_server.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_inventory_items_by_vmm_server.py index c51bde92d0cd..e58f57caaad6 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_inventory_items_by_vmm_server.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_inventory_items_by_vmm_server.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListInventoryItemsByVMMServer.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/ListInventoryItemsByVMMServer.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_operations.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_operations.py index 52dc365c239b..31381b172799 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_operations.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListOperations.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/ListOperations.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_machine_templates_by_resource_group.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_machine_templates_by_resource_group.py index f104f0d59b5e..9f320c48cbe4 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_machine_templates_by_resource_group.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_machine_templates_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListVirtualMachineTemplatesByResourceGroup.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/ListVirtualMachineTemplatesByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_machine_templates_by_subscription.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_machine_templates_by_subscription.py index 5b83ad605544..e4c50485eea2 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_machine_templates_by_subscription.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_machine_templates_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListVirtualMachineTemplatesBySubscription.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/ListVirtualMachineTemplatesBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_machines_by_resource_group.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_machines_by_resource_group.py index 1f07268d39ce..1e74dae6688a 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_machines_by_resource_group.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_machines_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListVirtualMachinesByResourceGroup.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/ListVirtualMachinesByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_machines_by_subscription.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_machines_by_subscription.py index 5c76837814d3..fe8716f4dff0 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_machines_by_subscription.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_machines_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListVirtualMachinesBySubscription.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/ListVirtualMachinesBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_networks_by_resource_group.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_networks_by_resource_group.py index ca8357581634..3d131c951ff4 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_networks_by_resource_group.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_networks_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListVirtualNetworksByResourceGroup.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/ListVirtualNetworksByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_networks_by_subscription.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_networks_by_subscription.py index 1617caa7dca6..131489bb4699 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_networks_by_subscription.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_networks_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListVirtualNetworksBySubscription.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/ListVirtualNetworksBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_vmm_servers_by_resource_group.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_vmm_servers_by_resource_group.py index 7e86e21d88ba..ea8b04361177 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_vmm_servers_by_resource_group.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_vmm_servers_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListVMMServersByResourceGroup.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/ListVMMServersByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_vmm_servers_by_subscription.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_vmm_servers_by_subscription.py index d93d3a2f762d..0257be5d327a 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_vmm_servers_by_subscription.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_vmm_servers_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListVMMServersBySubscription.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/ListVMMServersBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/put_extension.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/put_extension.py new file mode 100644 index 000000000000..65dd75516ada --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/put_extension.py @@ -0,0 +1,51 @@ +# 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.scvmm import SCVMM + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-scvmm +# USAGE + python put_extension.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 = SCVMM( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.machine_extensions.begin_create_or_update( + resource_group_name="myResourceGroup", + virtual_machine_name="myMachine", + extension_name="CustomScriptExtension", + extension_parameters={ + "location": "eastus2euap", + "properties": { + "publisher": "Microsoft.Compute", + "settings": {"commandToExecute": 'powershell.exe -c "Get-Process | Where-Object { $_.CPU -gt 10000 }"'}, + "type": "CustomScriptExtension", + "typeHandlerVersion": "1.10", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/PUTExtension.json +if __name__ == "__main__": + main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/restart_virtual_machine.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/restart_virtual_machine.py index 7dbe48ecad11..bfbd179f350b 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/restart_virtual_machine.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/restart_virtual_machine.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/RestartVirtualMachine.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/RestartVirtualMachine.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/restore_checkpoint_virtual_machine.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/restore_checkpoint_virtual_machine.py index 617969a2d794..103b213b4082 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/restore_checkpoint_virtual_machine.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/restore_checkpoint_virtual_machine.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/RestoreCheckpointVirtualMachine.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/RestoreCheckpointVirtualMachine.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/start_virtual_machine.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/start_virtual_machine.py index 5e085c79dfa7..457f24754ad3 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/start_virtual_machine.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/start_virtual_machine.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/StartVirtualMachine.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/StartVirtualMachine.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/stop_virtual_machine.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/stop_virtual_machine.py index c561ca55c579..3a09f1e482e3 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/stop_virtual_machine.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/stop_virtual_machine.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/StopVirtualMachine.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/StopVirtualMachine.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_availability_set.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_availability_set.py index 1b478fd4e0b8..1ce5e9fd8c34 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_availability_set.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_availability_set.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/UpdateAvailabilitySet.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/UpdateAvailabilitySet.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_cloud.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_cloud.py index b2c4f2aedaf0..a374142422ff 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_cloud.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_cloud.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/UpdateCloud.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/UpdateCloud.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_extension.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_extension.py new file mode 100644 index 000000000000..fedf335276e3 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_extension.py @@ -0,0 +1,50 @@ +# 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.scvmm import SCVMM + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-scvmm +# USAGE + python update_extension.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 = SCVMM( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.machine_extensions.begin_update( + resource_group_name="myResourceGroup", + virtual_machine_name="myMachine", + extension_name="CustomScriptExtension", + extension_parameters={ + "properties": { + "publisher": "Microsoft.Compute", + "settings": {"commandToExecute": 'powershell.exe -c "Get-Process | Where-Object { $_.CPU -lt 100 }"'}, + "type": "CustomScriptExtension", + "typeHandlerVersion": "1.10", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/UpdateExtension.json +if __name__ == "__main__": + main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_virtual_machine.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_virtual_machine.py index ff629cb9cc02..a3a2fe559207 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_virtual_machine.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_virtual_machine.py @@ -53,6 +53,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/UpdateVirtualMachine.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/UpdateVirtualMachine.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_virtual_machine_template.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_virtual_machine_template.py index 42aa0f887f2b..764018c51bf4 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_virtual_machine_template.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_virtual_machine_template.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/UpdateVirtualMachineTemplate.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/UpdateVirtualMachineTemplate.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_virtual_network.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_virtual_network.py index 0b9ebcca7e2a..4ab4c71edbd3 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_virtual_network.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_virtual_network.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/UpdateVirtualNetwork.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/UpdateVirtualNetwork.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_vmm_server.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_vmm_server.py index 434cb346e26f..eddf30b403f5 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_vmm_server.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_vmm_server.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/UpdateVMMServer.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2022-05-21-preview/examples/UpdateVMMServer.json if __name__ == "__main__": main()