diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/_meta.json b/sdk/azurestackhci/azure-mgmt-azurestackhci/_meta.json index 2cfc7462ed699..049f5cee07867 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/_meta.json +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/_meta.json @@ -1,11 +1,11 @@ { - "commit": "85ea3e489c45e80383801d4f3a1278f1e687a7b8", + "commit": "eb24bd97d6d3ac3c726a4f4ad83db22a33923b5d", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.2.7", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/azurestackhci/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 --tag=package-preview-2021-09 --use=@autorest/python@6.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/azurestackhci/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/azurestackhci/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_azure_stack_hci_client.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_azure_stack_hci_client.py index 32e0c50c3a1f8..54d342777d561 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_azure_stack_hci_client.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_azure_stack_hci_client.py @@ -16,21 +16,17 @@ from ._configuration import AzureStackHCIClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( - ArcSettingsOperations, - ClustersOperations, - ExtensionsOperations, - GalleryimagesOperations, + GalleryImagesOperations, GuestAgentOperations, GuestAgentsOperations, HybridIdentityMetadataOperations, - MachineExtensionsOperations, - MarketplacegalleryimagesOperations, - NetworkinterfacesOperations, + LogicalNetworksOperations, + MarketplaceGalleryImagesOperations, + NetworkInterfacesOperations, Operations, - StoragecontainersOperations, - VirtualharddisksOperations, - VirtualmachinesOperations, - VirtualnetworksOperations, + StorageContainersOperations, + VirtualHardDisksOperations, + VirtualMachineInstancesOperations, ) if TYPE_CHECKING: @@ -41,46 +37,39 @@ class AzureStackHCIClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Azure Stack HCI management service. - :ivar arc_settings: ArcSettingsOperations operations - :vartype arc_settings: azure.mgmt.azurestackhci.operations.ArcSettingsOperations - :ivar clusters: ClustersOperations operations - :vartype clusters: azure.mgmt.azurestackhci.operations.ClustersOperations - :ivar extensions: ExtensionsOperations operations - :vartype extensions: azure.mgmt.azurestackhci.operations.ExtensionsOperations - :ivar galleryimages: GalleryimagesOperations operations - :vartype galleryimages: azure.mgmt.azurestackhci.operations.GalleryimagesOperations - :ivar marketplacegalleryimages: MarketplacegalleryimagesOperations operations - :vartype marketplacegalleryimages: - azure.mgmt.azurestackhci.operations.MarketplacegalleryimagesOperations - :ivar networkinterfaces: NetworkinterfacesOperations operations - :vartype networkinterfaces: azure.mgmt.azurestackhci.operations.NetworkinterfacesOperations + :ivar gallery_images: GalleryImagesOperations operations + :vartype gallery_images: azure.mgmt.azurestackhci.operations.GalleryImagesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.azurestackhci.operations.Operations - :ivar storagecontainers: StoragecontainersOperations operations - :vartype storagecontainers: azure.mgmt.azurestackhci.operations.StoragecontainersOperations - :ivar virtualharddisks: VirtualharddisksOperations operations - :vartype virtualharddisks: azure.mgmt.azurestackhci.operations.VirtualharddisksOperations - :ivar virtualmachines: VirtualmachinesOperations operations - :vartype virtualmachines: azure.mgmt.azurestackhci.operations.VirtualmachinesOperations + :ivar logical_networks: LogicalNetworksOperations operations + :vartype logical_networks: azure.mgmt.azurestackhci.operations.LogicalNetworksOperations + :ivar marketplace_gallery_images: MarketplaceGalleryImagesOperations operations + :vartype marketplace_gallery_images: + azure.mgmt.azurestackhci.operations.MarketplaceGalleryImagesOperations + :ivar network_interfaces: NetworkInterfacesOperations operations + :vartype network_interfaces: azure.mgmt.azurestackhci.operations.NetworkInterfacesOperations + :ivar storage_containers: StorageContainersOperations operations + :vartype storage_containers: azure.mgmt.azurestackhci.operations.StorageContainersOperations + :ivar virtual_hard_disks: VirtualHardDisksOperations operations + :vartype virtual_hard_disks: azure.mgmt.azurestackhci.operations.VirtualHardDisksOperations + :ivar virtual_machine_instances: VirtualMachineInstancesOperations operations + :vartype virtual_machine_instances: + azure.mgmt.azurestackhci.operations.VirtualMachineInstancesOperations :ivar hybrid_identity_metadata: HybridIdentityMetadataOperations operations :vartype hybrid_identity_metadata: azure.mgmt.azurestackhci.operations.HybridIdentityMetadataOperations - :ivar machine_extensions: MachineExtensionsOperations operations - :vartype machine_extensions: azure.mgmt.azurestackhci.operations.MachineExtensionsOperations :ivar guest_agent: GuestAgentOperations operations :vartype guest_agent: azure.mgmt.azurestackhci.operations.GuestAgentOperations :ivar guest_agents: GuestAgentsOperations operations :vartype guest_agents: azure.mgmt.azurestackhci.operations.GuestAgentsOperations - :ivar virtualnetworks: VirtualnetworksOperations operations - :vartype virtualnetworks: azure.mgmt.azurestackhci.operations.VirtualnetworksOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2021-09-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-09-01". 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 Retry-After header is present. @@ -96,39 +85,37 @@ def __init__( self._config = AzureStackHCIClientConfiguration( 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) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.arc_settings = ArcSettingsOperations(self._client, self._config, self._serialize, self._deserialize) - self.clusters = ClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.extensions = ExtensionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.galleryimages = GalleryimagesOperations(self._client, self._config, self._serialize, self._deserialize) - self.marketplacegalleryimages = MarketplacegalleryimagesOperations( + self.gallery_images = GalleryImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.logical_networks = LogicalNetworksOperations( self._client, self._config, self._serialize, self._deserialize ) - self.networkinterfaces = NetworkinterfacesOperations( + self.marketplace_gallery_images = MarketplaceGalleryImagesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.storagecontainers = StoragecontainersOperations( + self.network_interfaces = NetworkInterfacesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.virtualharddisks = VirtualharddisksOperations( + self.storage_containers = StorageContainersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.virtualmachines = VirtualmachinesOperations(self._client, self._config, self._serialize, self._deserialize) - self.hybrid_identity_metadata = HybridIdentityMetadataOperations( + self.virtual_hard_disks = VirtualHardDisksOperations( self._client, self._config, self._serialize, self._deserialize ) - self.machine_extensions = MachineExtensionsOperations( + self.virtual_machine_instances = VirtualMachineInstancesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.hybrid_identity_metadata = HybridIdentityMetadataOperations( self._client, self._config, self._serialize, self._deserialize ) self.guest_agent = GuestAgentOperations(self._client, self._config, self._serialize, self._deserialize) self.guest_agents = GuestAgentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.virtualnetworks = VirtualnetworksOperations(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. @@ -159,5 +146,5 @@ def __enter__(self) -> "AzureStackHCIClient": 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/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_configuration.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_configuration.py index 7ddbc1d85b555..a02e58f5ae1d6 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_configuration.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -35,14 +29,14 @@ class AzureStackHCIClientConfiguration(Configuration): # pylint: disable=too-ma :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2021-09-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-09-01". 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(AzureStackHCIClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2021-09-01-preview"] = kwargs.pop("api_version", "2021-09-01-preview") + api_version: str = kwargs.pop("api_version", "2023-09-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_serialization.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_serialization.py index 2c170e28dbca2..4bae2292227bd 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_serialization.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -277,8 +294,8 @@ class Model(object): _attribute_map: Dict[str, Dict[str, Any]] = {} _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -287,25 +304,25 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -322,7 +339,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -336,8 +353,13 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -384,7 +406,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -396,7 +418,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -409,8 +436,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -518,7 +545,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,7 +561,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -602,7 +629,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): @@ -626,8 +653,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -636,8 +662,9 @@ def _serialize(self, target_obj, data_type=None, **kwargs): _serialized.update(_new_attr) # type: ignore _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] - except ValueError: - continue + except ValueError as err: + if isinstance(err, SerializationError): + raise except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) @@ -656,8 +683,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -715,6 +742,8 @@ def query(self, name, data, data_type, **kwargs): :param data: The data to be serialized. :param str data_type: The type to be serialized from. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None @@ -723,10 +752,8 @@ def query(self, name, data, data_type, **kwargs): # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] - if not kwargs.get("skip_quote", False): - data = [quote(str(d), safe="") for d in data] - return str(self.serialize_iter(data, internal_data_type, **kwargs)) + do_quote = not kwargs.get("skip_quote", False) + return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -777,6 +804,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -863,6 +892,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. + :keyword bool do_quote: Whether to quote the serialized result of each iterable element. + Defaults to False. :rtype: list, str """ if isinstance(data, str): @@ -875,9 +906,14 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): for d in data: try: serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized.append(None) + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + if div: serialized = ["" if s is None else str(s) for s in serialized] serialized = div.join(serialized) @@ -922,7 +958,9 @@ def serialize_dict(self, attr, dict_type, **kwargs): for key, value in attr.items(): try: serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized[self.serialize_unicode(key)] = None if "xml" in serialization_ctxt: @@ -1161,7 +1199,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1242,7 +1281,7 @@ def _extract_name_from_internal_type(internal_type): xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1266,7 +1305,7 @@ def xml_key_extractor(attr, attr_desc, data): # Integrate namespace if necessary xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): @@ -1332,7 +1371,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1391,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1471,7 +1510,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1486,7 +1525,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,7 +1535,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_vendor.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_vendor.py index 9aad73fc743e7..0dafe0e287ff1 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_vendor.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_vendor.py @@ -14,14 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_version.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_version.py index 5673000dce3fe..e5754a47ce68f 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_version.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.0.0b2" +VERSION = "1.0.0b1" diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/_azure_stack_hci_client.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/_azure_stack_hci_client.py index c160c9dda494b..02e1924175261 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/_azure_stack_hci_client.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/_azure_stack_hci_client.py @@ -16,21 +16,17 @@ from .._serialization import Deserializer, Serializer from ._configuration import AzureStackHCIClientConfiguration from .operations import ( - ArcSettingsOperations, - ClustersOperations, - ExtensionsOperations, - GalleryimagesOperations, + GalleryImagesOperations, GuestAgentOperations, GuestAgentsOperations, HybridIdentityMetadataOperations, - MachineExtensionsOperations, - MarketplacegalleryimagesOperations, - NetworkinterfacesOperations, + LogicalNetworksOperations, + MarketplaceGalleryImagesOperations, + NetworkInterfacesOperations, Operations, - StoragecontainersOperations, - VirtualharddisksOperations, - VirtualmachinesOperations, - VirtualnetworksOperations, + StorageContainersOperations, + VirtualHardDisksOperations, + VirtualMachineInstancesOperations, ) if TYPE_CHECKING: @@ -41,47 +37,41 @@ class AzureStackHCIClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Azure Stack HCI management service. - :ivar arc_settings: ArcSettingsOperations operations - :vartype arc_settings: azure.mgmt.azurestackhci.aio.operations.ArcSettingsOperations - :ivar clusters: ClustersOperations operations - :vartype clusters: azure.mgmt.azurestackhci.aio.operations.ClustersOperations - :ivar extensions: ExtensionsOperations operations - :vartype extensions: azure.mgmt.azurestackhci.aio.operations.ExtensionsOperations - :ivar galleryimages: GalleryimagesOperations operations - :vartype galleryimages: azure.mgmt.azurestackhci.aio.operations.GalleryimagesOperations - :ivar marketplacegalleryimages: MarketplacegalleryimagesOperations operations - :vartype marketplacegalleryimages: - azure.mgmt.azurestackhci.aio.operations.MarketplacegalleryimagesOperations - :ivar networkinterfaces: NetworkinterfacesOperations operations - :vartype networkinterfaces: azure.mgmt.azurestackhci.aio.operations.NetworkinterfacesOperations + :ivar gallery_images: GalleryImagesOperations operations + :vartype gallery_images: azure.mgmt.azurestackhci.aio.operations.GalleryImagesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.azurestackhci.aio.operations.Operations - :ivar storagecontainers: StoragecontainersOperations operations - :vartype storagecontainers: azure.mgmt.azurestackhci.aio.operations.StoragecontainersOperations - :ivar virtualharddisks: VirtualharddisksOperations operations - :vartype virtualharddisks: azure.mgmt.azurestackhci.aio.operations.VirtualharddisksOperations - :ivar virtualmachines: VirtualmachinesOperations operations - :vartype virtualmachines: azure.mgmt.azurestackhci.aio.operations.VirtualmachinesOperations + :ivar logical_networks: LogicalNetworksOperations operations + :vartype logical_networks: azure.mgmt.azurestackhci.aio.operations.LogicalNetworksOperations + :ivar marketplace_gallery_images: MarketplaceGalleryImagesOperations operations + :vartype marketplace_gallery_images: + azure.mgmt.azurestackhci.aio.operations.MarketplaceGalleryImagesOperations + :ivar network_interfaces: NetworkInterfacesOperations operations + :vartype network_interfaces: + azure.mgmt.azurestackhci.aio.operations.NetworkInterfacesOperations + :ivar storage_containers: StorageContainersOperations operations + :vartype storage_containers: + azure.mgmt.azurestackhci.aio.operations.StorageContainersOperations + :ivar virtual_hard_disks: VirtualHardDisksOperations operations + :vartype virtual_hard_disks: azure.mgmt.azurestackhci.aio.operations.VirtualHardDisksOperations + :ivar virtual_machine_instances: VirtualMachineInstancesOperations operations + :vartype virtual_machine_instances: + azure.mgmt.azurestackhci.aio.operations.VirtualMachineInstancesOperations :ivar hybrid_identity_metadata: HybridIdentityMetadataOperations operations :vartype hybrid_identity_metadata: azure.mgmt.azurestackhci.aio.operations.HybridIdentityMetadataOperations - :ivar machine_extensions: MachineExtensionsOperations operations - :vartype machine_extensions: - azure.mgmt.azurestackhci.aio.operations.MachineExtensionsOperations :ivar guest_agent: GuestAgentOperations operations :vartype guest_agent: azure.mgmt.azurestackhci.aio.operations.GuestAgentOperations :ivar guest_agents: GuestAgentsOperations operations :vartype guest_agents: azure.mgmt.azurestackhci.aio.operations.GuestAgentsOperations - :ivar virtualnetworks: VirtualnetworksOperations operations - :vartype virtualnetworks: azure.mgmt.azurestackhci.aio.operations.VirtualnetworksOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2021-09-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-09-01". 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 Retry-After header is present. @@ -97,39 +87,37 @@ def __init__( self._config = AzureStackHCIClientConfiguration( 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) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.arc_settings = ArcSettingsOperations(self._client, self._config, self._serialize, self._deserialize) - self.clusters = ClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.extensions = ExtensionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.galleryimages = GalleryimagesOperations(self._client, self._config, self._serialize, self._deserialize) - self.marketplacegalleryimages = MarketplacegalleryimagesOperations( + self.gallery_images = GalleryImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.logical_networks = LogicalNetworksOperations( self._client, self._config, self._serialize, self._deserialize ) - self.networkinterfaces = NetworkinterfacesOperations( + self.marketplace_gallery_images = MarketplaceGalleryImagesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.storagecontainers = StoragecontainersOperations( + self.network_interfaces = NetworkInterfacesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.virtualharddisks = VirtualharddisksOperations( + self.storage_containers = StorageContainersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.virtualmachines = VirtualmachinesOperations(self._client, self._config, self._serialize, self._deserialize) - self.hybrid_identity_metadata = HybridIdentityMetadataOperations( + self.virtual_hard_disks = VirtualHardDisksOperations( self._client, self._config, self._serialize, self._deserialize ) - self.machine_extensions = MachineExtensionsOperations( + self.virtual_machine_instances = VirtualMachineInstancesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.hybrid_identity_metadata = HybridIdentityMetadataOperations( self._client, self._config, self._serialize, self._deserialize ) self.guest_agent = GuestAgentOperations(self._client, self._config, self._serialize, self._deserialize) self.guest_agents = GuestAgentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.virtualnetworks = VirtualnetworksOperations(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. @@ -160,5 +148,5 @@ async def __aenter__(self) -> "AzureStackHCIClient": 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/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/_configuration.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/_configuration.py index 5013392e2f104..19a9c58f223f0 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/_configuration.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -35,14 +29,14 @@ class AzureStackHCIClientConfiguration(Configuration): # pylint: disable=too-ma :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2021-09-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-09-01". 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(AzureStackHCIClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2021-09-01-preview"] = kwargs.pop("api_version", "2021-09-01-preview") + api_version: str = kwargs.pop("api_version", "2023-09-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/__init__.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/__init__.py index ed88648db3111..1ff6bf5d9fef8 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/__init__.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/__init__.py @@ -6,42 +6,34 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._arc_settings_operations import ArcSettingsOperations -from ._clusters_operations import ClustersOperations -from ._extensions_operations import ExtensionsOperations -from ._galleryimages_operations import GalleryimagesOperations -from ._marketplacegalleryimages_operations import MarketplacegalleryimagesOperations -from ._networkinterfaces_operations import NetworkinterfacesOperations +from ._gallery_images_operations import GalleryImagesOperations from ._operations import Operations -from ._storagecontainers_operations import StoragecontainersOperations -from ._virtualharddisks_operations import VirtualharddisksOperations -from ._virtualmachines_operations import VirtualmachinesOperations +from ._logical_networks_operations import LogicalNetworksOperations +from ._marketplace_gallery_images_operations import MarketplaceGalleryImagesOperations +from ._network_interfaces_operations import NetworkInterfacesOperations +from ._storage_containers_operations import StorageContainersOperations +from ._virtual_hard_disks_operations import VirtualHardDisksOperations +from ._virtual_machine_instances_operations import VirtualMachineInstancesOperations from ._hybrid_identity_metadata_operations import HybridIdentityMetadataOperations -from ._machine_extensions_operations import MachineExtensionsOperations from ._guest_agent_operations import GuestAgentOperations from ._guest_agents_operations import GuestAgentsOperations -from ._virtualnetworks_operations import VirtualnetworksOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - "ArcSettingsOperations", - "ClustersOperations", - "ExtensionsOperations", - "GalleryimagesOperations", - "MarketplacegalleryimagesOperations", - "NetworkinterfacesOperations", + "GalleryImagesOperations", "Operations", - "StoragecontainersOperations", - "VirtualharddisksOperations", - "VirtualmachinesOperations", + "LogicalNetworksOperations", + "MarketplaceGalleryImagesOperations", + "NetworkInterfacesOperations", + "StorageContainersOperations", + "VirtualHardDisksOperations", + "VirtualMachineInstancesOperations", "HybridIdentityMetadataOperations", - "MachineExtensionsOperations", "GuestAgentOperations", "GuestAgentsOperations", - "VirtualnetworksOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_arc_settings_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_arc_settings_operations.py deleted file mode 100644 index 784c4f3f6ce94..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_arc_settings_operations.py +++ /dev/null @@ -1,513 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- -import sys -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._arc_settings_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_by_cluster_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]] - - -class ArcSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.azurestackhci.aio.AzureStackHCIClient`'s - :attr:`arc_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_cluster( - self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ArcSetting"]: - """Get ArcSetting resources of HCI Cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ArcSetting or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.ArcSetting] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ArcSettingList] = 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_cluster_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_cluster.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("ArcSettingList", 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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_cluster.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings" - } - - @distributed_trace_async - async def get( - self, resource_group_name: str, cluster_name: str, arc_setting_name: str, **kwargs: Any - ) -> _models.ArcSetting: - """Get ArcSetting resource details of HCI Cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. Required. - :type arc_setting_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ArcSetting or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.ArcSetting - :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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ArcSetting] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - arc_setting_name=arc_setting_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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("ArcSetting", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}" - } - - @overload - async def create( - self, - resource_group_name: str, - cluster_name: str, - arc_setting_name: str, - arc_setting: _models.ArcSetting, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ArcSetting: - """Create ArcSetting for HCI cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. Required. - :type arc_setting_name: str - :param arc_setting: Parameters supplied to the Create ArcSetting resource for this HCI cluster. - Required. - :type arc_setting: ~azure.mgmt.azurestackhci.models.ArcSetting - :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: ArcSetting or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.ArcSetting - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, - resource_group_name: str, - cluster_name: str, - arc_setting_name: str, - arc_setting: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ArcSetting: - """Create ArcSetting for HCI cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. Required. - :type arc_setting_name: str - :param arc_setting: Parameters supplied to the Create ArcSetting resource for this HCI cluster. - Required. - :type arc_setting: 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: ArcSetting or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.ArcSetting - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, - resource_group_name: str, - cluster_name: str, - arc_setting_name: str, - arc_setting: Union[_models.ArcSetting, IO], - **kwargs: Any - ) -> _models.ArcSetting: - """Create ArcSetting for HCI cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. Required. - :type arc_setting_name: str - :param arc_setting: Parameters supplied to the Create ArcSetting resource for this HCI cluster. - Is either a model type or a IO type. Required. - :type arc_setting: ~azure.mgmt.azurestackhci.models.ArcSetting 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: ArcSetting or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.ArcSetting - :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: Literal["2021-09-01-preview"] = 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.ArcSetting] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(arc_setting, (IO, bytes)): - _content = arc_setting - else: - _json = self._serialize.body(arc_setting, "ArcSetting") - - request = build_create_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - arc_setting_name=arc_setting_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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("ArcSetting", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, cluster_name: str, arc_setting_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: Literal["2021-09-01-preview"] = 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, - cluster_name=cluster_name, - arc_setting_name=arc_setting_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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}" - } - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, cluster_name: str, arc_setting_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete ArcSetting resource details of HCI Cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. Required. - :type arc_setting_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: Literal["2021-09-01-preview"] = 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, - cluster_name=cluster_name, - arc_setting_name=arc_setting_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, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}" - } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_clusters_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_clusters_operations.py deleted file mode 100644 index ba3dfc5242afe..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_clusters_operations.py +++ /dev/null @@ -1,642 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- -import sys -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._clusters_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - 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]] - - -class ClustersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.azurestackhci.aio.AzureStackHCIClient`'s - :attr:`clusters` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Cluster"]: - """List all HCI clusters in a subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Cluster or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Cluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ClusterList] = 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_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.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("ClusterList", 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/clusters" - } - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Cluster"]: - """List all HCI clusters in a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Cluster or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Cluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ClusterList] = 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_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.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("ClusterList", 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters" - } - - @distributed_trace_async - async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _models.Cluster: - """Get HCI cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Cluster or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Cluster - :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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Cluster] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - cluster_name=cluster_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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("Cluster", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}" - } - - @overload - async def create( - self, - resource_group_name: str, - cluster_name: str, - cluster: _models.Cluster, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Cluster: - """Create an HCI cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param cluster: Details of the HCI cluster. Required. - :type cluster: ~azure.mgmt.azurestackhci.models.Cluster - :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: Cluster or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Cluster - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, - resource_group_name: str, - cluster_name: str, - cluster: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Cluster: - """Create an HCI cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param cluster: Details of the HCI cluster. Required. - :type cluster: 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: Cluster or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Cluster - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, resource_group_name: str, cluster_name: str, cluster: Union[_models.Cluster, IO], **kwargs: Any - ) -> _models.Cluster: - """Create an HCI cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param cluster: Details of the HCI cluster. Is either a model type or a IO type. Required. - :type cluster: ~azure.mgmt.azurestackhci.models.Cluster 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: Cluster or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Cluster - :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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Cluster] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(cluster, (IO, bytes)): - _content = cluster - else: - _json = self._serialize.body(cluster, "Cluster") - - request = build_create_request( - resource_group_name=resource_group_name, - cluster_name=cluster_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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("Cluster", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}" - } - - @overload - async def update( - self, - resource_group_name: str, - cluster_name: str, - cluster: _models.ClusterPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Cluster: - """Update an HCI cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param cluster: Details of the HCI cluster. Required. - :type cluster: ~azure.mgmt.azurestackhci.models.ClusterPatch - :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: Cluster or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Cluster - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - cluster_name: str, - cluster: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Cluster: - """Update an HCI cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param cluster: Details of the HCI cluster. Required. - :type cluster: 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: Cluster or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Cluster - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, resource_group_name: str, cluster_name: str, cluster: Union[_models.ClusterPatch, IO], **kwargs: Any - ) -> _models.Cluster: - """Update an HCI cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param cluster: Details of the HCI cluster. Is either a model type or a IO type. Required. - :type cluster: ~azure.mgmt.azurestackhci.models.ClusterPatch 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: Cluster or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Cluster - :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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Cluster] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(cluster, (IO, bytes)): - _content = cluster - else: - _json = self._serialize.body(cluster, "ClusterPatch") - - request = build_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("Cluster", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}" - } - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> None: - """Delete an HCI cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_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: Literal["2021-09-01-preview"] = 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, - cluster_name=cluster_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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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.AzureStackHCI/clusters/{clusterName}" - } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_extensions_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_gallery_images_operations.py similarity index 67% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_extensions_operations.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_gallery_images_operations.py index 5b8b6786d8ae7..0e4dc624fa342 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_extensions_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_gallery_images_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -31,30 +31,27 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._extensions_operations import ( - build_create_request, +from ...operations._gallery_images_operations import ( + build_create_or_update_request, build_delete_request, build_get_request, - build_list_by_arc_setting_request, + build_list_all_request, + build_list_request, 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]] -class ExtensionsOperations: +class GalleryImagesOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.azurestackhci.aio.AzureStackHCIClient`'s - :attr:`extensions` attribute. + :attr:`gallery_images` attribute. """ models = _models @@ -66,122 +63,18 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list_by_arc_setting( - self, resource_group_name: str, cluster_name: str, arc_setting_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Extension"]: - """List all Extensions under ArcSetting resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. Required. - :type arc_setting_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Extension or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ExtensionList] = 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_arc_setting_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - arc_setting_name=arc_setting_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_arc_setting.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("ExtensionList", 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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_arc_setting.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions" - } - @distributed_trace_async - async def get( - self, resource_group_name: str, cluster_name: str, arc_setting_name: str, extension_name: str, **kwargs: Any - ) -> _models.Extension: - """Get particular Arc Extension of HCI Cluster. + async def get(self, resource_group_name: str, gallery_image_name: str, **kwargs: Any) -> _models.GalleryImages: + """Gets a gallery image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. Required. - :type arc_setting_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str + :param gallery_image_name: Name of the gallery image. Required. + :type gallery_image_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Extension or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Extension + :return: GalleryImages or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.GalleryImages :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -195,16 +88,12 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Extension] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GalleryImages] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, - cluster_name=cluster_name, - arc_setting_name=arc_setting_name, - extension_name=extension_name, + gallery_image_name=gallery_image_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata["url"], @@ -214,8 +103,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 @@ -225,7 +115,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Extension", pipeline_response) + deserialized = self._deserialize("GalleryImages", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -233,18 +123,16 @@ async def get( return deserialized get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}" } - async def _create_initial( + async def _create_or_update_initial( self, resource_group_name: str, - cluster_name: str, - arc_setting_name: str, - extension_name: str, - extension: Union[_models.Extension, IO], + gallery_image_name: str, + gallery_images: Union[_models.GalleryImages, IO], **kwargs: Any - ) -> _models.Extension: + ) -> _models.GalleryImages: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -256,39 +144,36 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_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.Extension] = kwargs.pop("cls", None) + cls: ClsType[_models.GalleryImages] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(extension, (IO, bytes)): - _content = extension + if isinstance(gallery_images, (IOBase, bytes)): + _content = gallery_images else: - _json = self._serialize.body(extension, "Extension") + _json = self._serialize.body(gallery_images, "GalleryImages") - request = build_create_request( + request = build_create_or_update_request( resource_group_name=resource_group_name, - cluster_name=cluster_name, - arc_setting_name=arc_setting_name, - extension_name=extension_name, + gallery_image_name=gallery_image_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"], + 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -299,46 +184,40 @@ async def _create_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("Extension", pipeline_response) + deserialized = self._deserialize("GalleryImages", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("Extension", pipeline_response) + deserialized = self._deserialize("GalleryImages", 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.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}" + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}" } @overload - async def begin_create( + async def begin_create_or_update( self, resource_group_name: str, - cluster_name: str, - arc_setting_name: str, - extension_name: str, - extension: _models.Extension, + gallery_image_name: str, + gallery_images: _models.GalleryImages, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Extension]: - """Create Extension for HCI cluster. + ) -> AsyncLROPoller[_models.GalleryImages]: + """The operation to create or update a gallery image. Please note some properties can be set only + during gallery image creation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. Required. - :type arc_setting_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension: Details of the Machine Extension to be created. Required. - :type extension: ~azure.mgmt.azurestackhci.models.Extension + :param gallery_image_name: Name of the gallery image. Required. + :type gallery_image_name: str + :param gallery_images: Required. + :type gallery_images: ~azure.mgmt.azurestackhci.models.GalleryImages :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -350,38 +229,32 @@ async def begin_create( :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 Extension or the result of + :return: An instance of AsyncLROPoller that returns either GalleryImages or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Extension] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.GalleryImages] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create( + async def begin_create_or_update( self, resource_group_name: str, - cluster_name: str, - arc_setting_name: str, - extension_name: str, - extension: IO, + gallery_image_name: str, + gallery_images: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Extension]: - """Create Extension for HCI cluster. + ) -> AsyncLROPoller[_models.GalleryImages]: + """The operation to create or update a gallery image. Please note some properties can be set only + during gallery image creation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. Required. - :type arc_setting_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension: Details of the Machine Extension to be created. Required. - :type extension: IO + :param gallery_image_name: Name of the gallery image. Required. + :type gallery_image_name: str + :param gallery_images: Required. + :type gallery_images: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -393,37 +266,30 @@ async def begin_create( :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 Extension or the result of + :return: An instance of AsyncLROPoller that returns either GalleryImages or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Extension] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.GalleryImages] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create( + async def begin_create_or_update( self, resource_group_name: str, - cluster_name: str, - arc_setting_name: str, - extension_name: str, - extension: Union[_models.Extension, IO], + gallery_image_name: str, + gallery_images: Union[_models.GalleryImages, IO], **kwargs: Any - ) -> AsyncLROPoller[_models.Extension]: - """Create Extension for HCI cluster. + ) -> AsyncLROPoller[_models.GalleryImages]: + """The operation to create or update a gallery image. Please note some properties can be set only + during gallery image creation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. Required. - :type arc_setting_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension: Details of the Machine Extension to be created. Is either a model type or a - IO type. Required. - :type extension: ~azure.mgmt.azurestackhci.models.Extension or IO + :param gallery_image_name: Name of the gallery image. Required. + :type gallery_image_name: str + :param gallery_images: Is either a GalleryImages type or a IO type. Required. + :type gallery_images: ~azure.mgmt.azurestackhci.models.GalleryImages or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -435,29 +301,25 @@ async def begin_create( :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 Extension or the result of + :return: An instance of AsyncLROPoller that returns either GalleryImages or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Extension] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.GalleryImages] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_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.Extension] = kwargs.pop("cls", None) + cls: ClsType[_models.GalleryImages] = 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( + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, - cluster_name=cluster_name, - arc_setting_name=arc_setting_name, - extension_name=extension_name, - extension=extension, + gallery_image_name=gallery_image_name, + gallery_images=gallery_images, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -468,7 +330,7 @@ async def begin_create( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Extension", pipeline_response) + deserialized = self._deserialize("GalleryImages", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized @@ -491,19 +353,138 @@ def get_long_running_output(pipeline_response): ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}" + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, gallery_image_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, + gallery_image_name=gallery_image_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) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, gallery_image_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to delete a gallery image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_image_name: Name of the gallery image. Required. + :type gallery_image_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, + gallery_image_name=gallery_image_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, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}" } async def _update_initial( self, resource_group_name: str, - cluster_name: str, - arc_setting_name: str, - extension_name: str, - extension: Union[_models.Extension, IO], + gallery_image_name: str, + gallery_images: Union[_models.GalleryImagesUpdateRequest, IO], **kwargs: Any - ) -> _models.Extension: + ) -> Optional[_models.GalleryImages]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -515,25 +496,21 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_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.Extension] = kwargs.pop("cls", None) + cls: ClsType[Optional[_models.GalleryImages]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(extension, (IO, bytes)): - _content = extension + if isinstance(gallery_images, (IOBase, bytes)): + _content = gallery_images else: - _json = self._serialize.body(extension, "Extension") + _json = self._serialize.body(gallery_images, "GalleryImagesUpdateRequest") request = build_update_request( resource_group_name=resource_group_name, - cluster_name=cluster_name, - arc_setting_name=arc_setting_name, - extension_name=extension_name, + gallery_image_name=gallery_image_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -546,54 +523,54 @@ 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 - if response.status_code not in [201]: + 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 = self._deserialize("Extension", pipeline_response) + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("GalleryImages", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}" } @overload async def begin_update( self, resource_group_name: str, - cluster_name: str, - arc_setting_name: str, - extension_name: str, - extension: _models.Extension, + gallery_image_name: str, + gallery_images: _models.GalleryImagesUpdateRequest, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Extension]: - """Update Extension for HCI cluster. + ) -> AsyncLROPoller[_models.GalleryImages]: + """The operation to update a gallery image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. Required. - :type arc_setting_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension: Details of the Machine Extension to be created. Required. - :type extension: ~azure.mgmt.azurestackhci.models.Extension + :param gallery_image_name: Name of the gallery image. Required. + :type gallery_image_name: str + :param gallery_images: Required. + :type gallery_images: ~azure.mgmt.azurestackhci.models.GalleryImagesUpdateRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -605,9 +582,9 @@ async def begin_update( :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 Extension or the result of + :return: An instance of AsyncLROPoller that returns either GalleryImages or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Extension] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.GalleryImages] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -615,28 +592,21 @@ async def begin_update( async def begin_update( self, resource_group_name: str, - cluster_name: str, - arc_setting_name: str, - extension_name: str, - extension: IO, + gallery_image_name: str, + gallery_images: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Extension]: - """Update Extension for HCI cluster. + ) -> AsyncLROPoller[_models.GalleryImages]: + """The operation to update a gallery image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. Required. - :type arc_setting_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension: Details of the Machine Extension to be created. Required. - :type extension: IO + :param gallery_image_name: Name of the gallery image. Required. + :type gallery_image_name: str + :param gallery_images: Required. + :type gallery_images: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -648,9 +618,9 @@ async def begin_update( :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 Extension or the result of + :return: An instance of AsyncLROPoller that returns either GalleryImages or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Extension] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.GalleryImages] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -658,27 +628,19 @@ async def begin_update( async def begin_update( self, resource_group_name: str, - cluster_name: str, - arc_setting_name: str, - extension_name: str, - extension: Union[_models.Extension, IO], + gallery_image_name: str, + gallery_images: Union[_models.GalleryImagesUpdateRequest, IO], **kwargs: Any - ) -> AsyncLROPoller[_models.Extension]: - """Update Extension for HCI cluster. + ) -> AsyncLROPoller[_models.GalleryImages]: + """The operation to update a gallery image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. Required. - :type arc_setting_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension: Details of the Machine Extension to be created. Is either a model type or a - IO type. Required. - :type extension: ~azure.mgmt.azurestackhci.models.Extension or IO + :param gallery_image_name: Name of the gallery image. Required. + :type gallery_image_name: str + :param gallery_images: Is either a GalleryImagesUpdateRequest type or a IO type. Required. + :type gallery_images: ~azure.mgmt.azurestackhci.models.GalleryImagesUpdateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -690,29 +652,25 @@ async def begin_update( :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 Extension or the result of + :return: An instance of AsyncLROPoller that returns either GalleryImages or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Extension] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.GalleryImages] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_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.Extension] = kwargs.pop("cls", None) + cls: ClsType[_models.GalleryImages] = 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, - cluster_name=cluster_name, - arc_setting_name=arc_setting_name, - extension_name=extension_name, - extension=extension, + gallery_image_name=gallery_image_name, + gallery_images=gallery_images, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -723,7 +681,7 @@ async def begin_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Extension", pipeline_response) + deserialized = self._deserialize("GalleryImages", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized @@ -731,7 +689,7 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) @@ -747,12 +705,28 @@ def get_long_running_output(pipeline_response): return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}" } - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, cluster_name: str, arc_setting_name: str, extension_name: str, **kwargs: Any - ) -> None: + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.GalleryImages"]: + """Lists all of the gallery images in the specified resource group. Use the nextLink property in + the response to get the next page of gallery images. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GalleryImages or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.GalleryImages] + :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.GalleryImagesListResult] = kwargs.pop("cls", None) + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -761,120 +735,145 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def prepare_request(next_link=None): + if not next_link: - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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) - request = build_delete_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - arc_setting_name=arc_setting_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) + 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 - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) + async def extract_data(pipeline_response): + deserialized = self._deserialize("GalleryImagesListResult", 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) - response = pipeline_response.http_response + async def get_next(next_link=None): + request = prepare_request(next_link) - 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) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - if cls: - return cls(pipeline_response, None, {}) + 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) - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}" + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages" } - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, cluster_name: str, arc_setting_name: str, extension_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete particular Arc Extension of HCI Cluster. + @distributed_trace + def list_all(self, **kwargs: Any) -> AsyncIterable["_models.GalleryImages"]: + """Lists all of the gallery images in the specified subscription. Use the nextLink property in the + response to get the next page of gallery images. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. Required. - :type arc_setting_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] + :return: An iterator like instance of either GalleryImages or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.GalleryImages] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = 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, - cluster_name=cluster_name, - arc_setting_name=arc_setting_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) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GalleryImagesListResult] = kwargs.pop("cls", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + 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_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.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("GalleryImagesListResult", pipeline_response) + list_of_elem = deserialized.value if cls: - return cls(pipeline_response, None, {}) + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) - 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, + 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 ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + response = pipeline_response.http_response - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}" - } + 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_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/galleryImages"} diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_galleryimages_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_galleryimages_operations.py deleted file mode 100644 index 3d719138215d1..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_galleryimages_operations.py +++ /dev/null @@ -1,744 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- -import sys -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._galleryimages_operations import ( - build_create_or_update_request, - build_delete_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_retrieve_request, - 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]] - - -class GalleryimagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.azurestackhci.aio.AzureStackHCIClient`'s - :attr:`galleryimages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def retrieve(self, resource_group_name: str, galleryimages_name: str, **kwargs: Any) -> _models.Galleryimages: - """Gets galleryimages by resource name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param galleryimages_name: Name of the gallery image. Required. - :type galleryimages_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Galleryimages or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Galleryimages - :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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Galleryimages] = kwargs.pop("cls", None) - - request = build_retrieve_request( - resource_group_name=resource_group_name, - galleryimages_name=galleryimages_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.retrieve.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("Galleryimages", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - retrieve.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages/{galleryimagesName}" - } - - async def _create_or_update_initial( - self, - resource_group_name: str, - galleryimages_name: str, - galleryimages: Union[_models.Galleryimages, IO], - **kwargs: Any - ) -> _models.Galleryimages: - 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: Literal["2021-09-01-preview"] = 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.Galleryimages] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(galleryimages, (IO, bytes)): - _content = galleryimages - else: - _json = self._serialize.body(galleryimages, "Galleryimages") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - galleryimages_name=galleryimages_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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("Galleryimages", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Galleryimages", 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.AzureStackHCI/galleryimages/{galleryimagesName}" - } - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - galleryimages_name: str, - galleryimages: _models.Galleryimages, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Galleryimages]: - """Create or update a gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param galleryimages_name: Name of the gallery image. Required. - :type galleryimages_name: str - :param galleryimages: Required. - :type galleryimages: ~azure.mgmt.azurestackhci.models.Galleryimages - :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 Galleryimages or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Galleryimages] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - galleryimages_name: str, - galleryimages: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Galleryimages]: - """Create or update a gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param galleryimages_name: Name of the gallery image. Required. - :type galleryimages_name: str - :param galleryimages: Required. - :type galleryimages: 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 Galleryimages or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Galleryimages] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - galleryimages_name: str, - galleryimages: Union[_models.Galleryimages, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.Galleryimages]: - """Create or update a gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param galleryimages_name: Name of the gallery image. Required. - :type galleryimages_name: str - :param galleryimages: Is either a model type or a IO type. Required. - :type galleryimages: ~azure.mgmt.azurestackhci.models.Galleryimages 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 Galleryimages or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Galleryimages] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = 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.Galleryimages] = 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, - galleryimages_name=galleryimages_name, - galleryimages=galleryimages, - 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("Galleryimages", 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.AzureStackHCI/galleryimages/{galleryimagesName}" - } - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, galleryimages_name: str, **kwargs: Any - ) -> None: - """Delete a gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param galleryimages_name: Name of the gallery image. Required. - :type galleryimages_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: Literal["2021-09-01-preview"] = 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, - galleryimages_name=galleryimages_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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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.AzureStackHCI/galleryimages/{galleryimagesName}" - } - - @overload - async def update( - self, - resource_group_name: str, - galleryimages_name: str, - galleryimages: _models.GalleryimagesPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Galleryimages: - """Update a gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param galleryimages_name: Name of the gallery image. Required. - :type galleryimages_name: str - :param galleryimages: Required. - :type galleryimages: ~azure.mgmt.azurestackhci.models.GalleryimagesPatch - :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: Galleryimages or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Galleryimages - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - galleryimages_name: str, - galleryimages: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Galleryimages: - """Update a gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param galleryimages_name: Name of the gallery image. Required. - :type galleryimages_name: str - :param galleryimages: Required. - :type galleryimages: 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: Galleryimages or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Galleryimages - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - galleryimages_name: str, - galleryimages: Union[_models.GalleryimagesPatch, IO], - **kwargs: Any - ) -> _models.Galleryimages: - """Update a gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param galleryimages_name: Name of the gallery image. Required. - :type galleryimages_name: str - :param galleryimages: Is either a model type or a IO type. Required. - :type galleryimages: ~azure.mgmt.azurestackhci.models.GalleryimagesPatch 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: Galleryimages or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Galleryimages - :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: Literal["2021-09-01-preview"] = 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.Galleryimages] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(galleryimages, (IO, bytes)): - _content = galleryimages - else: - _json = self._serialize.body(galleryimages, "GalleryimagesPatch") - - request = build_update_request( - resource_group_name=resource_group_name, - galleryimages_name=galleryimages_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("Galleryimages", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Galleryimages", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages/{galleryimagesName}" - } - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Galleryimages"]: - """Lists all galleryimages under the resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Galleryimages or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Galleryimages] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.GalleryimagesListResult] = 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_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.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("GalleryimagesListResult", 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages" - } - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Galleryimages"]: - """List all galleryimages under the subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Galleryimages or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Galleryimages] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.GalleryimagesListResult] = 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_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.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("GalleryimagesListResult", 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/galleryimages" - } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_guest_agent_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_guest_agent_operations.py index 13de1629bc2bb..74de4d89d7cbb 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_guest_agent_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_guest_agent_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -30,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._guest_agent_operations import build_create_request, build_delete_request, build_get_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]] @@ -58,12 +54,7 @@ def __init__(self, *args, **kwargs) -> None: 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, - name: str, - body: Optional[Union[_models.GuestAgent, IO]] = None, - **kwargs: Any + self, resource_uri: str, body: Optional[Union[_models.GuestAgent, IO]] = None, **kwargs: Any ) -> _models.GuestAgent: error_map = { 401: ClientAuthenticationError, @@ -76,16 +67,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.GuestAgent] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -94,10 +83,7 @@ async def _create_initial( _json = None request = build_create_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - name=name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, content_type=content_type, json=_json, @@ -109,8 +95,9 @@ async def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -132,15 +119,13 @@ async def _create_initial( return deserialized # type: ignore _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/guestAgents/{name}" + "url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default" } @overload async def begin_create( self, - resource_group_name: str, - virtual_machine_name: str, - name: str, + resource_uri: str, body: Optional[_models.GuestAgent] = None, *, content_type: str = "application/json", @@ -150,13 +135,9 @@ async def begin_create( Create Or Update GuestAgent. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param name: Name of the guestAgents. Required. - :type name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :param body: Request payload. Default value is None. :type body: ~azure.mgmt.azurestackhci.models.GuestAgent :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -178,26 +159,15 @@ async def begin_create( @overload async def begin_create( - self, - resource_group_name: str, - virtual_machine_name: str, - name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any + self, resource_uri: str, body: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GuestAgent]: """Implements GuestAgent PUT method. Create Or Update GuestAgent. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param name: Name of the guestAgents. Required. - :type name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :param body: Request payload. Default value is None. :type body: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -219,25 +189,16 @@ async def begin_create( @distributed_trace_async async def begin_create( - self, - resource_group_name: str, - virtual_machine_name: str, - name: str, - body: Optional[Union[_models.GuestAgent, IO]] = None, - **kwargs: Any + self, resource_uri: str, body: Optional[Union[_models.GuestAgent, IO]] = None, **kwargs: Any ) -> AsyncLROPoller[_models.GuestAgent]: """Implements GuestAgent PUT method. Create Or Update GuestAgent. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param name: Name of the guestAgents. Required. - :type name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Request payload. Is either a GuestAgent type or a IO type. Default value is None. :type body: ~azure.mgmt.azurestackhci.models.GuestAgent or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -258,9 +219,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.GuestAgent] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -268,9 +227,7 @@ async def begin_create( 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, - name=name, + resource_uri=resource_uri, body=body, api_version=api_version, content_type=content_type, @@ -306,24 +263,18 @@ def get_long_running_output(pipeline_response): return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/guestAgents/{name}" + "url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default" } @distributed_trace_async - async def get( - self, resource_group_name: str, virtual_machine_name: str, name: str, **kwargs: Any - ) -> _models.GuestAgent: + async def get(self, resource_uri: str, **kwargs: Any) -> _models.GuestAgent: """Gets GuestAgent. Implements GuestAgent GET method. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param name: Name of the GuestAgent. Required. - :type name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response :return: GuestAgent or the result of cls(response) :rtype: ~azure.mgmt.azurestackhci.models.GuestAgent @@ -340,16 +291,11 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GuestAgent] = kwargs.pop("cls", None) request = build_get_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - name=name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, template_url=self.get.metadata["url"], headers=_headers, @@ -358,8 +304,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 @@ -377,11 +324,11 @@ async def get( return deserialized get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/guestAgents/{name}" + "url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default" } async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtual_machine_name: str, name: str, **kwargs: Any + self, resource_uri: str, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -394,16 +341,11 @@ 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["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - name=name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, template_url=self._delete_initial.metadata["url"], headers=_headers, @@ -412,39 +354,38 @@ 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 - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/guestAgents/{name}" + "url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default" } @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, virtual_machine_name: str, name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes an GuestAgent. + async def begin_delete(self, resource_uri: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deleted an GuestAgent. Implements GuestAgent DELETE method. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param name: Name of the GuestAgent. Required. - :type name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -460,18 +401,14 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_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) 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, - name=name, + resource_uri=resource_uri, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -500,5 +437,5 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/guestAgents/{name}" + "url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default" } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_guest_agents_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_guest_agents_operations.py index 2eab54512479f..76a6f5d20ac49 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_guest_agents_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_guest_agents_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 @@ -28,12 +27,8 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._guest_agents_operations import build_list_by_virtual_machines_request +from ...operations._guest_agents_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]] @@ -58,18 +53,14 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_by_virtual_machines( - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GuestAgent"]: + def list(self, resource_uri: str, **kwargs: Any) -> AsyncIterable["_models.GuestAgent"]: """Implements GET GuestAgent in a vm. Returns the list of GuestAgent of the given vm. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GuestAgent or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.GuestAgent] @@ -78,9 +69,7 @@ def list_by_virtual_machines( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GuestAgentList] = kwargs.pop("cls", None) error_map = { @@ -94,12 +83,10 @@ def list_by_virtual_machines( def prepare_request(next_link=None): if not next_link: - request = build_list_by_virtual_machines_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, + request = build_list_request( + resource_uri=resource_uri, api_version=api_version, - template_url=self.list_by_virtual_machines.metadata["url"], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -134,8 +121,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 @@ -148,6 +136,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_virtual_machines.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/guestAgents" + list.metadata = { + "url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents" } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_hybrid_identity_metadata_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_hybrid_identity_metadata_operations.py index c2710f9ccf7a6..112a061c08d72 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_hybrid_identity_metadata_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_hybrid_identity_metadata_operations.py @@ -6,8 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -29,17 +28,8 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._hybrid_identity_metadata_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_by_virtual_machines_request, -) +from ...operations._hybrid_identity_metadata_operations import build_get_request, 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]] @@ -63,183 +53,15 @@ def __init__(self, *args, **kwargs) -> None: 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. The name is case insensitive. - 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.azurestackhci.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.azurestackhci.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. The name is case insensitive. - 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.azurestackhci.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. The name is case insensitive. - 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 model type or a IO type. Default value is None. - :type body: ~azure.mgmt.azurestackhci.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.azurestackhci.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: Literal["2021-09-01-preview"] = 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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.AzureStackHCI/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: + async def get(self, resource_uri: str, **kwargs: Any) -> _models.HybridIdentityMetadata: """Gets HybridIdentityMetadata. Implements HybridIdentityMetadata GET method. - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response :return: HybridIdentityMetadata or the result of cls(response) :rtype: ~azure.mgmt.azurestackhci.models.HybridIdentityMetadata @@ -256,16 +78,11 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HybridIdentityMetadata] = kwargs.pop("cls", None) request = build_get_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - metadata_name=metadata_name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, template_url=self.get.metadata["url"], headers=_headers, @@ -274,8 +91,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 @@ -293,89 +111,18 @@ async def get( return deserialized get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/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. The name is case insensitive. - 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: Literal["2021-09-01-preview"] = 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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.AzureStackHCI/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}" + "url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/hybridIdentityMetadata/default" } @distributed_trace - def list_by_virtual_machines( - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any - ) -> AsyncIterable["_models.HybridIdentityMetadata"]: + def list(self, resource_uri: 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either HybridIdentityMetadata or the result of cls(response) @@ -386,9 +133,7 @@ def list_by_virtual_machines( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HybridIdentityMetadataList] = kwargs.pop("cls", None) error_map = { @@ -402,12 +147,10 @@ def list_by_virtual_machines( def prepare_request(next_link=None): if not next_link: - request = build_list_by_virtual_machines_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, + request = build_list_request( + resource_uri=resource_uri, api_version=api_version, - template_url=self.list_by_virtual_machines.metadata["url"], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -442,8 +185,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 @@ -456,6 +200,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_virtual_machines.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/hybridIdentityMetadata" + list.metadata = { + "url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/hybridIdentityMetadata" } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_machine_extensions_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_logical_networks_operations.py similarity index 66% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_machine_extensions_operations.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_logical_networks_operations.py index 05fc1e1bab77b..1f91ac6c2fcc3 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_machine_extensions_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_logical_networks_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -31,30 +31,27 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._machine_extensions_operations import ( +from ...operations._logical_networks_operations import ( build_create_or_update_request, build_delete_request, build_get_request, - build_list_by_virtual_machines_request, + build_list_all_request, + build_list_request, 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]] -class MachineExtensionsOperations: +class LogicalNetworksOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.azurestackhci.aio.AzureStackHCIClient`'s - :attr:`machine_extensions` attribute. + :attr:`logical_networks` attribute. """ models = _models @@ -66,14 +63,76 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async + async def get(self, resource_group_name: str, logical_network_name: str, **kwargs: Any) -> _models.LogicalNetworks: + """get. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param logical_network_name: Name of the logical network. Required. + :type logical_network_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LogicalNetworks or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.LogicalNetworks + :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.LogicalNetworks] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + logical_network_name=logical_network_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("LogicalNetworks", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}" + } + async def _create_or_update_initial( self, resource_group_name: str, - name: str, - extension_name: str, - extension_parameters: Union[_models.MachineExtension, IO], + logical_network_name: str, + logical_networks: Union[_models.LogicalNetworks, IO], **kwargs: Any - ) -> _models.MachineExtension: + ) -> _models.LogicalNetworks: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -85,24 +144,21 @@ 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["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MachineExtension] = kwargs.pop("cls", None) + cls: ClsType[_models.LogicalNetworks] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(extension_parameters, (IO, bytes)): - _content = extension_parameters + if isinstance(logical_networks, (IOBase, bytes)): + _content = logical_networks else: - _json = self._serialize.body(extension_parameters, "MachineExtension") + _json = self._serialize.body(logical_networks, "LogicalNetworks") request = build_create_or_update_request( resource_group_name=resource_group_name, - name=name, - extension_name=extension_name, + logical_network_name=logical_network_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -115,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 @@ -127,10 +184,10 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("MachineExtension", pipeline_response) + deserialized = self._deserialize("LogicalNetworks", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("MachineExtension", pipeline_response) + deserialized = self._deserialize("LogicalNetworks", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -138,33 +195,29 @@ async def _create_or_update_initial( return deserialized # type: ignore _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}" } @overload async def begin_create_or_update( self, resource_group_name: str, - name: str, - extension_name: str, - extension_parameters: _models.MachineExtension, + logical_network_name: str, + logical_networks: _models.LogicalNetworks, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.MachineExtension]: - """The operation to create or update the extension. + ) -> AsyncLROPoller[_models.LogicalNetworks]: + """The operation to create or update a logical network. Please note some properties can be set + only during logical network creation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param name: The name of the machine where the extension should be created or updated. - Required. - :type 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.azurestackhci.models.MachineExtension + :param logical_network_name: Name of the logical network. Required. + :type logical_network_name: str + :param logical_networks: Required. + :type logical_networks: ~azure.mgmt.azurestackhci.models.LogicalNetworks :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -176,9 +229,9 @@ async def begin_create_or_update( :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 + :return: An instance of AsyncLROPoller that returns either LogicalNetworks or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.MachineExtension] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.LogicalNetworks] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -186,26 +239,22 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - name: str, - extension_name: str, - extension_parameters: IO, + logical_network_name: str, + logical_networks: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.MachineExtension]: - """The operation to create or update the extension. + ) -> AsyncLROPoller[_models.LogicalNetworks]: + """The operation to create or update a logical network. Please note some properties can be set + only during logical network creation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param name: The name of the machine where the extension should be created or updated. - Required. - :type 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 + :param logical_network_name: Name of the logical network. Required. + :type logical_network_name: str + :param logical_networks: Required. + :type logical_networks: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -217,9 +266,9 @@ async def begin_create_or_update( :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 + :return: An instance of AsyncLROPoller that returns either LogicalNetworks or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.MachineExtension] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.LogicalNetworks] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -227,24 +276,20 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - name: str, - extension_name: str, - extension_parameters: Union[_models.MachineExtension, IO], + logical_network_name: str, + logical_networks: Union[_models.LogicalNetworks, IO], **kwargs: Any - ) -> AsyncLROPoller[_models.MachineExtension]: - """The operation to create or update the extension. + ) -> AsyncLROPoller[_models.LogicalNetworks]: + """The operation to create or update a logical network. Please note some properties can be set + only during logical network creation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param name: The name of the machine where the extension should be created or updated. - Required. - :type 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 model type or a IO type. Required. - :type extension_parameters: ~azure.mgmt.azurestackhci.models.MachineExtension or IO + :param logical_network_name: Name of the logical network. Required. + :type logical_network_name: str + :param logical_networks: Is either a LogicalNetworks type or a IO type. Required. + :type logical_networks: ~azure.mgmt.azurestackhci.models.LogicalNetworks or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -256,28 +301,25 @@ async def begin_create_or_update( :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 + :return: An instance of AsyncLROPoller that returns either LogicalNetworks or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.MachineExtension] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.LogicalNetworks] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MachineExtension] = kwargs.pop("cls", None) + cls: ClsType[_models.LogicalNetworks] = 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, - name=name, - extension_name=extension_name, - extension_parameters=extension_parameters, + logical_network_name=logical_network_name, + logical_networks=logical_networks, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -288,7 +330,7 @@ async def begin_create_or_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MachineExtension", pipeline_response) + deserialized = self._deserialize("LogicalNetworks", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized @@ -312,17 +354,137 @@ def get_long_running_output(pipeline_response): 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.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, logical_network_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, + logical_network_name=logical_network_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) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, logical_network_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to delete a logical network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param logical_network_name: Name of the logical network. Required. + :type logical_network_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, + logical_network_name=logical_network_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, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}" } async def _update_initial( self, resource_group_name: str, - name: str, - extension_name: str, - extension_parameters: Union[_models.MachineExtensionUpdate, IO], + logical_network_name: str, + logical_networks: Union[_models.LogicalNetworksUpdateRequest, IO], **kwargs: Any - ) -> _models.MachineExtension: + ) -> Optional[_models.LogicalNetworks]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -334,24 +496,21 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MachineExtension] = kwargs.pop("cls", None) + cls: ClsType[Optional[_models.LogicalNetworks]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(extension_parameters, (IO, bytes)): - _content = extension_parameters + if isinstance(logical_networks, (IOBase, bytes)): + _content = logical_networks else: - _json = self._serialize.body(extension_parameters, "MachineExtensionUpdate") + _json = self._serialize.body(logical_networks, "LogicalNetworksUpdateRequest") request = build_update_request( resource_group_name=resource_group_name, - name=name, - extension_name=extension_name, + logical_network_name=logical_network_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -364,56 +523,54 @@ 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 - if response.status_code not in [200, 201]: + 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) + deserialized = self._deserialize("LogicalNetworks", pipeline_response) - if response.status_code == 201: - deserialized = self._deserialize("MachineExtension", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) - return deserialized # type: ignore + return deserialized _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}" } @overload async def begin_update( self, resource_group_name: str, - name: str, - extension_name: str, - extension_parameters: _models.MachineExtensionUpdate, + logical_network_name: str, + logical_networks: _models.LogicalNetworksUpdateRequest, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.MachineExtension]: - """The operation to update the extension. + ) -> AsyncLROPoller[_models.LogicalNetworks]: + """The operation to update a logical network. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param name: The name of the machine where the extension should be created or updated. - Required. - :type 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.azurestackhci.models.MachineExtensionUpdate + :param logical_network_name: Name of the logical network. Required. + :type logical_network_name: str + :param logical_networks: Required. + :type logical_networks: ~azure.mgmt.azurestackhci.models.LogicalNetworksUpdateRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -425,9 +582,9 @@ async def begin_update( :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 + :return: An instance of AsyncLROPoller that returns either LogicalNetworks or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.MachineExtension] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.LogicalNetworks] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -435,26 +592,21 @@ async def begin_update( async def begin_update( self, resource_group_name: str, - name: str, - extension_name: str, - extension_parameters: IO, + logical_network_name: str, + logical_networks: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.MachineExtension]: - """The operation to update the extension. + ) -> AsyncLROPoller[_models.LogicalNetworks]: + """The operation to update a logical network. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param name: The name of the machine where the extension should be created or updated. - Required. - :type 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 + :param logical_network_name: Name of the logical network. Required. + :type logical_network_name: str + :param logical_networks: Required. + :type logical_networks: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -466,9 +618,9 @@ async def begin_update( :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 + :return: An instance of AsyncLROPoller that returns either LogicalNetworks or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.MachineExtension] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.LogicalNetworks] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -476,24 +628,19 @@ async def begin_update( async def begin_update( self, resource_group_name: str, - name: str, - extension_name: str, - extension_parameters: Union[_models.MachineExtensionUpdate, IO], + logical_network_name: str, + logical_networks: Union[_models.LogicalNetworksUpdateRequest, IO], **kwargs: Any - ) -> AsyncLROPoller[_models.MachineExtension]: - """The operation to update the extension. + ) -> AsyncLROPoller[_models.LogicalNetworks]: + """The operation to update a logical network. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param name: The name of the machine where the extension should be created or updated. - Required. - :type 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 model type or a IO type. Required. - :type extension_parameters: ~azure.mgmt.azurestackhci.models.MachineExtensionUpdate or IO + :param logical_network_name: Name of the logical network. Required. + :type logical_network_name: str + :param logical_networks: Is either a LogicalNetworksUpdateRequest type or a IO type. Required. + :type logical_networks: ~azure.mgmt.azurestackhci.models.LogicalNetworksUpdateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -505,28 +652,25 @@ async def begin_update( :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 + :return: An instance of AsyncLROPoller that returns either LogicalNetworks or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.MachineExtension] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.LogicalNetworks] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MachineExtension] = kwargs.pop("cls", None) + cls: ClsType[_models.LogicalNetworks] = 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, - name=name, - extension_name=extension_name, - extension_parameters=extension_parameters, + logical_network_name=logical_network_name, + logical_networks=logical_networks, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -537,13 +681,16 @@ async def begin_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MachineExtension", pipeline_response) + deserialized = self._deserialize("LogicalNetworks", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + 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: @@ -558,148 +705,29 @@ def get_long_running_output(pipeline_response): return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, 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: Literal["2021-09-01-preview"] = 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, - name=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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}" } - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, name: str, extension_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to delete the extension. + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.LogicalNetworks"]: + """Lists all of the logical networks in the specified resource group. Use the nextLink property in + the response to get the next page of logical networks. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param name: The name of the machine where the extension should be deleted. Required. - :type 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] + :return: An iterator like instance of either LogicalNetworks or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.LogicalNetworks] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = 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, - name=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, {}) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LogicalNetworksListResult] = kwargs.pop("cls", 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.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}" - } - - @distributed_trace_async - async def get( - self, resource_group_name: str, 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param name: The name of the machine containing the extension. Required. - :type 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.azurestackhci.models.MachineExtension - :raises ~azure.core.exceptions.HttpResponseError: - """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -708,75 +736,83 @@ async def get( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def prepare_request(next_link=None): + if not next_link: - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.MachineExtension] = kwargs.pop("cls", None) + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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) - request = build_get_request( - resource_group_name=resource_group_name, - name=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) + 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 - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) + async def extract_data(pipeline_response): + deserialized = self._deserialize("LogicalNetworksListResult", 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) - response = pipeline_response.http_response + async def get_next(next_link=None): + request = prepare_request(next_link) - 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) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - deserialized = self._deserialize("MachineExtension", pipeline_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) - if cls: - return cls(pipeline_response, deserialized, {}) + return pipeline_response - return deserialized + return AsyncItemPaged(get_next, extract_data) - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}" + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks" } @distributed_trace - def list_by_virtual_machines( - self, resource_group_name: str, name: str, expand: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.MachineExtension"]: - """The operation to get all extensions of a non-Azure machine. + def list_all(self, **kwargs: Any) -> AsyncIterable["_models.LogicalNetworks"]: + """Lists all of the logical networks in the specified subscription. Use the nextLink property in + the response to get the next page of logical networks. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param name: The name of the machine containing the extension. Required. - :type 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) + :return: An iterator like instance of either LogicalNetworks or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.MachineExtension] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.LogicalNetworks] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.MachineExtensionsListResult] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LogicalNetworksListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -789,13 +825,10 @@ def list_by_virtual_machines( def prepare_request(next_link=None): if not next_link: - request = build_list_by_virtual_machines_request( - resource_group_name=resource_group_name, - name=name, + request = build_list_all_request( subscription_id=self._config.subscription_id, - expand=expand, api_version=api_version, - template_url=self.list_by_virtual_machines.metadata["url"], + template_url=self.list_all.metadata["url"], headers=_headers, params=_params, ) @@ -821,7 +854,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize("MachineExtensionsListResult", pipeline_response) + deserialized = self._deserialize("LogicalNetworksListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -830,8 +863,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 @@ -844,6 +878,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_virtual_machines.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{name}/extensions" - } + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/logicalNetworks"} diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_marketplacegalleryimages_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_marketplace_gallery_images_operations.py similarity index 57% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_marketplacegalleryimages_operations.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_marketplace_gallery_images_operations.py index e59769c23c655..c0510fb5eb283 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_marketplacegalleryimages_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_marketplace_gallery_images_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -31,31 +31,27 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._marketplacegalleryimages_operations import ( +from ...operations._marketplace_gallery_images_operations import ( build_create_or_update_request, build_delete_request, build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, + build_list_all_request, + build_list_request, 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]] -class MarketplacegalleryimagesOperations: +class MarketplaceGalleryImagesOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.azurestackhci.aio.AzureStackHCIClient`'s - :attr:`marketplacegalleryimages` attribute. + :attr:`marketplace_gallery_images` attribute. """ models = _models @@ -69,18 +65,18 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace_async async def get( - self, resource_group_name: str, marketplacegalleryimages_name: str, **kwargs: Any - ) -> _models.Marketplacegalleryimages: - """Gets marketplacegalleryimages by resource name. + self, resource_group_name: str, marketplace_gallery_image_name: str, **kwargs: Any + ) -> _models.MarketplaceGalleryImages: + """Gets a marketplace gallery image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param marketplacegalleryimages_name: Name of the marketplace gallery image. Required. - :type marketplacegalleryimages_name: str + :param marketplace_gallery_image_name: Name of the marketplace gallery image. Required. + :type marketplace_gallery_image_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Marketplacegalleryimages or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Marketplacegalleryimages + :return: MarketplaceGalleryImages or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.MarketplaceGalleryImages :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -94,14 +90,12 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Marketplacegalleryimages] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MarketplaceGalleryImages] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, - marketplacegalleryimages_name=marketplacegalleryimages_name, + marketplace_gallery_image_name=marketplace_gallery_image_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata["url"], @@ -111,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 @@ -122,7 +117,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Marketplacegalleryimages", pipeline_response) + deserialized = self._deserialize("MarketplaceGalleryImages", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -130,16 +125,16 @@ async def get( return deserialized get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplacegalleryimages/{marketplacegalleryimagesName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}" } async def _create_or_update_initial( self, resource_group_name: str, - marketplacegalleryimages_name: str, - marketplacegalleryimages: Union[_models.Marketplacegalleryimages, IO], + marketplace_gallery_image_name: str, + marketplace_gallery_images: Union[_models.MarketplaceGalleryImages, IO], **kwargs: Any - ) -> _models.Marketplacegalleryimages: + ) -> _models.MarketplaceGalleryImages: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -151,23 +146,21 @@ 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["2021-09-01-preview"] = kwargs.pop( - "api_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.Marketplacegalleryimages] = kwargs.pop("cls", None) + cls: ClsType[_models.MarketplaceGalleryImages] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(marketplacegalleryimages, (IO, bytes)): - _content = marketplacegalleryimages + if isinstance(marketplace_gallery_images, (IOBase, bytes)): + _content = marketplace_gallery_images else: - _json = self._serialize.body(marketplacegalleryimages, "Marketplacegalleryimages") + _json = self._serialize.body(marketplace_gallery_images, "MarketplaceGalleryImages") request = build_create_or_update_request( resource_group_name=resource_group_name, - marketplacegalleryimages_name=marketplacegalleryimages_name, + marketplace_gallery_image_name=marketplace_gallery_image_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -180,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 @@ -192,10 +186,10 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("Marketplacegalleryimages", pipeline_response) + deserialized = self._deserialize("MarketplaceGalleryImages", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("Marketplacegalleryimages", pipeline_response) + deserialized = self._deserialize("MarketplaceGalleryImages", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -203,28 +197,29 @@ async def _create_or_update_initial( return deserialized # type: ignore _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplacegalleryimages/{marketplacegalleryimagesName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}" } @overload async def begin_create_or_update( self, resource_group_name: str, - marketplacegalleryimages_name: str, - marketplacegalleryimages: _models.Marketplacegalleryimages, + marketplace_gallery_image_name: str, + marketplace_gallery_images: _models.MarketplaceGalleryImages, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Marketplacegalleryimages]: - """Creates or updates a marketplace gallery image. + ) -> AsyncLROPoller[_models.MarketplaceGalleryImages]: + """The operation to create or update a marketplace gallery image. Please note some properties can + be set only during marketplace gallery image creation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param marketplacegalleryimages_name: Name of the marketplace gallery image. Required. - :type marketplacegalleryimages_name: str - :param marketplacegalleryimages: Required. - :type marketplacegalleryimages: ~azure.mgmt.azurestackhci.models.Marketplacegalleryimages + :param marketplace_gallery_image_name: Name of the marketplace gallery image. Required. + :type marketplace_gallery_image_name: str + :param marketplace_gallery_images: Required. + :type marketplace_gallery_images: ~azure.mgmt.azurestackhci.models.MarketplaceGalleryImages :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -236,10 +231,10 @@ async def begin_create_or_update( :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 Marketplacegalleryimages or the + :return: An instance of AsyncLROPoller that returns either MarketplaceGalleryImages or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Marketplacegalleryimages] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.MarketplaceGalleryImages] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -247,21 +242,22 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - marketplacegalleryimages_name: str, - marketplacegalleryimages: IO, + marketplace_gallery_image_name: str, + marketplace_gallery_images: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Marketplacegalleryimages]: - """Creates or updates a marketplace gallery image. + ) -> AsyncLROPoller[_models.MarketplaceGalleryImages]: + """The operation to create or update a marketplace gallery image. Please note some properties can + be set only during marketplace gallery image creation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param marketplacegalleryimages_name: Name of the marketplace gallery image. Required. - :type marketplacegalleryimages_name: str - :param marketplacegalleryimages: Required. - :type marketplacegalleryimages: IO + :param marketplace_gallery_image_name: Name of the marketplace gallery image. Required. + :type marketplace_gallery_image_name: str + :param marketplace_gallery_images: Required. + :type marketplace_gallery_images: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -273,10 +269,10 @@ async def begin_create_or_update( :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 Marketplacegalleryimages or the + :return: An instance of AsyncLROPoller that returns either MarketplaceGalleryImages or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Marketplacegalleryimages] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.MarketplaceGalleryImages] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -284,19 +280,22 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - marketplacegalleryimages_name: str, - marketplacegalleryimages: Union[_models.Marketplacegalleryimages, IO], + marketplace_gallery_image_name: str, + marketplace_gallery_images: Union[_models.MarketplaceGalleryImages, IO], **kwargs: Any - ) -> AsyncLROPoller[_models.Marketplacegalleryimages]: - """Creates or updates a marketplace gallery image. + ) -> AsyncLROPoller[_models.MarketplaceGalleryImages]: + """The operation to create or update a marketplace gallery image. Please note some properties can + be set only during marketplace gallery image creation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param marketplacegalleryimages_name: Name of the marketplace gallery image. Required. - :type marketplacegalleryimages_name: str - :param marketplacegalleryimages: Is either a model type or a IO type. Required. - :type marketplacegalleryimages: ~azure.mgmt.azurestackhci.models.Marketplacegalleryimages or IO + :param marketplace_gallery_image_name: Name of the marketplace gallery image. Required. + :type marketplace_gallery_image_name: str + :param marketplace_gallery_images: Is either a MarketplaceGalleryImages type or a IO type. + Required. + :type marketplace_gallery_images: ~azure.mgmt.azurestackhci.models.MarketplaceGalleryImages or + IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -308,28 +307,26 @@ async def begin_create_or_update( :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 Marketplacegalleryimages or the + :return: An instance of AsyncLROPoller that returns either MarketplaceGalleryImages or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Marketplacegalleryimages] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.MarketplaceGalleryImages] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_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.Marketplacegalleryimages] = kwargs.pop("cls", None) + cls: ClsType[_models.MarketplaceGalleryImages] = 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, - marketplacegalleryimages_name=marketplacegalleryimages_name, - marketplacegalleryimages=marketplacegalleryimages, + marketplace_gallery_image_name=marketplace_gallery_image_name, + marketplace_gallery_images=marketplace_gallery_images, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -340,7 +337,7 @@ async def begin_create_or_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Marketplacegalleryimages", pipeline_response) + deserialized = self._deserialize("MarketplaceGalleryImages", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized @@ -364,25 +361,12 @@ def get_long_running_output(pipeline_response): 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.AzureStackHCI/marketplacegalleryimages/{marketplacegalleryimagesName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}" } - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, marketplacegalleryimages_name: str, **kwargs: Any + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, marketplace_gallery_image_name: str, **kwargs: Any ) -> None: - """Deletes a marketplace gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param marketplacegalleryimages_name: Name of the marketplace gallery image. Required. - :type marketplacegalleryimages_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, @@ -394,123 +378,120 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, - marketplacegalleryimages_name=marketplacegalleryimages_name, + marketplace_gallery_image_name=marketplace_gallery_image_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], + 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + 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) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplacegalleryimages/{marketplacegalleryimagesName}" + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}" } - @overload - async def update( - self, - resource_group_name: str, - marketplacegalleryimages_name: str, - marketplacegalleryimages: _models.MarketplacegalleryimagesPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Marketplacegalleryimages: - """Updates a marketplace gallery image. + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, marketplace_gallery_image_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to delete a marketplace gallery image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param marketplacegalleryimages_name: Name of the marketplace gallery image. Required. - :type marketplacegalleryimages_name: str - :param marketplacegalleryimages: Required. - :type marketplacegalleryimages: ~azure.mgmt.azurestackhci.models.MarketplacegalleryimagesPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str + :param marketplace_gallery_image_name: Name of the marketplace gallery image. Required. + :type marketplace_gallery_image_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Marketplacegalleryimages or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Marketplacegalleryimages + :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 {}) - @overload - async def update( - self, - resource_group_name: str, - marketplacegalleryimages_name: str, - marketplacegalleryimages: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Marketplacegalleryimages: - """Updates a marketplace gallery image. + 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, + marketplace_gallery_image_name=marketplace_gallery_image_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param marketplacegalleryimages_name: Name of the marketplace gallery image. Required. - :type marketplacegalleryimages_name: str - :param marketplacegalleryimages: Required. - :type marketplacegalleryimages: 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: Marketplacegalleryimages or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Marketplacegalleryimages - :raises ~azure.core.exceptions.HttpResponseError: - """ + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) - @distributed_trace_async - async def update( + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}" + } + + async def _update_initial( self, resource_group_name: str, - marketplacegalleryimages_name: str, - marketplacegalleryimages: Union[_models.MarketplacegalleryimagesPatch, IO], + marketplace_gallery_image_name: str, + marketplace_gallery_images: Union[_models.MarketplaceGalleryImagesUpdateRequest, IO], **kwargs: Any - ) -> _models.Marketplacegalleryimages: - """Updates a marketplace gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param marketplacegalleryimages_name: Name of the marketplace gallery image. Required. - :type marketplacegalleryimages_name: str - :param marketplacegalleryimages: Is either a model type or a IO type. Required. - :type marketplacegalleryimages: ~azure.mgmt.azurestackhci.models.MarketplacegalleryimagesPatch - 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: Marketplacegalleryimages or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Marketplacegalleryimages - :raises ~azure.core.exceptions.HttpResponseError: - """ + ) -> Optional[_models.MarketplaceGalleryImages]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -522,84 +503,244 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_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.Marketplacegalleryimages] = kwargs.pop("cls", None) + cls: ClsType[Optional[_models.MarketplaceGalleryImages]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(marketplacegalleryimages, (IO, bytes)): - _content = marketplacegalleryimages + if isinstance(marketplace_gallery_images, (IOBase, bytes)): + _content = marketplace_gallery_images else: - _json = self._serialize.body(marketplacegalleryimages, "MarketplacegalleryimagesPatch") + _json = self._serialize.body(marketplace_gallery_images, "MarketplaceGalleryImagesUpdateRequest") request = build_update_request( resource_group_name=resource_group_name, - marketplacegalleryimages_name=marketplacegalleryimages_name, + marketplace_gallery_image_name=marketplace_gallery_image_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], + 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + 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("Marketplacegalleryimages", pipeline_response) + deserialized = self._deserialize("MarketplaceGalleryImages", pipeline_response) - if response.status_code == 201: - deserialized = self._deserialize("Marketplacegalleryimages", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) - return deserialized # type: ignore + return deserialized - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplacegalleryimages/{marketplacegalleryimagesName}" + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + marketplace_gallery_image_name: str, + marketplace_gallery_images: _models.MarketplaceGalleryImagesUpdateRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MarketplaceGalleryImages]: + """The operation to update a marketplace gallery image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param marketplace_gallery_image_name: Name of the marketplace gallery image. Required. + :type marketplace_gallery_image_name: str + :param marketplace_gallery_images: Required. + :type marketplace_gallery_images: + ~azure.mgmt.azurestackhci.models.MarketplaceGalleryImagesUpdateRequest + :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 MarketplaceGalleryImages or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.MarketplaceGalleryImages] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + marketplace_gallery_image_name: str, + marketplace_gallery_images: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MarketplaceGalleryImages]: + """The operation to update a marketplace gallery image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param marketplace_gallery_image_name: Name of the marketplace gallery image. Required. + :type marketplace_gallery_image_name: str + :param marketplace_gallery_images: Required. + :type marketplace_gallery_images: 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 MarketplaceGalleryImages or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.MarketplaceGalleryImages] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + marketplace_gallery_image_name: str, + marketplace_gallery_images: Union[_models.MarketplaceGalleryImagesUpdateRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.MarketplaceGalleryImages]: + """The operation to update a marketplace gallery image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param marketplace_gallery_image_name: Name of the marketplace gallery image. Required. + :type marketplace_gallery_image_name: str + :param marketplace_gallery_images: Is either a MarketplaceGalleryImagesUpdateRequest type or a + IO type. Required. + :type marketplace_gallery_images: + ~azure.mgmt.azurestackhci.models.MarketplaceGalleryImagesUpdateRequest 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 MarketplaceGalleryImages or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.MarketplaceGalleryImages] + :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.MarketplaceGalleryImages] = 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, + marketplace_gallery_image_name=marketplace_gallery_image_name, + marketplace_gallery_images=marketplace_gallery_images, + 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("MarketplaceGalleryImages", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}" } @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Marketplacegalleryimages"]: - """Lists all marketplacegalleryimages under the resource group. + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.MarketplaceGalleryImages"]: + """Lists all of the marketplace gallery images in the specified resource group. Use the nextLink + property in the response to get the next page of marketplace gallery images. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Marketplacegalleryimages or the result of + :return: An iterator like instance of either MarketplaceGalleryImages or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Marketplacegalleryimages] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.MarketplaceGalleryImages] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.MarketplacegalleryimagesListResult] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MarketplaceGalleryImagesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -612,11 +753,11 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + request = build_list_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -642,7 +783,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize("MarketplacegalleryimagesListResult", pipeline_response) + deserialized = self._deserialize("MarketplaceGalleryImagesListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -651,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 @@ -665,28 +807,27 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplacegalleryimages" + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages" } @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Marketplacegalleryimages"]: - """Lists all marketplacegalleryimages under the subscription. + def list_all(self, **kwargs: Any) -> AsyncIterable["_models.MarketplaceGalleryImages"]: + """Lists all of the marketplace gallery images in the specified subscription. Use the nextLink + property in the response to get the next page of marketplace gallery images. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Marketplacegalleryimages or the result of + :return: An iterator like instance of either MarketplaceGalleryImages or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Marketplacegalleryimages] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.MarketplaceGalleryImages] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.MarketplacegalleryimagesListResult] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MarketplaceGalleryImagesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -699,10 +840,10 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Marketpl def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + request = build_list_all_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], + template_url=self.list_all.metadata["url"], headers=_headers, params=_params, ) @@ -728,7 +869,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize("MarketplacegalleryimagesListResult", pipeline_response) + deserialized = self._deserialize("MarketplaceGalleryImagesListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -737,8 +878,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 @@ -751,6 +893,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/marketplacegalleryimages" + list_all.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages" } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtualmachines_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_network_interfaces_operations.py similarity index 58% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtualmachines_operations.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_network_interfaces_operations.py index 86da05462c967..d8f27a07e5357 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtualmachines_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_network_interfaces_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -31,34 +31,27 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._virtualmachines_operations import ( +from ...operations._network_interfaces_operations import ( build_create_or_update_request, build_delete_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_restart_request, - build_retrieve_request, - build_start_request, - build_stop_request, + build_get_request, + build_list_all_request, + build_list_request, 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]] -class VirtualmachinesOperations: +class NetworkInterfacesOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.azurestackhci.aio.AzureStackHCIClient`'s - :attr:`virtualmachines` attribute. + :attr:`network_interfaces` attribute. """ models = _models @@ -71,19 +64,19 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def retrieve( - self, resource_group_name: str, virtualmachines_name: str, **kwargs: Any - ) -> _models.Virtualmachines: - """Gets virtual machines by resource name. + async def get( + self, resource_group_name: str, network_interface_name: str, **kwargs: Any + ) -> _models.NetworkInterfaces: + """Gets a network interface. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str + :param network_interface_name: Name of the network interface. Required. + :type network_interface_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Virtualmachines or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualmachines + :return: NetworkInterfaces or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.NetworkInterfaces :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -97,25 +90,24 @@ async def retrieve( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Virtualmachines] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkInterfaces] = kwargs.pop("cls", None) - request = build_retrieve_request( + request = build_get_request( resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, + network_interface_name=network_interface_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.retrieve.metadata["url"], + 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -125,24 +117,24 @@ async def retrieve( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Virtualmachines", pipeline_response) + deserialized = self._deserialize("NetworkInterfaces", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - retrieve.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}" + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}" } async def _create_or_update_initial( self, resource_group_name: str, - virtualmachines_name: str, - virtualmachines: Union[_models.Virtualmachines, IO], + network_interface_name: str, + network_interfaces: Union[_models.NetworkInterfaces, IO], **kwargs: Any - ) -> _models.Virtualmachines: + ) -> _models.NetworkInterfaces: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -154,23 +146,21 @@ 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["2021-09-01-preview"] = kwargs.pop( - "api_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.Virtualmachines] = kwargs.pop("cls", None) + cls: ClsType[_models.NetworkInterfaces] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(virtualmachines, (IO, bytes)): - _content = virtualmachines + if isinstance(network_interfaces, (IOBase, bytes)): + _content = network_interfaces else: - _json = self._serialize.body(virtualmachines, "Virtualmachines") + _json = self._serialize.body(network_interfaces, "NetworkInterfaces") request = build_create_or_update_request( resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, + network_interface_name=network_interface_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -183,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 @@ -195,10 +186,10 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("Virtualmachines", pipeline_response) + deserialized = self._deserialize("NetworkInterfaces", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("Virtualmachines", pipeline_response) + deserialized = self._deserialize("NetworkInterfaces", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -206,28 +197,29 @@ async def _create_or_update_initial( return deserialized # type: ignore _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}" } @overload async def begin_create_or_update( self, resource_group_name: str, - virtualmachines_name: str, - virtualmachines: _models.Virtualmachines, + network_interface_name: str, + network_interfaces: _models.NetworkInterfaces, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Virtualmachines]: - """create_or_update. + ) -> AsyncLROPoller[_models.NetworkInterfaces]: + """The operation to create or update a network interface. Please note some properties can be set + only during network interface creation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str - :param virtualmachines: Required. - :type virtualmachines: ~azure.mgmt.azurestackhci.models.Virtualmachines + :param network_interface_name: Name of the network interface. Required. + :type network_interface_name: str + :param network_interfaces: Required. + :type network_interfaces: ~azure.mgmt.azurestackhci.models.NetworkInterfaces :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -239,9 +231,9 @@ async def begin_create_or_update( :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 Virtualmachines or the result of + :return: An instance of AsyncLROPoller that returns either NetworkInterfaces or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Virtualmachines] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.NetworkInterfaces] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -249,21 +241,22 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - virtualmachines_name: str, - virtualmachines: IO, + network_interface_name: str, + network_interfaces: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Virtualmachines]: - """create_or_update. + ) -> AsyncLROPoller[_models.NetworkInterfaces]: + """The operation to create or update a network interface. Please note some properties can be set + only during network interface creation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str - :param virtualmachines: Required. - :type virtualmachines: IO + :param network_interface_name: Name of the network interface. Required. + :type network_interface_name: str + :param network_interfaces: Required. + :type network_interfaces: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -275,9 +268,9 @@ async def begin_create_or_update( :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 Virtualmachines or the result of + :return: An instance of AsyncLROPoller that returns either NetworkInterfaces or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Virtualmachines] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.NetworkInterfaces] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -285,19 +278,20 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - virtualmachines_name: str, - virtualmachines: Union[_models.Virtualmachines, IO], + network_interface_name: str, + network_interfaces: Union[_models.NetworkInterfaces, IO], **kwargs: Any - ) -> AsyncLROPoller[_models.Virtualmachines]: - """create_or_update. + ) -> AsyncLROPoller[_models.NetworkInterfaces]: + """The operation to create or update a network interface. Please note some properties can be set + only during network interface creation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str - :param virtualmachines: Is either a model type or a IO type. Required. - :type virtualmachines: ~azure.mgmt.azurestackhci.models.Virtualmachines or IO + :param network_interface_name: Name of the network interface. Required. + :type network_interface_name: str + :param network_interfaces: Is either a NetworkInterfaces type or a IO type. Required. + :type network_interfaces: ~azure.mgmt.azurestackhci.models.NetworkInterfaces or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -309,27 +303,25 @@ async def begin_create_or_update( :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 Virtualmachines or the result of + :return: An instance of AsyncLROPoller that returns either NetworkInterfaces or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Virtualmachines] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.NetworkInterfaces] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_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.Virtualmachines] = kwargs.pop("cls", None) + cls: ClsType[_models.NetworkInterfaces] = 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, - virtualmachines_name=virtualmachines_name, - virtualmachines=virtualmachines, + network_interface_name=network_interface_name, + network_interfaces=network_interfaces, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -340,7 +332,7 @@ async def begin_create_or_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Virtualmachines", pipeline_response) + deserialized = self._deserialize("NetworkInterfaces", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized @@ -364,25 +356,12 @@ def get_long_running_output(pipeline_response): 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.AzureStackHCI/virtualmachines/{virtualmachinesName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}" } - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtualmachines_name: str, **kwargs: Any + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_interface_name: str, **kwargs: Any ) -> None: - """delete. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_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, @@ -394,248 +373,55 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, + network_interface_name=network_interface_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], + 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + 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.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}" - } - - @overload - async def update( - self, - resource_group_name: str, - virtualmachines_name: str, - virtualmachines: _models.VirtualmachinesPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Virtualmachines: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str - :param virtualmachines: Required. - :type virtualmachines: ~azure.mgmt.azurestackhci.models.VirtualmachinesPatch - :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: Virtualmachines or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualmachines - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - virtualmachines_name: str, - virtualmachines: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Virtualmachines: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str - :param virtualmachines: Required. - :type virtualmachines: 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: Virtualmachines or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualmachines - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - virtualmachines_name: str, - virtualmachines: Union[_models.VirtualmachinesPatch, IO], - **kwargs: Any - ) -> _models.Virtualmachines: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str - :param virtualmachines: Is either a model type or a IO type. Required. - :type virtualmachines: ~azure.mgmt.azurestackhci.models.VirtualmachinesPatch 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: Virtualmachines or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualmachines - :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: Literal["2021-09-01-preview"] = 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.Virtualmachines] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(virtualmachines, (IO, bytes)): - _content = virtualmachines - else: - _json = self._serialize.body(virtualmachines, "VirtualmachinesPatch") - - request = build_update_request( - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("Virtualmachines", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Virtualmachines", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}" - } - - async def _start_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtualmachines_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_start_request( - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._start_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _start_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/start" + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}" } @distributed_trace_async - async def begin_start( - self, resource_group_name: str, virtualmachines_name: str, **kwargs: Any + async def begin_delete( + self, resource_group_name: str, network_interface_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """start. + """The operation to delete a network interface. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str + :param network_interface_name: Name of the network interface. Required. + :type network_interface_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 @@ -651,17 +437,15 @@ async def begin_start( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_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) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._start_initial( # type: ignore + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, + network_interface_name=network_interface_name, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -692,13 +476,17 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_start.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/start" + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}" } - async def _stop_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtualmachines_name: str, **kwargs: Any - ) -> None: + async def _update_initial( + self, + resource_group_name: str, + network_interface_name: str, + network_interfaces: Union[_models.NetworkInterfacesUpdateRequest, IO], + **kwargs: Any + ) -> Optional[_models.NetworkInterfaces]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -707,28 +495,39 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) + 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.NetworkInterfaces]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(network_interfaces, (IOBase, bytes)): + _content = network_interfaces + else: + _json = self._serialize.body(network_interfaces, "NetworkInterfacesUpdateRequest") - request = build_stop_request( + request = build_update_request( resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, + network_interface_name=network_interface_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata["url"], + 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -738,24 +537,45 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("NetworkInterfaces", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, response_headers) - _stop_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/stop" + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}" } - @distributed_trace_async - async def begin_stop( - self, resource_group_name: str, virtualmachines_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """stop. + @overload + async def begin_update( + self, + resource_group_name: str, + network_interface_name: str, + network_interfaces: _models.NetworkInterfacesUpdateRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkInterfaces]: + """The operation to update a network interface. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str + :param network_interface_name: Name of the network interface. Required. + :type network_interface_name: str + :param network_interfaces: Required. + :type network_interfaces: ~azure.mgmt.azurestackhci.models.NetworkInterfacesUpdateRequest + :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 @@ -764,118 +584,69 @@ async def begin_stop( :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] + :return: An instance of AsyncLROPoller that returns either NetworkInterfaces or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.NetworkInterfaces] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = 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._stop_initial( # type: ignore - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_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, 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_stop.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/stop" - } - - async def _restart_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtualmachines_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_restart_request( - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._restart_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - - if cls: - return cls(pipeline_response, None, {}) + @overload + async def begin_update( + self, + resource_group_name: str, + network_interface_name: str, + network_interfaces: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkInterfaces]: + """The operation to update a network interface. - _restart_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/restart" - } + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_interface_name: Name of the network interface. Required. + :type network_interface_name: str + :param network_interfaces: Required. + :type network_interfaces: 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 NetworkInterfaces or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.NetworkInterfaces] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def begin_restart( - self, resource_group_name: str, virtualmachines_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """restart. + async def begin_update( + self, + resource_group_name: str, + network_interface_name: str, + network_interfaces: Union[_models.NetworkInterfacesUpdateRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkInterfaces]: + """The operation to update a network interface. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str + :param network_interface_name: Name of the network interface. Required. + :type network_interface_name: str + :param network_interfaces: Is either a NetworkInterfacesUpdateRequest type or a IO type. + Required. + :type network_interfaces: ~azure.mgmt.azurestackhci.models.NetworkInterfacesUpdateRequest 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 @@ -884,25 +655,27 @@ async def begin_restart( :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] + :return: An instance of AsyncLROPoller that returns either NetworkInterfaces or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.NetworkInterfaces] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) + 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.NetworkInterfaces] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restart_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, + network_interface_name=network_interface_name, + network_interfaces=network_interfaces, api_version=api_version, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -910,9 +683,11 @@ async def begin_restart( ) kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkInterfaces", pipeline_response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) + return deserialized if polling is True: polling_method: AsyncPollingMethod = cast( @@ -932,32 +707,29 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_restart.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/restart" + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}" } @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Virtualmachines"]: - """list_by_resource_group. + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.NetworkInterfaces"]: + """Lists all of the network interfaces in the specified resource group. Use the nextLink property + in the response to get the next page of network interfaces. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Virtualmachines or the result of cls(response) + :return: An iterator like instance of either NetworkInterfaces or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Virtualmachines] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.NetworkInterfaces] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualmachinesListResult] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkInterfacesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -970,11 +742,11 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + request = build_list_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -1000,7 +772,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualmachinesListResult", pipeline_response) + deserialized = self._deserialize("NetworkInterfacesListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -1009,8 +781,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 @@ -1023,27 +796,26 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines" + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces" } @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Virtualmachines"]: - """list_by_subscription. + def list_all(self, **kwargs: Any) -> AsyncIterable["_models.NetworkInterfaces"]: + """Lists all of the network interfaces in the specified subscription. Use the nextLink property in + the response to get the next page of network interfaces. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Virtualmachines or the result of cls(response) + :return: An iterator like instance of either NetworkInterfaces or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Virtualmachines] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.NetworkInterfaces] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualmachinesListResult] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkInterfacesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1056,10 +828,10 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Virtualm def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + request = build_list_all_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], + template_url=self.list_all.metadata["url"], headers=_headers, params=_params, ) @@ -1085,7 +857,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualmachinesListResult", pipeline_response) + deserialized = self._deserialize("NetworkInterfacesListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -1094,8 +866,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 @@ -1108,6 +881,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualmachines" - } + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/networkInterfaces"} diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_networkinterfaces_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_networkinterfaces_operations.py deleted file mode 100644 index 810b9cda4869b..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_networkinterfaces_operations.py +++ /dev/null @@ -1,750 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- -import sys -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._networkinterfaces_operations import ( - build_create_or_update_request, - build_delete_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_retrieve_request, - 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]] - - -class NetworkinterfacesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.azurestackhci.aio.AzureStackHCIClient`'s - :attr:`networkinterfaces` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def retrieve( - self, resource_group_name: str, networkinterfaces_name: str, **kwargs: Any - ) -> _models.Networkinterfaces: - """Gets network interfaces by resource name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param networkinterfaces_name: Required. - :type networkinterfaces_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Networkinterfaces or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Networkinterfaces - :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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Networkinterfaces] = kwargs.pop("cls", None) - - request = build_retrieve_request( - resource_group_name=resource_group_name, - networkinterfaces_name=networkinterfaces_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.retrieve.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("Networkinterfaces", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - retrieve.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces/{networkinterfacesName}" - } - - async def _create_or_update_initial( - self, - resource_group_name: str, - networkinterfaces_name: str, - networkinterfaces: Union[_models.Networkinterfaces, IO], - **kwargs: Any - ) -> _models.Networkinterfaces: - 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: Literal["2021-09-01-preview"] = 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.Networkinterfaces] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(networkinterfaces, (IO, bytes)): - _content = networkinterfaces - else: - _json = self._serialize.body(networkinterfaces, "Networkinterfaces") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - networkinterfaces_name=networkinterfaces_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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("Networkinterfaces", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Networkinterfaces", 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.AzureStackHCI/networkinterfaces/{networkinterfacesName}" - } - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - networkinterfaces_name: str, - networkinterfaces: _models.Networkinterfaces, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Networkinterfaces]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param networkinterfaces_name: Required. - :type networkinterfaces_name: str - :param networkinterfaces: Required. - :type networkinterfaces: ~azure.mgmt.azurestackhci.models.Networkinterfaces - :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 Networkinterfaces or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Networkinterfaces] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - networkinterfaces_name: str, - networkinterfaces: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Networkinterfaces]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param networkinterfaces_name: Required. - :type networkinterfaces_name: str - :param networkinterfaces: Required. - :type networkinterfaces: 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 Networkinterfaces or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Networkinterfaces] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - networkinterfaces_name: str, - networkinterfaces: Union[_models.Networkinterfaces, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.Networkinterfaces]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param networkinterfaces_name: Required. - :type networkinterfaces_name: str - :param networkinterfaces: Is either a model type or a IO type. Required. - :type networkinterfaces: ~azure.mgmt.azurestackhci.models.Networkinterfaces 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 Networkinterfaces or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Networkinterfaces] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = 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.Networkinterfaces] = 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, - networkinterfaces_name=networkinterfaces_name, - networkinterfaces=networkinterfaces, - 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("Networkinterfaces", 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.AzureStackHCI/networkinterfaces/{networkinterfacesName}" - } - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, networkinterfaces_name: str, **kwargs: Any - ) -> None: - """delete. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param networkinterfaces_name: Required. - :type networkinterfaces_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: Literal["2021-09-01-preview"] = 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, - networkinterfaces_name=networkinterfaces_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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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.AzureStackHCI/networkinterfaces/{networkinterfacesName}" - } - - @overload - async def update( - self, - resource_group_name: str, - networkinterfaces_name: str, - networkinterfaces: _models.NetworkinterfacesPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Networkinterfaces: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param networkinterfaces_name: Required. - :type networkinterfaces_name: str - :param networkinterfaces: Required. - :type networkinterfaces: ~azure.mgmt.azurestackhci.models.NetworkinterfacesPatch - :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: Networkinterfaces or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Networkinterfaces - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - networkinterfaces_name: str, - networkinterfaces: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Networkinterfaces: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param networkinterfaces_name: Required. - :type networkinterfaces_name: str - :param networkinterfaces: Required. - :type networkinterfaces: 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: Networkinterfaces or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Networkinterfaces - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - networkinterfaces_name: str, - networkinterfaces: Union[_models.NetworkinterfacesPatch, IO], - **kwargs: Any - ) -> _models.Networkinterfaces: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param networkinterfaces_name: Required. - :type networkinterfaces_name: str - :param networkinterfaces: Is either a model type or a IO type. Required. - :type networkinterfaces: ~azure.mgmt.azurestackhci.models.NetworkinterfacesPatch 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: Networkinterfaces or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Networkinterfaces - :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: Literal["2021-09-01-preview"] = 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.Networkinterfaces] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(networkinterfaces, (IO, bytes)): - _content = networkinterfaces - else: - _json = self._serialize.body(networkinterfaces, "NetworkinterfacesPatch") - - request = build_update_request( - resource_group_name=resource_group_name, - networkinterfaces_name=networkinterfaces_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("Networkinterfaces", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Networkinterfaces", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces/{networkinterfacesName}" - } - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Networkinterfaces"]: - """list_by_resource_group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Networkinterfaces or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Networkinterfaces] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.NetworkinterfacesListResult] = 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_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.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("NetworkinterfacesListResult", 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces" - } - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Networkinterfaces"]: - """list_by_subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Networkinterfaces or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Networkinterfaces] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.NetworkinterfacesListResult] = 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_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.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("NetworkinterfacesListResult", 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/networkinterfaces" - } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_operations.py index 3c8ce63b1b71e..82cc3738edc85 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_operations.py @@ -6,9 +6,10 @@ # 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, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse +from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -20,7 +21,7 @@ from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -28,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]] @@ -55,15 +52,21 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async - async def list(self, **kwargs: Any) -> _models.OperationListResult: - """List all available Microsoft.AzureStackHCI provider operations. + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: + """List all the supported operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationListResult or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.OperationListResult + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Operation] :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.OperationListResult] = kwargs.pop("cls", None) + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -72,39 +75,59 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - - request = build_list_request( - 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("OperationListResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + 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("OperationListResult", 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": "/providers/Microsoft.AzureStackHCI/operations"} diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_storagecontainers_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_storage_containers_operations.py similarity index 57% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_storagecontainers_operations.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_storage_containers_operations.py index e4b00ee36bb2d..9d6ec21a749f8 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_storagecontainers_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_storage_containers_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -31,31 +31,27 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._storagecontainers_operations import ( +from ...operations._storage_containers_operations import ( build_create_or_update_request, build_delete_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_retrieve_request, + build_get_request, + build_list_all_request, + build_list_request, 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]] -class StoragecontainersOperations: +class StorageContainersOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.azurestackhci.aio.AzureStackHCIClient`'s - :attr:`storagecontainers` attribute. + :attr:`storage_containers` attribute. """ models = _models @@ -68,19 +64,19 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def retrieve( - self, resource_group_name: str, storagecontainers_name: str, **kwargs: Any - ) -> _models.Storagecontainers: - """Gets storagecontainers by resource name. + async def get( + self, resource_group_name: str, storage_container_name: str, **kwargs: Any + ) -> _models.StorageContainers: + """Gets a storage container. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param storagecontainers_name: Required. - :type storagecontainers_name: str + :param storage_container_name: Name of the storage container. Required. + :type storage_container_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Storagecontainers or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Storagecontainers + :return: StorageContainers or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.StorageContainers :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -94,25 +90,24 @@ async def retrieve( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Storagecontainers] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.StorageContainers] = kwargs.pop("cls", None) - request = build_retrieve_request( + request = build_get_request( resource_group_name=resource_group_name, - storagecontainers_name=storagecontainers_name, + storage_container_name=storage_container_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.retrieve.metadata["url"], + 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -122,24 +117,24 @@ async def retrieve( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Storagecontainers", pipeline_response) + deserialized = self._deserialize("StorageContainers", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - retrieve.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storagecontainers/{storagecontainersName}" + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}" } async def _create_or_update_initial( self, resource_group_name: str, - storagecontainers_name: str, - storagecontainers: Union[_models.Storagecontainers, IO], + storage_container_name: str, + storage_containers: Union[_models.StorageContainers, IO], **kwargs: Any - ) -> _models.Storagecontainers: + ) -> _models.StorageContainers: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -151,23 +146,21 @@ 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["2021-09-01-preview"] = kwargs.pop( - "api_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.Storagecontainers] = kwargs.pop("cls", None) + cls: ClsType[_models.StorageContainers] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(storagecontainers, (IO, bytes)): - _content = storagecontainers + if isinstance(storage_containers, (IOBase, bytes)): + _content = storage_containers else: - _json = self._serialize.body(storagecontainers, "Storagecontainers") + _json = self._serialize.body(storage_containers, "StorageContainers") request = build_create_or_update_request( resource_group_name=resource_group_name, - storagecontainers_name=storagecontainers_name, + storage_container_name=storage_container_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -180,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 @@ -192,10 +186,10 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("Storagecontainers", pipeline_response) + deserialized = self._deserialize("StorageContainers", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("Storagecontainers", pipeline_response) + deserialized = self._deserialize("StorageContainers", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -203,28 +197,29 @@ async def _create_or_update_initial( return deserialized # type: ignore _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storagecontainers/{storagecontainersName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}" } @overload async def begin_create_or_update( self, resource_group_name: str, - storagecontainers_name: str, - storagecontainers: _models.Storagecontainers, + storage_container_name: str, + storage_containers: _models.StorageContainers, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Storagecontainers]: - """create_or_update. + ) -> AsyncLROPoller[_models.StorageContainers]: + """The operation to create or update a storage container. Please note some properties can be set + only during storage container creation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param storagecontainers_name: Required. - :type storagecontainers_name: str - :param storagecontainers: Required. - :type storagecontainers: ~azure.mgmt.azurestackhci.models.Storagecontainers + :param storage_container_name: Name of the storage container. Required. + :type storage_container_name: str + :param storage_containers: Required. + :type storage_containers: ~azure.mgmt.azurestackhci.models.StorageContainers :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -236,9 +231,9 @@ async def begin_create_or_update( :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 Storagecontainers or the result of + :return: An instance of AsyncLROPoller that returns either StorageContainers or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Storagecontainers] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.StorageContainers] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -246,21 +241,22 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - storagecontainers_name: str, - storagecontainers: IO, + storage_container_name: str, + storage_containers: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Storagecontainers]: - """create_or_update. + ) -> AsyncLROPoller[_models.StorageContainers]: + """The operation to create or update a storage container. Please note some properties can be set + only during storage container creation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param storagecontainers_name: Required. - :type storagecontainers_name: str - :param storagecontainers: Required. - :type storagecontainers: IO + :param storage_container_name: Name of the storage container. Required. + :type storage_container_name: str + :param storage_containers: Required. + :type storage_containers: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -272,9 +268,9 @@ async def begin_create_or_update( :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 Storagecontainers or the result of + :return: An instance of AsyncLROPoller that returns either StorageContainers or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Storagecontainers] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.StorageContainers] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -282,19 +278,20 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - storagecontainers_name: str, - storagecontainers: Union[_models.Storagecontainers, IO], + storage_container_name: str, + storage_containers: Union[_models.StorageContainers, IO], **kwargs: Any - ) -> AsyncLROPoller[_models.Storagecontainers]: - """create_or_update. + ) -> AsyncLROPoller[_models.StorageContainers]: + """The operation to create or update a storage container. Please note some properties can be set + only during storage container creation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param storagecontainers_name: Required. - :type storagecontainers_name: str - :param storagecontainers: Is either a model type or a IO type. Required. - :type storagecontainers: ~azure.mgmt.azurestackhci.models.Storagecontainers or IO + :param storage_container_name: Name of the storage container. Required. + :type storage_container_name: str + :param storage_containers: Is either a StorageContainers type or a IO type. Required. + :type storage_containers: ~azure.mgmt.azurestackhci.models.StorageContainers or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -306,27 +303,25 @@ async def begin_create_or_update( :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 Storagecontainers or the result of + :return: An instance of AsyncLROPoller that returns either StorageContainers or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Storagecontainers] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.StorageContainers] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_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.Storagecontainers] = kwargs.pop("cls", None) + cls: ClsType[_models.StorageContainers] = 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, - storagecontainers_name=storagecontainers_name, - storagecontainers=storagecontainers, + storage_container_name=storage_container_name, + storage_containers=storage_containers, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -337,7 +332,7 @@ async def begin_create_or_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Storagecontainers", pipeline_response) + deserialized = self._deserialize("StorageContainers", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized @@ -361,25 +356,12 @@ def get_long_running_output(pipeline_response): 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.AzureStackHCI/storagecontainers/{storagecontainersName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}" } - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, storagecontainers_name: str, **kwargs: Any + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, storage_container_name: str, **kwargs: Any ) -> None: - """delete. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storagecontainers_name: Required. - :type storagecontainers_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, @@ -391,122 +373,120 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, - storagecontainers_name=storagecontainers_name, + storage_container_name=storage_container_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], + 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + 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) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storagecontainers/{storagecontainersName}" + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}" } - @overload - async def update( - self, - resource_group_name: str, - storagecontainers_name: str, - storagecontainers: _models.StoragecontainersPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Storagecontainers: - """update. + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, storage_container_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to delete a storage container. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param storagecontainers_name: Required. - :type storagecontainers_name: str - :param storagecontainers: Required. - :type storagecontainers: ~azure.mgmt.azurestackhci.models.StoragecontainersPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str + :param storage_container_name: Name of the storage container. Required. + :type storage_container_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Storagecontainers or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Storagecontainers + :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 {}) - @overload - async def update( - self, - resource_group_name: str, - storagecontainers_name: str, - storagecontainers: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Storagecontainers: - """update. + 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, + storage_container_name=storage_container_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storagecontainers_name: Required. - :type storagecontainers_name: str - :param storagecontainers: Required. - :type storagecontainers: 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: Storagecontainers or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Storagecontainers - :raises ~azure.core.exceptions.HttpResponseError: - """ + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) - @distributed_trace_async - async def update( + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}" + } + + async def _update_initial( self, resource_group_name: str, - storagecontainers_name: str, - storagecontainers: Union[_models.StoragecontainersPatch, IO], + storage_container_name: str, + storage_containers: Union[_models.StorageContainersUpdateRequest, IO], **kwargs: Any - ) -> _models.Storagecontainers: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storagecontainers_name: Required. - :type storagecontainers_name: str - :param storagecontainers: Is either a model type or a IO type. Required. - :type storagecontainers: ~azure.mgmt.azurestackhci.models.StoragecontainersPatch 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: Storagecontainers or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Storagecontainers - :raises ~azure.core.exceptions.HttpResponseError: - """ + ) -> Optional[_models.StorageContainers]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -518,83 +498,238 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_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.Storagecontainers] = kwargs.pop("cls", None) + cls: ClsType[Optional[_models.StorageContainers]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(storagecontainers, (IO, bytes)): - _content = storagecontainers + if isinstance(storage_containers, (IOBase, bytes)): + _content = storage_containers else: - _json = self._serialize.body(storagecontainers, "StoragecontainersPatch") + _json = self._serialize.body(storage_containers, "StorageContainersUpdateRequest") request = build_update_request( resource_group_name=resource_group_name, - storagecontainers_name=storagecontainers_name, + storage_container_name=storage_container_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], + 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + 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("Storagecontainers", pipeline_response) + deserialized = self._deserialize("StorageContainers", pipeline_response) - if response.status_code == 201: - deserialized = self._deserialize("Storagecontainers", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) - return deserialized # type: ignore + return deserialized - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storagecontainers/{storagecontainersName}" + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + storage_container_name: str, + storage_containers: _models.StorageContainersUpdateRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageContainers]: + """The operation to update a storage container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_container_name: Name of the storage container. Required. + :type storage_container_name: str + :param storage_containers: Required. + :type storage_containers: ~azure.mgmt.azurestackhci.models.StorageContainersUpdateRequest + :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 StorageContainers or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.StorageContainers] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + storage_container_name: str, + storage_containers: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageContainers]: + """The operation to update a storage container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_container_name: Name of the storage container. Required. + :type storage_container_name: str + :param storage_containers: Required. + :type storage_containers: 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 StorageContainers or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.StorageContainers] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + storage_container_name: str, + storage_containers: Union[_models.StorageContainersUpdateRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageContainers]: + """The operation to update a storage container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_container_name: Name of the storage container. Required. + :type storage_container_name: str + :param storage_containers: Is either a StorageContainersUpdateRequest type or a IO type. + Required. + :type storage_containers: ~azure.mgmt.azurestackhci.models.StorageContainersUpdateRequest 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 StorageContainers or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.StorageContainers] + :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.StorageContainers] = 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, + storage_container_name=storage_container_name, + storage_containers=storage_containers, + 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("StorageContainers", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}" } @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Storagecontainers"]: - """list_by_resource_group. + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.StorageContainers"]: + """Lists all of the storage containers in the specified resource group. Use the nextLink property + in the response to get the next page of storage containers. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Storagecontainers or the result of cls(response) + :return: An iterator like instance of either StorageContainers or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Storagecontainers] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.StorageContainers] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.StoragecontainersListResult] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.StorageContainersListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -607,11 +742,11 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + request = build_list_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -637,7 +772,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize("StoragecontainersListResult", pipeline_response) + deserialized = self._deserialize("StorageContainersListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -646,8 +781,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 @@ -660,27 +796,26 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storagecontainers" + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers" } @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Storagecontainers"]: - """list_by_subscription. + def list_all(self, **kwargs: Any) -> AsyncIterable["_models.StorageContainers"]: + """Lists all of the storage containers in the specified subscription. Use the nextLink property in + the response to get the next page of storage containers. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Storagecontainers or the result of cls(response) + :return: An iterator like instance of either StorageContainers or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Storagecontainers] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.StorageContainers] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.StoragecontainersListResult] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.StorageContainersListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -693,10 +828,10 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Storagec def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + request = build_list_all_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], + template_url=self.list_all.metadata["url"], headers=_headers, params=_params, ) @@ -722,7 +857,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize("StoragecontainersListResult", pipeline_response) + deserialized = self._deserialize("StorageContainersListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -731,8 +866,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 @@ -745,6 +881,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/storagecontainers" - } + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/storageContainers"} diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtualharddisks_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtual_hard_disks_operations.py similarity index 57% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtualharddisks_operations.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtual_hard_disks_operations.py index 2d24c2b99fc5e..a44593278d092 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtualharddisks_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtual_hard_disks_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -31,31 +31,27 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._virtualharddisks_operations import ( +from ...operations._virtual_hard_disks_operations import ( build_create_or_update_request, build_delete_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_retrieve_request, + build_get_request, + build_list_all_request, + build_list_request, 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]] -class VirtualharddisksOperations: +class VirtualHardDisksOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.azurestackhci.aio.AzureStackHCIClient`'s - :attr:`virtualharddisks` attribute. + :attr:`virtual_hard_disks` attribute. """ models = _models @@ -68,19 +64,19 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def retrieve( - self, resource_group_name: str, virtualharddisks_name: str, **kwargs: Any - ) -> _models.Virtualharddisks: - """Gets virtualharddisks by resource name. + async def get( + self, resource_group_name: str, virtual_hard_disk_name: str, **kwargs: Any + ) -> _models.VirtualHardDisks: + """Gets a virtual hard disk. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtualharddisks_name: Required. - :type virtualharddisks_name: str + :param virtual_hard_disk_name: Name of the virtual hard disk. Required. + :type virtual_hard_disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Virtualharddisks or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualharddisks + :return: VirtualHardDisks or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.VirtualHardDisks :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -94,25 +90,24 @@ async def retrieve( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Virtualharddisks] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualHardDisks] = kwargs.pop("cls", None) - request = build_retrieve_request( + request = build_get_request( resource_group_name=resource_group_name, - virtualharddisks_name=virtualharddisks_name, + virtual_hard_disk_name=virtual_hard_disk_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.retrieve.metadata["url"], + 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -122,24 +117,24 @@ async def retrieve( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Virtualharddisks", pipeline_response) + deserialized = self._deserialize("VirtualHardDisks", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - retrieve.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}" + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}" } async def _create_or_update_initial( self, resource_group_name: str, - virtualharddisks_name: str, - virtualharddisks: Union[_models.Virtualharddisks, IO], + virtual_hard_disk_name: str, + virtual_hard_disks: Union[_models.VirtualHardDisks, IO], **kwargs: Any - ) -> _models.Virtualharddisks: + ) -> _models.VirtualHardDisks: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -151,23 +146,21 @@ 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["2021-09-01-preview"] = kwargs.pop( - "api_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.Virtualharddisks] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualHardDisks] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(virtualharddisks, (IO, bytes)): - _content = virtualharddisks + if isinstance(virtual_hard_disks, (IOBase, bytes)): + _content = virtual_hard_disks else: - _json = self._serialize.body(virtualharddisks, "Virtualharddisks") + _json = self._serialize.body(virtual_hard_disks, "VirtualHardDisks") request = build_create_or_update_request( resource_group_name=resource_group_name, - virtualharddisks_name=virtualharddisks_name, + virtual_hard_disk_name=virtual_hard_disk_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -180,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 @@ -192,10 +186,10 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("Virtualharddisks", pipeline_response) + deserialized = self._deserialize("VirtualHardDisks", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("Virtualharddisks", pipeline_response) + deserialized = self._deserialize("VirtualHardDisks", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -203,28 +197,29 @@ async def _create_or_update_initial( return deserialized # type: ignore _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}" } @overload async def begin_create_or_update( self, resource_group_name: str, - virtualharddisks_name: str, - virtualharddisks: _models.Virtualharddisks, + virtual_hard_disk_name: str, + virtual_hard_disks: _models.VirtualHardDisks, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Virtualharddisks]: - """create_or_update. + ) -> AsyncLROPoller[_models.VirtualHardDisks]: + """The operation to create or update a virtual hard disk. Please note some properties can be set + only during virtual hard disk creation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtualharddisks_name: Required. - :type virtualharddisks_name: str - :param virtualharddisks: Required. - :type virtualharddisks: ~azure.mgmt.azurestackhci.models.Virtualharddisks + :param virtual_hard_disk_name: Name of the virtual hard disk. Required. + :type virtual_hard_disk_name: str + :param virtual_hard_disks: Required. + :type virtual_hard_disks: ~azure.mgmt.azurestackhci.models.VirtualHardDisks :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -236,9 +231,9 @@ async def begin_create_or_update( :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 Virtualharddisks or the result of + :return: An instance of AsyncLROPoller that returns either VirtualHardDisks or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Virtualharddisks] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.VirtualHardDisks] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -246,21 +241,22 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - virtualharddisks_name: str, - virtualharddisks: IO, + virtual_hard_disk_name: str, + virtual_hard_disks: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Virtualharddisks]: - """create_or_update. + ) -> AsyncLROPoller[_models.VirtualHardDisks]: + """The operation to create or update a virtual hard disk. Please note some properties can be set + only during virtual hard disk creation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtualharddisks_name: Required. - :type virtualharddisks_name: str - :param virtualharddisks: Required. - :type virtualharddisks: IO + :param virtual_hard_disk_name: Name of the virtual hard disk. Required. + :type virtual_hard_disk_name: str + :param virtual_hard_disks: Required. + :type virtual_hard_disks: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -272,9 +268,9 @@ async def begin_create_or_update( :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 Virtualharddisks or the result of + :return: An instance of AsyncLROPoller that returns either VirtualHardDisks or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Virtualharddisks] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.VirtualHardDisks] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -282,19 +278,20 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - virtualharddisks_name: str, - virtualharddisks: Union[_models.Virtualharddisks, IO], + virtual_hard_disk_name: str, + virtual_hard_disks: Union[_models.VirtualHardDisks, IO], **kwargs: Any - ) -> AsyncLROPoller[_models.Virtualharddisks]: - """create_or_update. + ) -> AsyncLROPoller[_models.VirtualHardDisks]: + """The operation to create or update a virtual hard disk. Please note some properties can be set + only during virtual hard disk creation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtualharddisks_name: Required. - :type virtualharddisks_name: str - :param virtualharddisks: Is either a model type or a IO type. Required. - :type virtualharddisks: ~azure.mgmt.azurestackhci.models.Virtualharddisks or IO + :param virtual_hard_disk_name: Name of the virtual hard disk. Required. + :type virtual_hard_disk_name: str + :param virtual_hard_disks: Is either a VirtualHardDisks type or a IO type. Required. + :type virtual_hard_disks: ~azure.mgmt.azurestackhci.models.VirtualHardDisks or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -306,27 +303,25 @@ async def begin_create_or_update( :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 Virtualharddisks or the result of + :return: An instance of AsyncLROPoller that returns either VirtualHardDisks or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Virtualharddisks] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.VirtualHardDisks] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_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.Virtualharddisks] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualHardDisks] = 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, - virtualharddisks_name=virtualharddisks_name, - virtualharddisks=virtualharddisks, + virtual_hard_disk_name=virtual_hard_disk_name, + virtual_hard_disks=virtual_hard_disks, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -337,7 +332,7 @@ async def begin_create_or_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Virtualharddisks", pipeline_response) + deserialized = self._deserialize("VirtualHardDisks", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized @@ -361,25 +356,12 @@ def get_long_running_output(pipeline_response): 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.AzureStackHCI/virtualharddisks/{virtualharddisksName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}" } - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtualharddisks_name: str, **kwargs: Any + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_hard_disk_name: str, **kwargs: Any ) -> None: - """delete. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualharddisks_name: Required. - :type virtualharddisks_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, @@ -391,122 +373,120 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, - virtualharddisks_name=virtualharddisks_name, + virtual_hard_disk_name=virtual_hard_disk_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], + 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + 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) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}" + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}" } - @overload - async def update( - self, - resource_group_name: str, - virtualharddisks_name: str, - virtualharddisks: _models.VirtualharddisksPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Virtualharddisks: - """update. + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, virtual_hard_disk_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to delete a virtual hard disk. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtualharddisks_name: Required. - :type virtualharddisks_name: str - :param virtualharddisks: Required. - :type virtualharddisks: ~azure.mgmt.azurestackhci.models.VirtualharddisksPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str + :param virtual_hard_disk_name: Name of the virtual hard disk. Required. + :type virtual_hard_disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Virtualharddisks or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualharddisks + :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 {}) - @overload - async def update( - self, - resource_group_name: str, - virtualharddisks_name: str, - virtualharddisks: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Virtualharddisks: - """update. + 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_hard_disk_name=virtual_hard_disk_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualharddisks_name: Required. - :type virtualharddisks_name: str - :param virtualharddisks: Required. - :type virtualharddisks: 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: Virtualharddisks or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualharddisks - :raises ~azure.core.exceptions.HttpResponseError: - """ + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) - @distributed_trace_async - async def update( + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}" + } + + async def _update_initial( self, resource_group_name: str, - virtualharddisks_name: str, - virtualharddisks: Union[_models.VirtualharddisksPatch, IO], + virtual_hard_disk_name: str, + virtual_hard_disks: Union[_models.VirtualHardDisksUpdateRequest, IO], **kwargs: Any - ) -> _models.Virtualharddisks: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualharddisks_name: Required. - :type virtualharddisks_name: str - :param virtualharddisks: Is either a model type or a IO type. Required. - :type virtualharddisks: ~azure.mgmt.azurestackhci.models.VirtualharddisksPatch 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: Virtualharddisks or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualharddisks - :raises ~azure.core.exceptions.HttpResponseError: - """ + ) -> Optional[_models.VirtualHardDisks]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -518,83 +498,238 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_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.Virtualharddisks] = kwargs.pop("cls", None) + cls: ClsType[Optional[_models.VirtualHardDisks]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(virtualharddisks, (IO, bytes)): - _content = virtualharddisks + if isinstance(virtual_hard_disks, (IOBase, bytes)): + _content = virtual_hard_disks else: - _json = self._serialize.body(virtualharddisks, "VirtualharddisksPatch") + _json = self._serialize.body(virtual_hard_disks, "VirtualHardDisksUpdateRequest") request = build_update_request( resource_group_name=resource_group_name, - virtualharddisks_name=virtualharddisks_name, + virtual_hard_disk_name=virtual_hard_disk_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], + 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + 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("Virtualharddisks", pipeline_response) + deserialized = self._deserialize("VirtualHardDisks", pipeline_response) - if response.status_code == 201: - deserialized = self._deserialize("Virtualharddisks", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) - return deserialized # type: ignore + return deserialized - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}" + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + virtual_hard_disk_name: str, + virtual_hard_disks: _models.VirtualHardDisksUpdateRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualHardDisks]: + """The operation to update a virtual hard disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_hard_disk_name: Name of the virtual hard disk. Required. + :type virtual_hard_disk_name: str + :param virtual_hard_disks: Required. + :type virtual_hard_disks: ~azure.mgmt.azurestackhci.models.VirtualHardDisksUpdateRequest + :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 VirtualHardDisks or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.VirtualHardDisks] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + virtual_hard_disk_name: str, + virtual_hard_disks: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualHardDisks]: + """The operation to update a virtual hard disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_hard_disk_name: Name of the virtual hard disk. Required. + :type virtual_hard_disk_name: str + :param virtual_hard_disks: Required. + :type virtual_hard_disks: 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 VirtualHardDisks or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.VirtualHardDisks] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + virtual_hard_disk_name: str, + virtual_hard_disks: Union[_models.VirtualHardDisksUpdateRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualHardDisks]: + """The operation to update a virtual hard disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_hard_disk_name: Name of the virtual hard disk. Required. + :type virtual_hard_disk_name: str + :param virtual_hard_disks: Is either a VirtualHardDisksUpdateRequest type or a IO type. + Required. + :type virtual_hard_disks: ~azure.mgmt.azurestackhci.models.VirtualHardDisksUpdateRequest 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 VirtualHardDisks or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.VirtualHardDisks] + :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.VirtualHardDisks] = 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_hard_disk_name=virtual_hard_disk_name, + virtual_hard_disks=virtual_hard_disks, + 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("VirtualHardDisks", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}" } @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Virtualharddisks"]: - """list_by_resource_group. + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.VirtualHardDisks"]: + """Lists all of the virtual hard disks in the specified resource group. Use the nextLink property + in the response to get the next page of virtual hard disks. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Virtualharddisks or the result of cls(response) + :return: An iterator like instance of either VirtualHardDisks or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Virtualharddisks] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.VirtualHardDisks] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualharddisksListResult] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualHardDisksListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -607,11 +742,11 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + request = build_list_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -637,7 +772,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualharddisksListResult", pipeline_response) + deserialized = self._deserialize("VirtualHardDisksListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -646,8 +781,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 @@ -660,27 +796,26 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks" + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks" } @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Virtualharddisks"]: - """list_by_subscription. + def list_all(self, **kwargs: Any) -> AsyncIterable["_models.VirtualHardDisks"]: + """Lists all of the virtual hard disks in the specified subscription. Use the nextLink property in + the response to get the next page of virtual hard disks. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Virtualharddisks or the result of cls(response) + :return: An iterator like instance of either VirtualHardDisks or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Virtualharddisks] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.VirtualHardDisks] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualharddisksListResult] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualHardDisksListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -693,10 +828,10 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Virtualh def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + request = build_list_all_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], + template_url=self.list_all.metadata["url"], headers=_headers, params=_params, ) @@ -722,7 +857,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualharddisksListResult", pipeline_response) + deserialized = self._deserialize("VirtualHardDisksListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -731,8 +866,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 @@ -745,6 +881,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualharddisks" - } + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualHardDisks"} diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtual_machine_instances_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtual_machine_instances_operations.py new file mode 100644 index 0000000000000..6f06b12fee9bd --- /dev/null +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtual_machine_instances_operations.py @@ -0,0 +1,1111 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._virtual_machine_instances_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_restart_request, + build_start_request, + build_stop_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class VirtualMachineInstancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.azurestackhci.aio.AzureStackHCIClient`'s + :attr:`virtual_machine_instances` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, resource_uri: str, **kwargs: Any) -> _models.VirtualMachineInstance: + """Gets a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineInstance or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.VirtualMachineInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualMachineInstance] = kwargs.pop("cls", None) + + request = build_get_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {"url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"} + + async def _create_or_update_initial( + self, resource_uri: str, virtual_machine_instance: Union[_models.VirtualMachineInstance, IO], **kwargs: Any + ) -> _models.VirtualMachineInstance: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachineInstance] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(virtual_machine_instance, (IOBase, bytes)): + _content = virtual_machine_instance + else: + _json = self._serialize.body(virtual_machine_instance, "VirtualMachineInstance") + + request = build_create_or_update_request( + resource_uri=resource_uri, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default" + } + + @overload + async def begin_create_or_update( + self, + resource_uri: str, + virtual_machine_instance: _models.VirtualMachineInstance, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineInstance]: + """The operation to create or update a virtual machine instance. Please note some properties can + be set only during virtual machine instance creation. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param virtual_machine_instance: Required. + :type virtual_machine_instance: ~azure.mgmt.azurestackhci.models.VirtualMachineInstance + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualMachineInstance or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, resource_uri: str, virtual_machine_instance: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineInstance]: + """The operation to create or update a virtual machine instance. Please note some properties can + be set only during virtual machine instance creation. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param virtual_machine_instance: Required. + :type virtual_machine_instance: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualMachineInstance or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_uri: str, virtual_machine_instance: Union[_models.VirtualMachineInstance, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineInstance]: + """The operation to create or update a virtual machine instance. Please note some properties can + be set only during virtual machine instance creation. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param virtual_machine_instance: Is either a VirtualMachineInstance type or a IO type. + Required. + :type virtual_machine_instance: ~azure.mgmt.azurestackhci.models.VirtualMachineInstance or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualMachineInstance or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachineInstance] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_uri=resource_uri, + virtual_machine_instance=virtual_machine_instance, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_uri: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default" + } + + @distributed_trace_async + async def begin_delete(self, resource_uri: str, **kwargs: Any) -> AsyncLROPoller[None]: + """The operation to delete a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_uri=resource_uri, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = {"url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"} + + async def _update_initial( + self, + resource_uri: str, + virtual_machine_instance: Union[_models.VirtualMachineInstanceUpdateRequest, IO], + **kwargs: Any + ) -> Optional[_models.VirtualMachineInstance]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.VirtualMachineInstance]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(virtual_machine_instance, (IOBase, bytes)): + _content = virtual_machine_instance + else: + _json = self._serialize.body(virtual_machine_instance, "VirtualMachineInstanceUpdateRequest") + + request = build_update_request( + resource_uri=resource_uri, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default" + } + + @overload + async def begin_update( + self, + resource_uri: str, + virtual_machine_instance: _models.VirtualMachineInstanceUpdateRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineInstance]: + """The operation to update a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param virtual_machine_instance: Required. + :type virtual_machine_instance: + ~azure.mgmt.azurestackhci.models.VirtualMachineInstanceUpdateRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualMachineInstance or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, resource_uri: str, virtual_machine_instance: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineInstance]: + """The operation to update a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param virtual_machine_instance: Required. + :type virtual_machine_instance: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualMachineInstance or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_uri: str, + virtual_machine_instance: Union[_models.VirtualMachineInstanceUpdateRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineInstance]: + """The operation to update a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param virtual_machine_instance: Is either a VirtualMachineInstanceUpdateRequest type or a IO + type. Required. + :type virtual_machine_instance: + ~azure.mgmt.azurestackhci.models.VirtualMachineInstanceUpdateRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualMachineInstance or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachineInstance] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_uri=resource_uri, + virtual_machine_instance=virtual_machine_instance, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = {"url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"} + + async def _start_initial(self, resource_uri: str, **kwargs: Any) -> Optional[_models.VirtualMachineInstance]: + 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[Optional[_models.VirtualMachineInstance]] = kwargs.pop("cls", None) + + request = build_start_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self._start_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _start_initial.metadata = { + "url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/start" + } + + @distributed_trace_async + async def begin_start(self, resource_uri: str, **kwargs: Any) -> AsyncLROPoller[_models.VirtualMachineInstance]: + """The operation to start a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualMachineInstance or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualMachineInstance] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._start_initial( + resource_uri=resource_uri, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start.metadata = { + "url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/start" + } + + async def _stop_initial(self, resource_uri: str, **kwargs: Any) -> Optional[_models.VirtualMachineInstance]: + 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[Optional[_models.VirtualMachineInstance]] = kwargs.pop("cls", None) + + request = build_stop_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self._stop_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _stop_initial.metadata = { + "url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/stop" + } + + @distributed_trace_async + async def begin_stop(self, resource_uri: str, **kwargs: Any) -> AsyncLROPoller[_models.VirtualMachineInstance]: + """The operation to stop a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualMachineInstance or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualMachineInstance] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._stop_initial( + resource_uri=resource_uri, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop.metadata = { + "url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/stop" + } + + async def _restart_initial(self, resource_uri: str, **kwargs: Any) -> Optional[_models.VirtualMachineInstance]: + 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[Optional[_models.VirtualMachineInstance]] = kwargs.pop("cls", None) + + request = build_restart_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self._restart_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _restart_initial.metadata = { + "url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/restart" + } + + @distributed_trace_async + async def begin_restart(self, resource_uri: str, **kwargs: Any) -> AsyncLROPoller[_models.VirtualMachineInstance]: + """The operation to restart a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualMachineInstance or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualMachineInstance] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._restart_initial( + resource_uri=resource_uri, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_restart.metadata = { + "url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/restart" + } + + @distributed_trace + def list(self, resource_uri: str, **kwargs: Any) -> AsyncIterable["_models.VirtualMachineInstance"]: + """Lists all of the virtual machine instances within the specified parent resource. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineInstance or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualMachineInstanceListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualMachineInstanceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances"} diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtualnetworks_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtualnetworks_operations.py deleted file mode 100644 index 37465297af001..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtualnetworks_operations.py +++ /dev/null @@ -1,750 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- -import sys -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._virtualnetworks_operations import ( - build_create_or_update_request, - build_delete_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_retrieve_request, - 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]] - - -class VirtualnetworksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.azurestackhci.aio.AzureStackHCIClient`'s - :attr:`virtualnetworks` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def retrieve( - self, resource_group_name: str, virtualnetworks_name: str, **kwargs: Any - ) -> _models.Virtualnetworks: - """retrieve. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualnetworks_name: Required. - :type virtualnetworks_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Virtualnetworks or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualnetworks - :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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Virtualnetworks] = kwargs.pop("cls", None) - - request = build_retrieve_request( - resource_group_name=resource_group_name, - virtualnetworks_name=virtualnetworks_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.retrieve.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("Virtualnetworks", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - retrieve.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks/{virtualnetworksName}" - } - - async def _create_or_update_initial( - self, - resource_group_name: str, - virtualnetworks_name: str, - virtualnetworks: Union[_models.Virtualnetworks, IO], - **kwargs: Any - ) -> _models.Virtualnetworks: - 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: Literal["2021-09-01-preview"] = 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.Virtualnetworks] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(virtualnetworks, (IO, bytes)): - _content = virtualnetworks - else: - _json = self._serialize.body(virtualnetworks, "Virtualnetworks") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - virtualnetworks_name=virtualnetworks_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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("Virtualnetworks", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Virtualnetworks", 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.AzureStackHCI/virtualnetworks/{virtualnetworksName}" - } - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - virtualnetworks_name: str, - virtualnetworks: _models.Virtualnetworks, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Virtualnetworks]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualnetworks_name: Required. - :type virtualnetworks_name: str - :param virtualnetworks: Required. - :type virtualnetworks: ~azure.mgmt.azurestackhci.models.Virtualnetworks - :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 Virtualnetworks or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Virtualnetworks] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - virtualnetworks_name: str, - virtualnetworks: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Virtualnetworks]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualnetworks_name: Required. - :type virtualnetworks_name: str - :param virtualnetworks: Required. - :type virtualnetworks: 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 Virtualnetworks or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Virtualnetworks] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - virtualnetworks_name: str, - virtualnetworks: Union[_models.Virtualnetworks, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.Virtualnetworks]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualnetworks_name: Required. - :type virtualnetworks_name: str - :param virtualnetworks: Is either a model type or a IO type. Required. - :type virtualnetworks: ~azure.mgmt.azurestackhci.models.Virtualnetworks 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 Virtualnetworks or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Virtualnetworks] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = 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.Virtualnetworks] = 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, - virtualnetworks_name=virtualnetworks_name, - virtualnetworks=virtualnetworks, - 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("Virtualnetworks", 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.AzureStackHCI/virtualnetworks/{virtualnetworksName}" - } - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtualnetworks_name: str, **kwargs: Any - ) -> None: - """delete. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualnetworks_name: Required. - :type virtualnetworks_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: Literal["2021-09-01-preview"] = 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, - virtualnetworks_name=virtualnetworks_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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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.AzureStackHCI/virtualnetworks/{virtualnetworksName}" - } - - @overload - async def update( - self, - resource_group_name: str, - virtualnetworks_name: str, - virtualnetworks: _models.VirtualnetworksPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Virtualnetworks: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualnetworks_name: Required. - :type virtualnetworks_name: str - :param virtualnetworks: Required. - :type virtualnetworks: ~azure.mgmt.azurestackhci.models.VirtualnetworksPatch - :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: Virtualnetworks or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualnetworks - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - virtualnetworks_name: str, - virtualnetworks: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Virtualnetworks: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualnetworks_name: Required. - :type virtualnetworks_name: str - :param virtualnetworks: Required. - :type virtualnetworks: 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: Virtualnetworks or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualnetworks - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - virtualnetworks_name: str, - virtualnetworks: Union[_models.VirtualnetworksPatch, IO], - **kwargs: Any - ) -> _models.Virtualnetworks: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualnetworks_name: Required. - :type virtualnetworks_name: str - :param virtualnetworks: Is either a model type or a IO type. Required. - :type virtualnetworks: ~azure.mgmt.azurestackhci.models.VirtualnetworksPatch 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: Virtualnetworks or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualnetworks - :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: Literal["2021-09-01-preview"] = 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.Virtualnetworks] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(virtualnetworks, (IO, bytes)): - _content = virtualnetworks - else: - _json = self._serialize.body(virtualnetworks, "VirtualnetworksPatch") - - request = build_update_request( - resource_group_name=resource_group_name, - virtualnetworks_name=virtualnetworks_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("Virtualnetworks", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Virtualnetworks", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks/{virtualnetworksName}" - } - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Virtualnetworks"]: - """list_by_resource_group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Virtualnetworks or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Virtualnetworks] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualnetworksListResult] = 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_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.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("VirtualnetworksListResult", 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks" - } - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Virtualnetworks"]: - """list_by_subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Virtualnetworks or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Virtualnetworks] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualnetworksListResult] = 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_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.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("VirtualnetworksListResult", 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualnetworks" - } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/__init__.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/__init__.py index 45dee4371d71b..8d80f49afacca 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/__init__.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/__init__.py @@ -6,24 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._models_py3 import ArcSetting -from ._models_py3 import ArcSettingList -from ._models_py3 import Cluster -from ._models_py3 import ClusterDesiredProperties -from ._models_py3 import ClusterList -from ._models_py3 import ClusterNode -from ._models_py3 import ClusterPatch -from ._models_py3 import ClusterReportedProperties -from ._models_py3 import ComponentsL15GkaSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesRoutetable -from ._models_py3 import ( - ComponentsVqks9HSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesIpconfigurationreferencesItems, -) from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ErrorDetail from ._models_py3 import ErrorResponse from ._models_py3 import ExtendedLocation -from ._models_py3 import Extension -from ._models_py3 import ExtensionList from ._models_py3 import GalleryDiskImage from ._models_py3 import GalleryImageIdentifier from ._models_py3 import GalleryImageStatus @@ -31,148 +17,122 @@ from ._models_py3 import GalleryImageStatusProvisioningStatus from ._models_py3 import GalleryImageVersion from ._models_py3 import GalleryImageVersionStorageProfile +from ._models_py3 import GalleryImages +from ._models_py3 import GalleryImagesListResult +from ._models_py3 import GalleryImagesUpdateRequest from ._models_py3 import GalleryOSDiskImage -from ._models_py3 import Galleryimages -from ._models_py3 import GalleryimagesListResult -from ._models_py3 import GalleryimagesPatch from ._models_py3 import GuestAgent +from ._models_py3 import GuestAgentInstallStatus from ._models_py3 import GuestAgentList -from ._models_py3 import GuestAgentProfile from ._models_py3 import GuestCredential from ._models_py3 import HardwareProfileUpdate from ._models_py3 import HttpProxyConfiguration from ._models_py3 import HybridIdentityMetadata from ._models_py3 import HybridIdentityMetadataList +from ._models_py3 import IPConfiguration +from ._models_py3 import IPConfigurationProperties +from ._models_py3 import IPConfigurationPropertiesSubnet from ._models_py3 import IPPool from ._models_py3 import IPPoolInfo from ._models_py3 import Identity +from ._models_py3 import InstanceViewStatus from ._models_py3 import InterfaceDNSSettings -from ._models_py3 import IpConfiguration -from ._models_py3 import IpConfigurationProperties -from ._models_py3 import IpConfigurationPropertiesSubnet -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 LogicalNetworkPropertiesDhcpOptions +from ._models_py3 import LogicalNetworkStatus +from ._models_py3 import LogicalNetworkStatusProvisioningStatus +from ._models_py3 import LogicalNetworks +from ._models_py3 import LogicalNetworksListResult +from ._models_py3 import LogicalNetworksUpdateRequest from ._models_py3 import MarketplaceGalleryImageStatus from ._models_py3 import MarketplaceGalleryImageStatusDownloadStatus from ._models_py3 import MarketplaceGalleryImageStatusProvisioningStatus -from ._models_py3 import Marketplacegalleryimages -from ._models_py3 import MarketplacegalleryimagesListResult -from ._models_py3 import MarketplacegalleryimagesPatch +from ._models_py3 import MarketplaceGalleryImages +from ._models_py3 import MarketplaceGalleryImagesListResult +from ._models_py3 import MarketplaceGalleryImagesUpdateRequest from ._models_py3 import NetworkInterfaceStatus from ._models_py3 import NetworkInterfaceStatusProvisioningStatus +from ._models_py3 import NetworkInterfaces +from ._models_py3 import NetworkInterfacesListResult +from ._models_py3 import NetworkInterfacesUpdateRequest from ._models_py3 import NetworkProfileUpdate from ._models_py3 import NetworkProfileUpdateNetworkInterfacesItem -from ._models_py3 import Networkinterfaces -from ._models_py3 import NetworkinterfacesListResult -from ._models_py3 import NetworkinterfacesPatch from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import OperationListResult -from ._models_py3 import PerNodeExtensionState -from ._models_py3 import PerNodeState +from ._models_py3 import OsProfileUpdate +from ._models_py3 import OsProfileUpdateLinuxConfiguration +from ._models_py3 import OsProfileUpdateWindowsConfiguration from ._models_py3 import ProxyResource from ._models_py3 import Resource -from ._models_py3 import ResourcePatch +from ._models_py3 import Route +from ._models_py3 import RouteTable +from ._models_py3 import SshConfiguration +from ._models_py3 import SshPublicKey from ._models_py3 import StorageContainerStatus from ._models_py3 import StorageContainerStatusProvisioningStatus +from ._models_py3 import StorageContainers +from ._models_py3 import StorageContainersListResult +from ._models_py3 import StorageContainersUpdateRequest from ._models_py3 import StorageProfileUpdate from ._models_py3 import StorageProfileUpdateDataDisksItem -from ._models_py3 import Storagecontainers -from ._models_py3 import StoragecontainersExtendedLocation -from ._models_py3 import StoragecontainersListResult -from ._models_py3 import StoragecontainersPatch +from ._models_py3 import Subnet +from ._models_py3 import SubnetPropertiesFormatIpConfigurationReferencesItem from ._models_py3 import SystemData from ._models_py3 import TrackedResource from ._models_py3 import VirtualHardDiskStatus from ._models_py3 import VirtualHardDiskStatusProvisioningStatus -from ._models_py3 import VirtualMachineStatus -from ._models_py3 import VirtualMachineStatusProvisioningStatus -from ._models_py3 import VirtualMachineUpdateProperties -from ._models_py3 import VirtualNetworkStatus -from ._models_py3 import VirtualNetworkStatusProvisioningStatus -from ._models_py3 import Virtualharddisks -from ._models_py3 import VirtualharddisksListResult -from ._models_py3 import VirtualharddisksPatch -from ._models_py3 import Virtualmachines -from ._models_py3 import VirtualmachinesListResult -from ._models_py3 import VirtualmachinesPatch -from ._models_py3 import VirtualmachinesPropertiesHardwareProfile -from ._models_py3 import VirtualmachinesPropertiesHardwareProfileDynamicMemoryConfig -from ._models_py3 import VirtualmachinesPropertiesNetworkProfile -from ._models_py3 import VirtualmachinesPropertiesNetworkProfileNetworkInterfacesItem -from ._models_py3 import VirtualmachinesPropertiesOsProfile -from ._models_py3 import VirtualmachinesPropertiesOsProfileLinuxConfiguration -from ._models_py3 import VirtualmachinesPropertiesOsProfileLinuxConfigurationSsh -from ._models_py3 import VirtualmachinesPropertiesOsProfileLinuxConfigurationSshPublicKeysItem -from ._models_py3 import VirtualmachinesPropertiesOsProfileWindowsConfiguration -from ._models_py3 import VirtualmachinesPropertiesOsProfileWindowsConfigurationSsh -from ._models_py3 import VirtualmachinesPropertiesOsProfileWindowsConfigurationSshPublicKeysItem -from ._models_py3 import VirtualmachinesPropertiesSecurityProfile -from ._models_py3 import VirtualmachinesPropertiesSecurityProfileUefiSettings -from ._models_py3 import VirtualmachinesPropertiesStorageProfile -from ._models_py3 import VirtualmachinesPropertiesStorageProfileDataDisksItem -from ._models_py3 import VirtualmachinesPropertiesStorageProfileImageReference -from ._models_py3 import VirtualmachinesPropertiesStorageProfileOsDisk -from ._models_py3 import Virtualnetworks -from ._models_py3 import VirtualnetworksListResult -from ._models_py3 import VirtualnetworksPatch -from ._models_py3 import VirtualnetworksPropertiesSubnetsItem -from ._models_py3 import VirtualnetworksPropertiesSubnetsPropertiesItemsItem +from ._models_py3 import VirtualHardDisks +from ._models_py3 import VirtualHardDisksListResult +from ._models_py3 import VirtualHardDisksUpdateRequest +from ._models_py3 import VirtualMachineConfigAgentInstanceView +from ._models_py3 import VirtualMachineInstance +from ._models_py3 import VirtualMachineInstanceListResult +from ._models_py3 import VirtualMachineInstancePropertiesHardwareProfile +from ._models_py3 import VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig +from ._models_py3 import VirtualMachineInstancePropertiesNetworkProfile +from ._models_py3 import VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem +from ._models_py3 import VirtualMachineInstancePropertiesOsProfile +from ._models_py3 import VirtualMachineInstancePropertiesOsProfileLinuxConfiguration +from ._models_py3 import VirtualMachineInstancePropertiesOsProfileWindowsConfiguration +from ._models_py3 import VirtualMachineInstancePropertiesSecurityProfile +from ._models_py3 import VirtualMachineInstancePropertiesSecurityProfileUefiSettings +from ._models_py3 import VirtualMachineInstancePropertiesStorageProfile +from ._models_py3 import VirtualMachineInstancePropertiesStorageProfileDataDisksItem +from ._models_py3 import VirtualMachineInstancePropertiesStorageProfileImageReference +from ._models_py3 import VirtualMachineInstancePropertiesStorageProfileOsDisk +from ._models_py3 import VirtualMachineInstanceStatus +from ._models_py3 import VirtualMachineInstanceStatusProvisioningStatus +from ._models_py3 import VirtualMachineInstanceUpdateProperties +from ._models_py3 import VirtualMachineInstanceUpdateRequest +from ._models_py3 import VirtualMachineInstanceView from ._azure_stack_hci_client_enums import ActionType -from ._azure_stack_hci_client_enums import ArcSettingAggregateState from ._azure_stack_hci_client_enums import CloudInitDataSource from ._azure_stack_hci_client_enums import CreatedByType -from ._azure_stack_hci_client_enums import DiagnosticLevel from ._azure_stack_hci_client_enums import DiskFileFormat from ._azure_stack_hci_client_enums import ExtendedLocationTypes -from ._azure_stack_hci_client_enums import ExtensionAggregateState from ._azure_stack_hci_client_enums import HyperVGeneration from ._azure_stack_hci_client_enums import IPPoolTypeEnum -from ._azure_stack_hci_client_enums import ImdsAttestation from ._azure_stack_hci_client_enums import IpAllocationMethodEnum -from ._azure_stack_hci_client_enums import NetworkTypeEnum -from ._azure_stack_hci_client_enums import NodeArcState -from ._azure_stack_hci_client_enums import NodeExtensionState from ._azure_stack_hci_client_enums import OperatingSystemTypes from ._azure_stack_hci_client_enums import Origin -from ._azure_stack_hci_client_enums import OsTypeEnum from ._azure_stack_hci_client_enums import PowerStateEnum -from ._azure_stack_hci_client_enums import PrivateIPAllocationMethodEnum from ._azure_stack_hci_client_enums import ProvisioningAction -from ._azure_stack_hci_client_enums import ProvisioningState from ._azure_stack_hci_client_enums import ProvisioningStateEnum -from ._azure_stack_hci_client_enums import ProvisioningStatusEnum +from ._azure_stack_hci_client_enums import SecurityTypes from ._azure_stack_hci_client_enums import Status from ._azure_stack_hci_client_enums import StatusLevelTypes from ._azure_stack_hci_client_enums import StatusTypes from ._azure_stack_hci_client_enums import VmSizeEnum -from ._azure_stack_hci_client_enums import WindowsServerSubscription from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - "ArcSetting", - "ArcSettingList", - "Cluster", - "ClusterDesiredProperties", - "ClusterList", - "ClusterNode", - "ClusterPatch", - "ClusterReportedProperties", - "ComponentsL15GkaSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesRoutetable", - "ComponentsVqks9HSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesIpconfigurationreferencesItems", "ErrorAdditionalInfo", "ErrorDetail", "ErrorResponse", "ExtendedLocation", - "Extension", - "ExtensionList", "GalleryDiskImage", "GalleryImageIdentifier", "GalleryImageStatus", @@ -180,126 +140,112 @@ "GalleryImageStatusProvisioningStatus", "GalleryImageVersion", "GalleryImageVersionStorageProfile", + "GalleryImages", + "GalleryImagesListResult", + "GalleryImagesUpdateRequest", "GalleryOSDiskImage", - "Galleryimages", - "GalleryimagesListResult", - "GalleryimagesPatch", "GuestAgent", + "GuestAgentInstallStatus", "GuestAgentList", - "GuestAgentProfile", "GuestCredential", "HardwareProfileUpdate", "HttpProxyConfiguration", "HybridIdentityMetadata", "HybridIdentityMetadataList", + "IPConfiguration", + "IPConfigurationProperties", + "IPConfigurationPropertiesSubnet", "IPPool", "IPPoolInfo", "Identity", + "InstanceViewStatus", "InterfaceDNSSettings", - "IpConfiguration", - "IpConfigurationProperties", - "IpConfigurationPropertiesSubnet", - "MachineExtension", - "MachineExtensionInstanceView", - "MachineExtensionInstanceViewStatus", - "MachineExtensionPropertiesInstanceView", - "MachineExtensionUpdate", - "MachineExtensionsListResult", + "LogicalNetworkPropertiesDhcpOptions", + "LogicalNetworkStatus", + "LogicalNetworkStatusProvisioningStatus", + "LogicalNetworks", + "LogicalNetworksListResult", + "LogicalNetworksUpdateRequest", "MarketplaceGalleryImageStatus", "MarketplaceGalleryImageStatusDownloadStatus", "MarketplaceGalleryImageStatusProvisioningStatus", - "Marketplacegalleryimages", - "MarketplacegalleryimagesListResult", - "MarketplacegalleryimagesPatch", + "MarketplaceGalleryImages", + "MarketplaceGalleryImagesListResult", + "MarketplaceGalleryImagesUpdateRequest", "NetworkInterfaceStatus", "NetworkInterfaceStatusProvisioningStatus", + "NetworkInterfaces", + "NetworkInterfacesListResult", + "NetworkInterfacesUpdateRequest", "NetworkProfileUpdate", "NetworkProfileUpdateNetworkInterfacesItem", - "Networkinterfaces", - "NetworkinterfacesListResult", - "NetworkinterfacesPatch", "Operation", "OperationDisplay", "OperationListResult", - "PerNodeExtensionState", - "PerNodeState", + "OsProfileUpdate", + "OsProfileUpdateLinuxConfiguration", + "OsProfileUpdateWindowsConfiguration", "ProxyResource", "Resource", - "ResourcePatch", + "Route", + "RouteTable", + "SshConfiguration", + "SshPublicKey", "StorageContainerStatus", "StorageContainerStatusProvisioningStatus", + "StorageContainers", + "StorageContainersListResult", + "StorageContainersUpdateRequest", "StorageProfileUpdate", "StorageProfileUpdateDataDisksItem", - "Storagecontainers", - "StoragecontainersExtendedLocation", - "StoragecontainersListResult", - "StoragecontainersPatch", + "Subnet", + "SubnetPropertiesFormatIpConfigurationReferencesItem", "SystemData", "TrackedResource", "VirtualHardDiskStatus", "VirtualHardDiskStatusProvisioningStatus", - "VirtualMachineStatus", - "VirtualMachineStatusProvisioningStatus", - "VirtualMachineUpdateProperties", - "VirtualNetworkStatus", - "VirtualNetworkStatusProvisioningStatus", - "Virtualharddisks", - "VirtualharddisksListResult", - "VirtualharddisksPatch", - "Virtualmachines", - "VirtualmachinesListResult", - "VirtualmachinesPatch", - "VirtualmachinesPropertiesHardwareProfile", - "VirtualmachinesPropertiesHardwareProfileDynamicMemoryConfig", - "VirtualmachinesPropertiesNetworkProfile", - "VirtualmachinesPropertiesNetworkProfileNetworkInterfacesItem", - "VirtualmachinesPropertiesOsProfile", - "VirtualmachinesPropertiesOsProfileLinuxConfiguration", - "VirtualmachinesPropertiesOsProfileLinuxConfigurationSsh", - "VirtualmachinesPropertiesOsProfileLinuxConfigurationSshPublicKeysItem", - "VirtualmachinesPropertiesOsProfileWindowsConfiguration", - "VirtualmachinesPropertiesOsProfileWindowsConfigurationSsh", - "VirtualmachinesPropertiesOsProfileWindowsConfigurationSshPublicKeysItem", - "VirtualmachinesPropertiesSecurityProfile", - "VirtualmachinesPropertiesSecurityProfileUefiSettings", - "VirtualmachinesPropertiesStorageProfile", - "VirtualmachinesPropertiesStorageProfileDataDisksItem", - "VirtualmachinesPropertiesStorageProfileImageReference", - "VirtualmachinesPropertiesStorageProfileOsDisk", - "Virtualnetworks", - "VirtualnetworksListResult", - "VirtualnetworksPatch", - "VirtualnetworksPropertiesSubnetsItem", - "VirtualnetworksPropertiesSubnetsPropertiesItemsItem", + "VirtualHardDisks", + "VirtualHardDisksListResult", + "VirtualHardDisksUpdateRequest", + "VirtualMachineConfigAgentInstanceView", + "VirtualMachineInstance", + "VirtualMachineInstanceListResult", + "VirtualMachineInstancePropertiesHardwareProfile", + "VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig", + "VirtualMachineInstancePropertiesNetworkProfile", + "VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem", + "VirtualMachineInstancePropertiesOsProfile", + "VirtualMachineInstancePropertiesOsProfileLinuxConfiguration", + "VirtualMachineInstancePropertiesOsProfileWindowsConfiguration", + "VirtualMachineInstancePropertiesSecurityProfile", + "VirtualMachineInstancePropertiesSecurityProfileUefiSettings", + "VirtualMachineInstancePropertiesStorageProfile", + "VirtualMachineInstancePropertiesStorageProfileDataDisksItem", + "VirtualMachineInstancePropertiesStorageProfileImageReference", + "VirtualMachineInstancePropertiesStorageProfileOsDisk", + "VirtualMachineInstanceStatus", + "VirtualMachineInstanceStatusProvisioningStatus", + "VirtualMachineInstanceUpdateProperties", + "VirtualMachineInstanceUpdateRequest", + "VirtualMachineInstanceView", "ActionType", - "ArcSettingAggregateState", "CloudInitDataSource", "CreatedByType", - "DiagnosticLevel", "DiskFileFormat", "ExtendedLocationTypes", - "ExtensionAggregateState", "HyperVGeneration", "IPPoolTypeEnum", - "ImdsAttestation", "IpAllocationMethodEnum", - "NetworkTypeEnum", - "NodeArcState", - "NodeExtensionState", "OperatingSystemTypes", "Origin", - "OsTypeEnum", "PowerStateEnum", - "PrivateIPAllocationMethodEnum", "ProvisioningAction", - "ProvisioningState", "ProvisioningStateEnum", - "ProvisioningStatusEnum", + "SecurityTypes", "Status", "StatusLevelTypes", "StatusTypes", "VmSizeEnum", - "WindowsServerSubscription", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/_azure_stack_hci_client_enums.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/_azure_stack_hci_client_enums.py index ecbb163067c1d..932688d055e5b 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/_azure_stack_hci_client_enums.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/_azure_stack_hci_client_enums.py @@ -16,28 +16,8 @@ class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): INTERNAL = "Internal" -class ArcSettingAggregateState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Aggregate state of Arc agent across the nodes in this HCI cluster.""" - - NOT_SPECIFIED = "NotSpecified" - ERROR = "Error" - SUCCEEDED = "Succeeded" - CANCELED = "Canceled" - FAILED = "Failed" - CONNECTED = "Connected" - DISCONNECTED = "Disconnected" - DELETED = "Deleted" - CREATING = "Creating" - UPDATING = "Updating" - DELETING = "Deleting" - MOVING = "Moving" - PARTIALLY_SUCCEEDED = "PartiallySucceeded" - PARTIALLY_CONNECTED = "PartiallyConnected" - IN_PROGRESS = "InProgress" - - class CloudInitDataSource(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Datasource for the gallery image when provisioning with cloud-init (Azure or NoCloud).""" + """Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure].""" NO_CLOUD = "NoCloud" AZURE = "Azure" @@ -52,14 +32,6 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): KEY = "Key" -class DiagnosticLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Desired level of diagnostic data emitted by the cluster.""" - - OFF = "Off" - BASIC = "Basic" - ENHANCED = "Enhanced" - - class DiskFileFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The format of the actual VHD file [vhd, vhdx].""" @@ -73,26 +45,6 @@ class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): CUSTOM_LOCATION = "CustomLocation" -class ExtensionAggregateState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Aggregate state of Arc Extensions across the nodes in this HCI cluster.""" - - NOT_SPECIFIED = "NotSpecified" - ERROR = "Error" - SUCCEEDED = "Succeeded" - CANCELED = "Canceled" - FAILED = "Failed" - CONNECTED = "Connected" - DISCONNECTED = "Disconnected" - DELETED = "Deleted" - CREATING = "Creating" - UPDATING = "Updating" - DELETING = "Deleting" - MOVING = "Moving" - PARTIALLY_SUCCEEDED = "PartiallySucceeded" - PARTIALLY_CONNECTED = "PartiallyConnected" - IN_PROGRESS = "InProgress" - - class HyperVGeneration(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The hypervisor generation of the Virtual Machine [V1, V2].""" @@ -100,13 +52,6 @@ class HyperVGeneration(str, Enum, metaclass=CaseInsensitiveEnumMeta): V2 = "V2" -class ImdsAttestation(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """IMDS attestation status of the cluster.""" - - DISABLED = "Disabled" - ENABLED = "Enabled" - - class IpAllocationMethodEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): """IPAllocationMethod - The IP address allocation method. Possible values include: 'Static', 'Dynamic'. @@ -117,62 +62,14 @@ class IpAllocationMethodEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): class IPPoolTypeEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ip pool type.""" + """Type of the IP Pool [vm, vippool].""" VM = "vm" VIPPOOL = "vippool" -class NetworkTypeEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the network.""" - - NAT = "NAT" - TRANSPARENT = "Transparent" - L2_BRIDGE = "L2Bridge" - L2_TUNNEL = "L2Tunnel" - ICS = "ICS" - PRIVATE = "Private" - OVERLAY = "Overlay" - INTERNAL = "Internal" - MIRRORED = "Mirrored" - - -class NodeArcState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of Arc agent in this node.""" - - NOT_SPECIFIED = "NotSpecified" - ERROR = "Error" - SUCCEEDED = "Succeeded" - CANCELED = "Canceled" - FAILED = "Failed" - CONNECTED = "Connected" - DISCONNECTED = "Disconnected" - DELETED = "Deleted" - CREATING = "Creating" - UPDATING = "Updating" - DELETING = "Deleting" - MOVING = "Moving" - - -class NodeExtensionState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of Arc Extension in this node.""" - - NOT_SPECIFIED = "NotSpecified" - ERROR = "Error" - SUCCEEDED = "Succeeded" - CANCELED = "Canceled" - FAILED = "Failed" - CONNECTED = "Connected" - DISCONNECTED = "Disconnected" - DELETED = "Deleted" - CREATING = "Creating" - UPDATING = "Updating" - DELETING = "Deleting" - MOVING = "Moving" - - class OperatingSystemTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """operating system type that the gallery image uses. Expected to be linux or windows.""" + """Operating system type that the gallery image uses [Windows, Linux].""" WINDOWS = "Windows" LINUX = "Linux" @@ -188,15 +85,8 @@ class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): USER_SYSTEM = "user,system" -class OsTypeEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OsType - string specifying whether the OS is Linux or Windows.""" - - LINUX = "Linux" - WINDOWS = "Windows" - - class PowerStateEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The power state of the virtual machine.""" + """The power state of the virtual machine instance.""" DEALLOCATED = "Deallocated" DEALLOCATING = "Deallocating" @@ -207,15 +97,6 @@ class PowerStateEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): UNKNOWN = "Unknown" -class PrivateIPAllocationMethodEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """PrivateIPAllocationMethod - The private IP address allocation method. Possible values include: - 'Static', 'Dynamic'. - """ - - DYNAMIC = "Dynamic" - STATIC = "Static" - - class ProvisioningAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Defines the different types of operations for guest agent.""" @@ -224,16 +105,6 @@ class ProvisioningAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): REPAIR = "repair" -class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the ArcSetting proxy resource.""" - - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CANCELED = "Canceled" - ACCEPTED = "Accepted" - PROVISIONING = "Provisioning" - - class ProvisioningStateEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the gallery image.""" @@ -245,22 +116,21 @@ class ProvisioningStateEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): CANCELED = "Canceled" -class ProvisioningStatusEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The status of the operation performed on the gallery image [Succeeded, Failed, InProgress].""" +class SecurityTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies the SecurityType of the virtual machine. EnableTPM and SecureBootEnabled must be set + to true for SecurityType to function. + """ - SUCCEEDED = "Succeeded" - FAILED = "Failed" - IN_PROGRESS = "InProgress" + TRUSTED_LAUNCH = "TrustedLaunch" + CONFIDENTIAL_VM = "ConfidentialVM" class Status(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of the cluster agent.""" + """The status of the operation performed on the gallery image [Succeeded, Failed, InProgress].""" - NOT_YET_REGISTERED = "NotYetRegistered" - CONNECTED_RECENTLY = "ConnectedRecently" - NOT_CONNECTED_RECENTLY = "NotConnectedRecently" - DISCONNECTED = "Disconnected" - ERROR = "Error" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + IN_PROGRESS = "InProgress" class StatusLevelTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -272,11 +142,11 @@ class StatusLevelTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): class StatusTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The status of the hybrid machine agent.""" + """The installation status of the hybrid machine agent installation.""" - CONNECTED = "Connected" - DISCONNECTED = "Disconnected" - ERROR = "Error" + SUCCEEDED = "Succeeded" + IN_PROGRESS = "InProgress" + FAILED = "Failed" class VmSizeEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -305,10 +175,3 @@ class VmSizeEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV12 = "Standard_NV12" STANDARD_K8_S5_V1 = "Standard_K8S5_v1" CUSTOM = "Custom" - - -class WindowsServerSubscription(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Desired state of Windows Server Subscription.""" - - DISABLED = "Disabled" - ENABLED = "Enabled" diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/_models_py3.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/_models_py3.py index 82ee46fb4e92b..ba7201b5ba982 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/_models_py3.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/_models_py3.py @@ -13,10 +13,6 @@ 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 sys.version_info >= (3, 8): from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports else: @@ -25,214 +21,239 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object -class Resource(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. +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 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". + :ivar type: The additional info type. :vartype type: str + :ivar info: The additional info. + :vartype info: JSON """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, "type": {"readonly": True}, + "info": {"readonly": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None - self.name = None self.type = None + self.info = None -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. +class ErrorDetail(_serialization.Model): + """The error detail. 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 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.azurestackhci.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.azurestackhci.models.ErrorAdditionalInfo] """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, + "code": {"readonly": True}, + "message": {"readonly": True}, + "target": {"readonly": True}, + "details": {"readonly": True}, + "additional_info": {"readonly": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, + "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): + 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 ArcSetting(ProxyResource): # pylint: disable=too-many-instance-attributes - """ArcSetting details. - - Variables are only populated by the server, and will be ignored when sending a request. +class ErrorResponse(_serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). - :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 provisioning_state: Provisioning state of the ArcSetting proxy resource. Known values - are: "Succeeded", "Failed", "Canceled", "Accepted", and "Provisioning". - :vartype provisioning_state: str or ~azure.mgmt.azurestackhci.models.ProvisioningState - :ivar arc_instance_resource_group: The resource group that hosts the Arc agents, ie. Hybrid - Compute Machine resources. - :vartype arc_instance_resource_group: str - :ivar aggregate_state: Aggregate state of Arc agent across the nodes in this HCI cluster. Known - values are: "NotSpecified", "Error", "Succeeded", "Canceled", "Failed", "Connected", - "Disconnected", "Deleted", "Creating", "Updating", "Deleting", "Moving", "PartiallySucceeded", - "PartiallyConnected", and "InProgress". - :vartype aggregate_state: str or ~azure.mgmt.azurestackhci.models.ArcSettingAggregateState - :ivar per_node_details: State of Arc agent in each of the nodes. - :vartype per_node_details: list[~azure.mgmt.azurestackhci.models.PerNodeState] - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or ~azure.mgmt.azurestackhci.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or ~azure.mgmt.azurestackhci.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime + :ivar error: The error object. + :vartype error: ~azure.mgmt.azurestackhci.models.ErrorDetail """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "arc_instance_resource_group": {"readonly": True}, - "aggregate_state": {"readonly": True}, - "per_node_details": {"readonly": True}, + _attribute_map = { + "error": {"key": "error", "type": "ErrorDetail"}, } + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.azurestackhci.models.ErrorDetail + """ + super().__init__(**kwargs) + self.error = error + + +class ExtendedLocation(_serialization.Model): + """The complex type of the extended location. + + :ivar name: The name of the extended location. + :vartype name: str + :ivar type: The type of the extended location. "CustomLocation" + :vartype type: str or ~azure.mgmt.azurestackhci.models.ExtendedLocationTypes + """ + _attribute_map = { - "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "arc_instance_resource_group": {"key": "properties.arcInstanceResourceGroup", "type": "str"}, - "aggregate_state": {"key": "properties.aggregateState", "type": "str"}, - "per_node_details": {"key": "properties.perNodeDetails", "type": "[PerNodeState]"}, - "created_by": {"key": "systemData.createdBy", "type": "str"}, - "created_by_type": {"key": "systemData.createdByType", "type": "str"}, - "created_at": {"key": "systemData.createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "systemData.lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "systemData.lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "systemData.lastModifiedAt", "type": "iso-8601"}, } def __init__( self, *, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + name: Optional[str] = None, + type: Optional[Union[str, "_models.ExtendedLocationTypes"]] = None, + **kwargs: Any + ) -> None: """ - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or ~azure.mgmt.azurestackhci.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or ~azure.mgmt.azurestackhci.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime + :keyword name: The name of the extended location. + :paramtype name: str + :keyword type: The type of the extended location. "CustomLocation" + :paramtype type: str or ~azure.mgmt.azurestackhci.models.ExtendedLocationTypes """ super().__init__(**kwargs) - self.provisioning_state = None - self.arc_instance_resource_group = None - self.aggregate_state = None - self.per_node_details = None - self.created_by = created_by - self.created_by_type = created_by_type - self.created_at = created_at - self.last_modified_by = last_modified_by - self.last_modified_by_type = last_modified_by_type - self.last_modified_at = last_modified_at + self.name = name + self.type = type -class ArcSettingList(_serialization.Model): - """List of ArcSetting proxy resources for the HCI cluster. +class GalleryDiskImage(_serialization.Model): + """This is the disk image base class. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: List of ArcSetting proxy resources. - :vartype value: list[~azure.mgmt.azurestackhci.models.ArcSetting] - :ivar next_link: Link to the next set of results. - :vartype next_link: str + :ivar size_in_mb: This property indicates the size of the VHD to be created. + :vartype size_in_mb: int """ _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, + "size_in_mb": {"readonly": True}, } _attribute_map = { - "value": {"key": "value", "type": "[ArcSetting]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "size_in_mb": {"key": "sizeInMB", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.value = None - self.next_link = None + self.size_in_mb = None + + +class GalleryImageIdentifier(_serialization.Model): + """This is the gallery image definition identifier. + + All required parameters must be populated in order to send to Azure. + + :ivar publisher: The name of the gallery image definition publisher. Required. + :vartype publisher: str + :ivar offer: The name of the gallery image definition offer. Required. + :vartype offer: str + :ivar sku: The name of the gallery image definition SKU. Required. + :vartype sku: str + """ + + _validation = { + "publisher": {"required": True}, + "offer": {"required": True}, + "sku": {"required": True}, + } + + _attribute_map = { + "publisher": {"key": "publisher", "type": "str"}, + "offer": {"key": "offer", "type": "str"}, + "sku": {"key": "sku", "type": "str"}, + } + + def __init__(self, *, publisher: str, offer: str, sku: str, **kwargs: Any) -> None: + """ + :keyword publisher: The name of the gallery image definition publisher. Required. + :paramtype publisher: str + :keyword offer: The name of the gallery image definition offer. Required. + :paramtype offer: str + :keyword sku: The name of the gallery image definition SKU. Required. + :paramtype sku: str + """ + super().__init__(**kwargs) + self.publisher = publisher + self.offer = offer + self.sku = sku + + +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.azurestackhci.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 TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + """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. @@ -246,6 +267,9 @@ class TrackedResource(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.azurestackhci.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. @@ -256,6 +280,7 @@ class TrackedResource(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "location": {"required": True}, } @@ -263,11 +288,12 @@ class TrackedResource(Resource): "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, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -279,875 +305,8 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.location = location -class Cluster(TrackedResource): # pylint: disable=too-many-instance-attributes - """Cluster details. - - 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 tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar provisioning_state: Provisioning state. Known values are: "Succeeded", "Failed", - "Canceled", "Accepted", and "Provisioning". - :vartype provisioning_state: str or ~azure.mgmt.azurestackhci.models.ProvisioningState - :ivar status: Status of the cluster agent. Known values are: "NotYetRegistered", - "ConnectedRecently", "NotConnectedRecently", "Disconnected", and "Error". - :vartype status: str or ~azure.mgmt.azurestackhci.models.Status - :ivar cloud_id: Unique, immutable resource id. - :vartype cloud_id: str - :ivar cloud_management_endpoint: Endpoint configured for management from the Azure portal. - :vartype cloud_management_endpoint: str - :ivar aad_client_id: App id of cluster AAD identity. - :vartype aad_client_id: str - :ivar aad_tenant_id: Tenant id of cluster AAD identity. - :vartype aad_tenant_id: str - :ivar desired_properties: Desired properties of the cluster. - :vartype desired_properties: ~azure.mgmt.azurestackhci.models.ClusterDesiredProperties - :ivar reported_properties: Properties reported by cluster agent. - :vartype reported_properties: ~azure.mgmt.azurestackhci.models.ClusterReportedProperties - :ivar trial_days_remaining: Number of days remaining in the trial period. - :vartype trial_days_remaining: float - :ivar billing_model: Type of billing applied to the resource. - :vartype billing_model: str - :ivar registration_timestamp: First cluster sync timestamp. - :vartype registration_timestamp: ~datetime.datetime - :ivar last_sync_timestamp: Most recent cluster sync timestamp. - :vartype last_sync_timestamp: ~datetime.datetime - :ivar last_billing_timestamp: Most recent billing meter timestamp. - :vartype last_billing_timestamp: ~datetime.datetime - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or ~azure.mgmt.azurestackhci.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or ~azure.mgmt.azurestackhci.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "provisioning_state": {"readonly": True}, - "status": {"readonly": True}, - "cloud_id": {"readonly": True}, - "reported_properties": {"readonly": True}, - "trial_days_remaining": {"readonly": True}, - "billing_model": {"readonly": True}, - "registration_timestamp": {"readonly": True}, - "last_sync_timestamp": {"readonly": True}, - "last_billing_timestamp": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "status": {"key": "properties.status", "type": "str"}, - "cloud_id": {"key": "properties.cloudId", "type": "str"}, - "cloud_management_endpoint": {"key": "properties.cloudManagementEndpoint", "type": "str"}, - "aad_client_id": {"key": "properties.aadClientId", "type": "str"}, - "aad_tenant_id": {"key": "properties.aadTenantId", "type": "str"}, - "desired_properties": {"key": "properties.desiredProperties", "type": "ClusterDesiredProperties"}, - "reported_properties": {"key": "properties.reportedProperties", "type": "ClusterReportedProperties"}, - "trial_days_remaining": {"key": "properties.trialDaysRemaining", "type": "float"}, - "billing_model": {"key": "properties.billingModel", "type": "str"}, - "registration_timestamp": {"key": "properties.registrationTimestamp", "type": "iso-8601"}, - "last_sync_timestamp": {"key": "properties.lastSyncTimestamp", "type": "iso-8601"}, - "last_billing_timestamp": {"key": "properties.lastBillingTimestamp", "type": "iso-8601"}, - "created_by": {"key": "systemData.createdBy", "type": "str"}, - "created_by_type": {"key": "systemData.createdByType", "type": "str"}, - "created_at": {"key": "systemData.createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "systemData.lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "systemData.lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "systemData.lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - cloud_management_endpoint: Optional[str] = None, - aad_client_id: Optional[str] = None, - aad_tenant_id: Optional[str] = None, - desired_properties: Optional["_models.ClusterDesiredProperties"] = None, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword cloud_management_endpoint: Endpoint configured for management from the Azure portal. - :paramtype cloud_management_endpoint: str - :keyword aad_client_id: App id of cluster AAD identity. - :paramtype aad_client_id: str - :keyword aad_tenant_id: Tenant id of cluster AAD identity. - :paramtype aad_tenant_id: str - :keyword desired_properties: Desired properties of the cluster. - :paramtype desired_properties: ~azure.mgmt.azurestackhci.models.ClusterDesiredProperties - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or ~azure.mgmt.azurestackhci.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or ~azure.mgmt.azurestackhci.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__init__(tags=tags, location=location, **kwargs) - self.provisioning_state = None - self.status = None - self.cloud_id = None - self.cloud_management_endpoint = cloud_management_endpoint - self.aad_client_id = aad_client_id - self.aad_tenant_id = aad_tenant_id - self.desired_properties = desired_properties - self.reported_properties = None - self.trial_days_remaining = None - self.billing_model = None - self.registration_timestamp = None - self.last_sync_timestamp = None - self.last_billing_timestamp = None - self.created_by = created_by - self.created_by_type = created_by_type - self.created_at = created_at - self.last_modified_by = last_modified_by - self.last_modified_by_type = last_modified_by_type - self.last_modified_at = last_modified_at - - -class ClusterDesiredProperties(_serialization.Model): - """Desired properties of the cluster. - - :ivar windows_server_subscription: Desired state of Windows Server Subscription. Known values - are: "Disabled" and "Enabled". - :vartype windows_server_subscription: str or - ~azure.mgmt.azurestackhci.models.WindowsServerSubscription - :ivar diagnostic_level: Desired level of diagnostic data emitted by the cluster. Known values - are: "Off", "Basic", and "Enhanced". - :vartype diagnostic_level: str or ~azure.mgmt.azurestackhci.models.DiagnosticLevel - """ - - _attribute_map = { - "windows_server_subscription": {"key": "windowsServerSubscription", "type": "str"}, - "diagnostic_level": {"key": "diagnosticLevel", "type": "str"}, - } - - def __init__( - self, - *, - windows_server_subscription: Optional[Union[str, "_models.WindowsServerSubscription"]] = None, - diagnostic_level: Optional[Union[str, "_models.DiagnosticLevel"]] = None, - **kwargs - ): - """ - :keyword windows_server_subscription: Desired state of Windows Server Subscription. Known - values are: "Disabled" and "Enabled". - :paramtype windows_server_subscription: str or - ~azure.mgmt.azurestackhci.models.WindowsServerSubscription - :keyword diagnostic_level: Desired level of diagnostic data emitted by the cluster. Known - values are: "Off", "Basic", and "Enhanced". - :paramtype diagnostic_level: str or ~azure.mgmt.azurestackhci.models.DiagnosticLevel - """ - super().__init__(**kwargs) - self.windows_server_subscription = windows_server_subscription - self.diagnostic_level = diagnostic_level - - -class ClusterList(_serialization.Model): - """List of clusters. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of clusters. - :vartype value: list[~azure.mgmt.azurestackhci.models.Cluster] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Cluster]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: Optional[List["_models.Cluster"]] = None, **kwargs): - """ - :keyword value: List of clusters. - :paramtype value: list[~azure.mgmt.azurestackhci.models.Cluster] - """ - super().__init__(**kwargs) - self.value = value - self.next_link = None - - -class ClusterNode(_serialization.Model): - """Cluster node details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the cluster node. - :vartype name: str - :ivar id: Id of the node in the cluster. - :vartype id: float - :ivar windows_server_subscription: State of Windows Server Subscription. Known values are: - "Disabled" and "Enabled". - :vartype windows_server_subscription: str or - ~azure.mgmt.azurestackhci.models.WindowsServerSubscription - :ivar manufacturer: Manufacturer of the cluster node hardware. - :vartype manufacturer: str - :ivar model: Model name of the cluster node hardware. - :vartype model: str - :ivar os_name: Operating system running on the cluster node. - :vartype os_name: str - :ivar os_version: Version of the operating system running on the cluster node. - :vartype os_version: str - :ivar serial_number: Immutable id of the cluster node. - :vartype serial_number: str - :ivar core_count: Number of physical cores on the cluster node. - :vartype core_count: float - :ivar memory_in_gi_b: Total available memory on the cluster node (in GiB). - :vartype memory_in_gi_b: float - """ - - _validation = { - "name": {"readonly": True}, - "id": {"readonly": True}, - "windows_server_subscription": {"readonly": True}, - "manufacturer": {"readonly": True}, - "model": {"readonly": True}, - "os_name": {"readonly": True}, - "os_version": {"readonly": True}, - "serial_number": {"readonly": True}, - "core_count": {"readonly": True}, - "memory_in_gi_b": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "id": {"key": "id", "type": "float"}, - "windows_server_subscription": {"key": "windowsServerSubscription", "type": "str"}, - "manufacturer": {"key": "manufacturer", "type": "str"}, - "model": {"key": "model", "type": "str"}, - "os_name": {"key": "osName", "type": "str"}, - "os_version": {"key": "osVersion", "type": "str"}, - "serial_number": {"key": "serialNumber", "type": "str"}, - "core_count": {"key": "coreCount", "type": "float"}, - "memory_in_gi_b": {"key": "memoryInGiB", "type": "float"}, - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.name = None - self.id = None - self.windows_server_subscription = None - self.manufacturer = None - self.model = None - self.os_name = None - self.os_version = None - self.serial_number = None - self.core_count = None - self.memory_in_gi_b = None - - -class ClusterPatch(_serialization.Model): - """Cluster details to update. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar cloud_management_endpoint: Endpoint configured for management from the Azure portal. - :vartype cloud_management_endpoint: str - :ivar aad_client_id: App id of cluster AAD identity. - :vartype aad_client_id: str - :ivar aad_tenant_id: Tenant id of cluster AAD identity. - :vartype aad_tenant_id: str - :ivar desired_properties: Desired properties of the cluster. - :vartype desired_properties: ~azure.mgmt.azurestackhci.models.ClusterDesiredProperties - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "cloud_management_endpoint": {"key": "properties.cloudManagementEndpoint", "type": "str"}, - "aad_client_id": {"key": "properties.aadClientId", "type": "str"}, - "aad_tenant_id": {"key": "properties.aadTenantId", "type": "str"}, - "desired_properties": {"key": "properties.desiredProperties", "type": "ClusterDesiredProperties"}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - cloud_management_endpoint: Optional[str] = None, - aad_client_id: Optional[str] = None, - aad_tenant_id: Optional[str] = None, - desired_properties: Optional["_models.ClusterDesiredProperties"] = None, - **kwargs - ): - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword cloud_management_endpoint: Endpoint configured for management from the Azure portal. - :paramtype cloud_management_endpoint: str - :keyword aad_client_id: App id of cluster AAD identity. - :paramtype aad_client_id: str - :keyword aad_tenant_id: Tenant id of cluster AAD identity. - :paramtype aad_tenant_id: str - :keyword desired_properties: Desired properties of the cluster. - :paramtype desired_properties: ~azure.mgmt.azurestackhci.models.ClusterDesiredProperties - """ - super().__init__(**kwargs) - self.tags = tags - self.cloud_management_endpoint = cloud_management_endpoint - self.aad_client_id = aad_client_id - self.aad_tenant_id = aad_tenant_id - self.desired_properties = desired_properties - - -class ClusterReportedProperties(_serialization.Model): - """Properties reported by cluster agent. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cluster_name: Name of the on-prem cluster connected to this resource. - :vartype cluster_name: str - :ivar cluster_id: Unique id generated by the on-prem cluster. - :vartype cluster_id: str - :ivar cluster_version: Version of the cluster software. - :vartype cluster_version: str - :ivar nodes: List of nodes reported by the cluster. - :vartype nodes: list[~azure.mgmt.azurestackhci.models.ClusterNode] - :ivar last_updated: Last time the cluster reported the data. - :vartype last_updated: ~datetime.datetime - :ivar imds_attestation: IMDS attestation status of the cluster. Known values are: "Disabled" - and "Enabled". - :vartype imds_attestation: str or ~azure.mgmt.azurestackhci.models.ImdsAttestation - :ivar diagnostic_level: Level of diagnostic data emitted by the cluster. Known values are: - "Off", "Basic", and "Enhanced". - :vartype diagnostic_level: str or ~azure.mgmt.azurestackhci.models.DiagnosticLevel - """ - - _validation = { - "cluster_name": {"readonly": True}, - "cluster_id": {"readonly": True}, - "cluster_version": {"readonly": True}, - "nodes": {"readonly": True}, - "last_updated": {"readonly": True}, - "imds_attestation": {"readonly": True}, - } - - _attribute_map = { - "cluster_name": {"key": "clusterName", "type": "str"}, - "cluster_id": {"key": "clusterId", "type": "str"}, - "cluster_version": {"key": "clusterVersion", "type": "str"}, - "nodes": {"key": "nodes", "type": "[ClusterNode]"}, - "last_updated": {"key": "lastUpdated", "type": "iso-8601"}, - "imds_attestation": {"key": "imdsAttestation", "type": "str"}, - "diagnostic_level": {"key": "diagnosticLevel", "type": "str"}, - } - - def __init__(self, *, diagnostic_level: Optional[Union[str, "_models.DiagnosticLevel"]] = None, **kwargs): - """ - :keyword diagnostic_level: Level of diagnostic data emitted by the cluster. Known values are: - "Off", "Basic", and "Enhanced". - :paramtype diagnostic_level: str or ~azure.mgmt.azurestackhci.models.DiagnosticLevel - """ - super().__init__(**kwargs) - self.cluster_name = None - self.cluster_id = None - self.cluster_version = None - self.nodes = None - self.last_updated = None - self.imds_attestation = None - self.diagnostic_level = diagnostic_level - - -class ComponentsL15GkaSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesRoutetable(_serialization.Model): - """RouteTable for the subnet. - - :ivar id: Etag - Gets a unique read-only string that changes whenever the resource is updated. - :vartype id: str - :ivar name: Name - READ-ONLY; Resource name. - :vartype name: str - :ivar type: Type - READ-ONLY; Resource type. - :vartype type: str - :ivar routes: Routes - Collection of routes contained within a route table. - :vartype routes: - list[~azure.mgmt.azurestackhci.models.VirtualnetworksPropertiesSubnetsPropertiesItemsItem] - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "routes": {"key": "properties.routes", "type": "[VirtualnetworksPropertiesSubnetsPropertiesItemsItem]"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - name: Optional[str] = None, - type: Optional[str] = None, - routes: Optional[List["_models.VirtualnetworksPropertiesSubnetsPropertiesItemsItem"]] = None, - **kwargs - ): - """ - :keyword id: Etag - Gets a unique read-only string that changes whenever the resource is - updated. - :paramtype id: str - :keyword name: Name - READ-ONLY; Resource name. - :paramtype name: str - :keyword type: Type - READ-ONLY; Resource type. - :paramtype type: str - :keyword routes: Routes - Collection of routes contained within a route table. - :paramtype routes: - list[~azure.mgmt.azurestackhci.models.VirtualnetworksPropertiesSubnetsPropertiesItemsItem] - """ - super().__init__(**kwargs) - self.id = id - self.name = name - self.type = type - self.routes = routes - - -class ComponentsVqks9HSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesIpconfigurationreferencesItems( - _serialization.Model -): - """IPConfigurationReference - Describes a IPConfiguration under the virtual network. - - :ivar id: IPConfigurationID. - :vartype id: str - """ - - _attribute_map = { - "id": {"key": "ID", "type": "str"}, - } - - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin - """ - :keyword id: IPConfigurationID. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -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): - """ """ - super().__init__(**kwargs) - self.type = None - self.info = 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.azurestackhci.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.mgmt.azurestackhci.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): - """ """ - super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - - :ivar error: The error object. - :vartype error: ~azure.mgmt.azurestackhci.models.ErrorDetail - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorDetail"}, - } - - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): - """ - :keyword error: The error object. - :paramtype error: ~azure.mgmt.azurestackhci.models.ErrorDetail - """ - super().__init__(**kwargs) - self.error = error - - -class ExtendedLocation(_serialization.Model): - """The complex type of the extended location. - - :ivar name: The name of the extended location. - :vartype name: str - :ivar type: The type of the extended location. "CustomLocation" - :vartype type: str or ~azure.mgmt.azurestackhci.models.ExtendedLocationTypes - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - type: Optional[Union[str, "_models.ExtendedLocationTypes"]] = None, - **kwargs - ): - """ - :keyword name: The name of the extended location. - :paramtype name: str - :keyword type: The type of the extended location. "CustomLocation" - :paramtype type: str or ~azure.mgmt.azurestackhci.models.ExtendedLocationTypes - """ - super().__init__(**kwargs) - self.name = name - self.type = type - - -class Extension(ProxyResource): # pylint: disable=too-many-instance-attributes - """Details of a particular extension in HCI Cluster. - - 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 provisioning_state: Provisioning state of the Extension proxy resource. Known values are: - "Succeeded", "Failed", "Canceled", "Accepted", and "Provisioning". - :vartype provisioning_state: str or ~azure.mgmt.azurestackhci.models.ProvisioningState - :ivar aggregate_state: Aggregate state of Arc Extensions across the nodes in this HCI cluster. - Known values are: "NotSpecified", "Error", "Succeeded", "Canceled", "Failed", "Connected", - "Disconnected", "Deleted", "Creating", "Updating", "Deleting", "Moving", "PartiallySucceeded", - "PartiallyConnected", and "InProgress". - :vartype aggregate_state: str or ~azure.mgmt.azurestackhci.models.ExtensionAggregateState - :ivar per_node_extension_details: State of Arc Extension in each of the nodes. - :vartype per_node_extension_details: - list[~azure.mgmt.azurestackhci.models.PerNodeExtensionState] - :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_extension_parameters_type: Specifies the type of the extension; an - example is "CustomScriptExtension". - :vartype type_properties_extension_parameters_type: str - :ivar type_handler_version: Specifies the version of the script handler. - :vartype type_handler_version: str - :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: Protected settings (may contain secrets). - :vartype protected_settings: JSON - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or ~azure.mgmt.azurestackhci.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or ~azure.mgmt.azurestackhci.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "aggregate_state": {"readonly": True}, - "per_node_extension_details": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "aggregate_state": {"key": "properties.aggregateState", "type": "str"}, - "per_node_extension_details": {"key": "properties.perNodeExtensionDetails", "type": "[PerNodeExtensionState]"}, - "force_update_tag": {"key": "properties.extensionParameters.forceUpdateTag", "type": "str"}, - "publisher": {"key": "properties.extensionParameters.publisher", "type": "str"}, - "type_properties_extension_parameters_type": {"key": "properties.extensionParameters.type", "type": "str"}, - "type_handler_version": {"key": "properties.extensionParameters.typeHandlerVersion", "type": "str"}, - "auto_upgrade_minor_version": {"key": "properties.extensionParameters.autoUpgradeMinorVersion", "type": "bool"}, - "settings": {"key": "properties.extensionParameters.settings", "type": "object"}, - "protected_settings": {"key": "properties.extensionParameters.protectedSettings", "type": "object"}, - "created_by": {"key": "systemData.createdBy", "type": "str"}, - "created_by_type": {"key": "systemData.createdByType", "type": "str"}, - "created_at": {"key": "systemData.createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "systemData.lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "systemData.lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "systemData.lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - force_update_tag: Optional[str] = None, - publisher: Optional[str] = None, - type_properties_extension_parameters_type: Optional[str] = None, - type_handler_version: Optional[str] = None, - auto_upgrade_minor_version: Optional[bool] = None, - settings: Optional[JSON] = None, - protected_settings: Optional[JSON] = None, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): - """ - :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_extension_parameters_type: Specifies the type of the extension; an - example is "CustomScriptExtension". - :paramtype type_properties_extension_parameters_type: str - :keyword type_handler_version: Specifies the version of the script handler. - :paramtype type_handler_version: str - :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: Protected settings (may contain secrets). - :paramtype protected_settings: JSON - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or ~azure.mgmt.azurestackhci.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or ~azure.mgmt.azurestackhci.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.aggregate_state = None - self.per_node_extension_details = None - self.force_update_tag = force_update_tag - self.publisher = publisher - self.type_properties_extension_parameters_type = type_properties_extension_parameters_type - self.type_handler_version = type_handler_version - self.auto_upgrade_minor_version = auto_upgrade_minor_version - self.settings = settings - self.protected_settings = protected_settings - self.created_by = created_by - self.created_by_type = created_by_type - self.created_at = created_at - self.last_modified_by = last_modified_by - self.last_modified_by_type = last_modified_by_type - self.last_modified_at = last_modified_at - - -class ExtensionList(_serialization.Model): - """List of Extensions in HCI cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of Extensions in HCI cluster. - :vartype value: list[~azure.mgmt.azurestackhci.models.Extension] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Extension]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.value = None - self.next_link = None - - -class GalleryDiskImage(_serialization.Model): - """This is the disk image base class. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar size_in_mb: This property indicates the size of the VHD to be created. - :vartype size_in_mb: int - """ - - _validation = { - "size_in_mb": {"readonly": True}, - } - - _attribute_map = { - "size_in_mb": {"key": "sizeInMB", "type": "int"}, - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.size_in_mb = None - - -class GalleryImageIdentifier(_serialization.Model): - """This is the gallery image definition identifier. - - All required parameters must be populated in order to send to Azure. - - :ivar publisher: The name of the gallery image definition publisher. Required. - :vartype publisher: str - :ivar offer: The name of the gallery image definition offer. Required. - :vartype offer: str - :ivar sku: The name of the gallery image definition SKU. Required. - :vartype sku: str - """ - - _validation = { - "publisher": {"required": True}, - "offer": {"required": True}, - "sku": {"required": True}, - } - - _attribute_map = { - "publisher": {"key": "publisher", "type": "str"}, - "offer": {"key": "offer", "type": "str"}, - "sku": {"key": "sku", "type": "str"}, - } - - def __init__(self, *, publisher: str, offer: str, sku: str, **kwargs): - """ - :keyword publisher: The name of the gallery image definition publisher. Required. - :paramtype publisher: str - :keyword offer: The name of the gallery image definition offer. Required. - :paramtype offer: str - :keyword sku: The name of the gallery image definition SKU. Required. - :paramtype sku: str - """ - super().__init__(**kwargs) - self.publisher = publisher - self.offer = offer - self.sku = sku - - -class Galleryimages(TrackedResource): # pylint: disable=too-many-instance-attributes - """The gallery image resource definition. +class GalleryImages(TrackedResource): # pylint: disable=too-many-instance-attributes + """The gallery images resource definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -1161,23 +320,24 @@ class Galleryimages(TrackedResource): # pylint: disable=too-many-instance-attri :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.azurestackhci.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 extended_location: The extendedLocation of the resource. :vartype extended_location: ~azure.mgmt.azurestackhci.models.ExtendedLocation - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.azurestackhci.models.SystemData - :ivar container_name: Container Name for storage container. - :vartype container_name: str + :ivar container_id: Storage ContainerID of the storage container to be used for gallery image. + :vartype container_id: str :ivar image_path: location of the image the gallery image should be created from. :vartype image_path: str - :ivar os_type: operating system type that the gallery image uses. Expected to be linux or - windows. Known values are: "Windows" and "Linux". + :ivar os_type: Operating system type that the gallery image uses [Windows, Linux]. Known values + are: "Windows" and "Linux". :vartype os_type: str or ~azure.mgmt.azurestackhci.models.OperatingSystemTypes :ivar cloud_init_data_source: Datasource for the gallery image when provisioning with - cloud-init (Azure or NoCloud). Known values are: "NoCloud" and "Azure". + cloud-init [NoCloud, Azure]. Known values are: "NoCloud" and "Azure". :vartype cloud_init_data_source: str or ~azure.mgmt.azurestackhci.models.CloudInitDataSource :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine [V1, V2]. Known values are: "V1" and "V2". @@ -1190,9 +350,7 @@ class Galleryimages(TrackedResource): # pylint: disable=too-many-instance-attri :ivar provisioning_state: Provisioning state of the gallery image. Known values are: "Succeeded", "Failed", "InProgress", "Accepted", "Deleting", and "Canceled". :vartype provisioning_state: str or ~azure.mgmt.azurestackhci.models.ProvisioningStateEnum - :ivar resource_name: name of the object to be used in moc. - :vartype resource_name: str - :ivar status: GalleryImageStatus defines the observed state of galleryimages. + :ivar status: The observed state of gallery images. :vartype status: ~azure.mgmt.azurestackhci.models.GalleryImageStatus """ @@ -1200,8 +358,8 @@ class Galleryimages(TrackedResource): # pylint: disable=too-many-instance-attri "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "location": {"required": True}, "system_data": {"readonly": True}, + "location": {"required": True}, "provisioning_state": {"readonly": True}, "status": {"readonly": True}, } @@ -1210,11 +368,11 @@ class Galleryimages(TrackedResource): # pylint: disable=too-many-instance-attri "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"}, "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "container_name": {"key": "properties.containerName", "type": "str"}, + "container_id": {"key": "properties.containerId", "type": "str"}, "image_path": {"key": "properties.imagePath", "type": "str"}, "os_type": {"key": "properties.osType", "type": "str"}, "cloud_init_data_source": {"key": "properties.cloudInitDataSource", "type": "str"}, @@ -1222,7 +380,6 @@ class Galleryimages(TrackedResource): # pylint: disable=too-many-instance-attri "identifier": {"key": "properties.identifier", "type": "GalleryImageIdentifier"}, "version": {"key": "properties.version", "type": "GalleryImageVersion"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "resource_name": {"key": "properties.resourceName", "type": "str"}, "status": {"key": "properties.status", "type": "GalleryImageStatus"}, } @@ -1232,16 +389,15 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, extended_location: Optional["_models.ExtendedLocation"] = None, - container_name: Optional[str] = None, + container_id: Optional[str] = None, image_path: Optional[str] = None, os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = None, cloud_init_data_source: Optional[Union[str, "_models.CloudInitDataSource"]] = None, hyper_v_generation: Optional[Union[str, "_models.HyperVGeneration"]] = None, identifier: Optional["_models.GalleryImageIdentifier"] = None, version: Optional["_models.GalleryImageVersion"] = None, - resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -1249,15 +405,16 @@ def __init__( :paramtype location: str :keyword extended_location: The extendedLocation of the resource. :paramtype extended_location: ~azure.mgmt.azurestackhci.models.ExtendedLocation - :keyword container_name: Container Name for storage container. - :paramtype container_name: str + :keyword container_id: Storage ContainerID of the storage container to be used for gallery + image. + :paramtype container_id: str :keyword image_path: location of the image the gallery image should be created from. :paramtype image_path: str - :keyword os_type: operating system type that the gallery image uses. Expected to be linux or - windows. Known values are: "Windows" and "Linux". + :keyword os_type: Operating system type that the gallery image uses [Windows, Linux]. Known + values are: "Windows" and "Linux". :paramtype os_type: str or ~azure.mgmt.azurestackhci.models.OperatingSystemTypes :keyword cloud_init_data_source: Datasource for the gallery image when provisioning with - cloud-init (Azure or NoCloud). Known values are: "NoCloud" and "Azure". + cloud-init [NoCloud, Azure]. Known values are: "NoCloud" and "Azure". :paramtype cloud_init_data_source: str or ~azure.mgmt.azurestackhci.models.CloudInitDataSource :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine [V1, V2]. Known values are: "V1" and "V2". @@ -1267,13 +424,10 @@ def __init__( :keyword version: Specifies information about the gallery image version that you want to create or update. :paramtype version: ~azure.mgmt.azurestackhci.models.GalleryImageVersion - :keyword resource_name: name of the object to be used in moc. - :paramtype resource_name: str """ super().__init__(tags=tags, location=location, **kwargs) self.extended_location = extended_location - self.system_data = None - self.container_name = container_name + self.container_id = container_id self.image_path = image_path self.os_type = os_type self.cloud_init_data_source = cloud_init_data_source @@ -1281,17 +435,16 @@ def __init__( self.identifier = identifier self.version = version self.provisioning_state = None - self.resource_name = resource_name self.status = None -class GalleryimagesListResult(_serialization.Model): - """List of galleryimages. +class GalleryImagesListResult(_serialization.Model): + """List of gallery images. Variables are only populated by the server, and will be ignored when sending a request. :ivar value: - :vartype value: list[~azure.mgmt.azurestackhci.models.Galleryimages] + :vartype value: list[~azure.mgmt.azurestackhci.models.GalleryImages] :ivar next_link: Link to the next set of results. :vartype next_link: str """ @@ -1301,48 +454,28 @@ class GalleryimagesListResult(_serialization.Model): } _attribute_map = { - "value": {"key": "value", "type": "[Galleryimages]"}, + "value": {"key": "value", "type": "[GalleryImages]"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Galleryimages"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.GalleryImages"]] = None, **kwargs: Any) -> None: """ :keyword value: - :paramtype value: list[~azure.mgmt.azurestackhci.models.Galleryimages] + :paramtype value: list[~azure.mgmt.azurestackhci.models.GalleryImages] """ super().__init__(**kwargs) self.value = value self.next_link = None -class GalleryimagesPatch(_serialization.Model): - """The gallery image resource patch definition. - - :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 GalleryImageStatus(_serialization.Model): - """GalleryImageStatus defines the observed state of galleryimages. + """The observed state of gallery images. - :ivar error_code: Gallery image provisioning error code. + :ivar error_code: GalleryImage provisioning error code. :vartype error_code: str :ivar error_message: Descriptive error message. :vartype error_message: str - :ivar provisioning_status: The provisioning status of the gallery image. + :ivar provisioning_status: :vartype provisioning_status: ~azure.mgmt.azurestackhci.models.GalleryImageStatusProvisioningStatus :ivar download_status: The download status of the gallery image. @@ -1367,14 +500,14 @@ def __init__( provisioning_status: Optional["_models.GalleryImageStatusProvisioningStatus"] = None, download_status: Optional["_models.GalleryImageStatusDownloadStatus"] = None, progress_percentage: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword error_code: Gallery image provisioning error code. + :keyword error_code: GalleryImage provisioning error code. :paramtype error_code: str :keyword error_message: Descriptive error message. :paramtype error_message: str - :keyword provisioning_status: The provisioning status of the gallery image. + :keyword provisioning_status: :paramtype provisioning_status: ~azure.mgmt.azurestackhci.models.GalleryImageStatusProvisioningStatus :keyword download_status: The download status of the gallery image. @@ -1401,7 +534,7 @@ class GalleryImageStatusDownloadStatus(_serialization.Model): "download_size_in_mb": {"key": "downloadSizeInMB", "type": "int"}, } - def __init__(self, *, download_size_in_mb: Optional[int] = None, **kwargs): + def __init__(self, *, download_size_in_mb: Optional[int] = None, **kwargs: Any) -> None: """ :keyword download_size_in_mb: The downloaded sized of the image in MB. :paramtype download_size_in_mb: int @@ -1411,13 +544,13 @@ def __init__(self, *, download_size_in_mb: Optional[int] = None, **kwargs): class GalleryImageStatusProvisioningStatus(_serialization.Model): - """The provisioning status of the gallery image. + """GalleryImageStatusProvisioningStatus. :ivar operation_id: The ID of the operation performed on the gallery image. :vartype operation_id: str :ivar status: The status of the operation performed on the gallery image [Succeeded, Failed, InProgress]. Known values are: "Succeeded", "Failed", and "InProgress". - :vartype status: str or ~azure.mgmt.azurestackhci.models.ProvisioningStatusEnum + :vartype status: str or ~azure.mgmt.azurestackhci.models.Status """ _attribute_map = { @@ -1429,21 +562,41 @@ def __init__( self, *, operation_id: Optional[str] = None, - status: Optional[Union[str, "_models.ProvisioningStatusEnum"]] = None, - **kwargs - ): + status: Optional[Union[str, "_models.Status"]] = None, + **kwargs: Any + ) -> None: """ :keyword operation_id: The ID of the operation performed on the gallery image. :paramtype operation_id: str :keyword status: The status of the operation performed on the gallery image [Succeeded, Failed, InProgress]. Known values are: "Succeeded", "Failed", and "InProgress". - :paramtype status: str or ~azure.mgmt.azurestackhci.models.ProvisioningStatusEnum + :paramtype status: str or ~azure.mgmt.azurestackhci.models.Status """ super().__init__(**kwargs) self.operation_id = operation_id self.status = status +class GalleryImagesUpdateRequest(_serialization.Model): + """The gallery images resource patch definition. + + :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 GalleryImageVersion(_serialization.Model): """Specifies information about the gallery image version that you want to create or update. @@ -1463,8 +616,8 @@ def __init__( *, name: Optional[str] = None, storage_profile: Optional["_models.GalleryImageVersionStorageProfile"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: This is the version of the gallery image. :paramtype name: str @@ -1487,7 +640,7 @@ class GalleryImageVersionStorageProfile(_serialization.Model): "os_disk_image": {"key": "osDiskImage", "type": "GalleryOSDiskImage"}, } - def __init__(self, *, os_disk_image: Optional["_models.GalleryOSDiskImage"] = None, **kwargs): + def __init__(self, *, os_disk_image: Optional["_models.GalleryOSDiskImage"] = None, **kwargs: Any) -> None: """ :keyword os_disk_image: This is the OS disk image. :paramtype os_disk_image: ~azure.mgmt.azurestackhci.models.GalleryOSDiskImage @@ -1513,7 +666,45 @@ class GalleryOSDiskImage(GalleryDiskImage): "size_in_mb": {"key": "sizeInMB", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + + +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.azurestackhci.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) @@ -1531,12 +722,11 @@ class GuestAgent(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: The system data. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.azurestackhci.models.SystemData :ivar credentials: Username / Password Credentials to provision guest agent. :vartype credentials: ~azure.mgmt.azurestackhci.models.GuestCredential - :ivar http_proxy_config: HTTP Proxy configuration for the VM. - :vartype http_proxy_config: ~azure.mgmt.azurestackhci.models.HttpProxyConfiguration :ivar provisioning_action: The guest agent provisioning action. Known values are: "install", "uninstall", and "repair". :vartype provisioning_action: str or ~azure.mgmt.azurestackhci.models.ProvisioningAction @@ -1561,7 +751,6 @@ class GuestAgent(ProxyResource): "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, "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"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, @@ -1570,70 +759,33 @@ class GuestAgent(ProxyResource): def __init__( self, *, - credentials: Optional["_models.GuestCredential"] = None, - http_proxy_config: Optional["_models.HttpProxyConfiguration"] = None, - provisioning_action: Optional[Union[str, "_models.ProvisioningAction"]] = None, - **kwargs - ): - """ - :keyword credentials: Username / Password Credentials to provision guest agent. - :paramtype credentials: ~azure.mgmt.azurestackhci.models.GuestCredential - :keyword http_proxy_config: HTTP Proxy configuration for the VM. - :paramtype http_proxy_config: ~azure.mgmt.azurestackhci.models.HttpProxyConfiguration - :keyword provisioning_action: The guest agent provisioning action. Known values are: "install", - "uninstall", and "repair". - :paramtype provisioning_action: str or ~azure.mgmt.azurestackhci.models.ProvisioningAction - """ - super().__init__(**kwargs) - self.system_data = None - self.credentials = credentials - self.http_proxy_config = http_proxy_config - self.provisioning_action = provisioning_action - self.status = 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.azurestackhci.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): - """ - :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.azurestackhci.models.GuestAgent] + credentials: Optional["_models.GuestCredential"] = 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.azurestackhci.models.GuestCredential + :keyword provisioning_action: The guest agent provisioning action. Known values are: "install", + "uninstall", and "repair". + :paramtype provisioning_action: str or ~azure.mgmt.azurestackhci.models.ProvisioningAction """ super().__init__(**kwargs) - self.next_link = next_link - self.value = value + self.credentials = credentials + self.provisioning_action = provisioning_action + self.status = None + self.provisioning_state = None -class GuestAgentProfile(_serialization.Model): - """Defines the resource properties. +class GuestAgentInstallStatus(_serialization.Model): + """Defines the status of a guest agent installation. 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". + :ivar status: The installation status of the hybrid machine agent installation. Known values + are: "Succeeded", "InProgress", and "Failed". :vartype status: str or ~azure.mgmt.azurestackhci.models.StatusTypes :ivar last_status_change: The time of the last status change. :vartype last_status_change: ~datetime.datetime @@ -1659,7 +811,7 @@ class GuestAgentProfile(_serialization.Model): "error_details": {"key": "errorDetails", "type": "[ErrorDetail]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.vm_uuid = None @@ -1669,6 +821,38 @@ def __init__(self, **kwargs): self.error_details = 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.azurestackhci.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.azurestackhci.models.GuestAgent] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + class GuestCredential(_serialization.Model): """Username / Password Credentials to connect to guest. @@ -1683,7 +867,7 @@ class GuestCredential(_serialization.Model): "password": {"key": "password", "type": "str"}, } - def __init__(self, *, username: Optional[str] = None, password: Optional[str] = None, **kwargs): + def __init__(self, *, username: Optional[str] = None, password: Optional[str] = None, **kwargs: Any) -> None: """ :keyword username: The username to connect with the guest. :paramtype username: str @@ -1696,7 +880,7 @@ def __init__(self, *, username: Optional[str] = None, password: Optional[str] = class HardwareProfileUpdate(_serialization.Model): - """HardwareProfile - Specifies the hardware settings for the virtual machine. + """HardwareProfile - Specifies the hardware settings for the virtual machine instance. :ivar vm_size: Known values are: "Default", "Standard_A2_v2", "Standard_A4_v2", "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", @@ -1705,16 +889,16 @@ class HardwareProfileUpdate(_serialization.Model): "Standard_K8S4_v1", "Standard_NK6", "Standard_NK12", "Standard_NV6", "Standard_NV12", "Standard_K8S5_v1", and "Custom". :vartype vm_size: str or ~azure.mgmt.azurestackhci.models.VmSizeEnum - :ivar processors: number of processors for the virtual machine. + :ivar processors: number of processors for the virtual machine instance. :vartype processors: int - :ivar memory_gb: RAM in gb for the virtual machine. - :vartype memory_gb: int + :ivar memory_mb: RAM in MB for the virtual machine instance. + :vartype memory_mb: int """ _attribute_map = { "vm_size": {"key": "vmSize", "type": "str"}, "processors": {"key": "processors", "type": "int"}, - "memory_gb": {"key": "memoryGB", "type": "int"}, + "memory_mb": {"key": "memoryMB", "type": "int"}, } def __init__( @@ -1722,9 +906,9 @@ def __init__( *, vm_size: Optional[Union[str, "_models.VmSizeEnum"]] = None, processors: Optional[int] = None, - memory_gb: Optional[int] = None, - **kwargs - ): + memory_mb: Optional[int] = None, + **kwargs: Any + ) -> None: """ :keyword vm_size: Known values are: "Default", "Standard_A2_v2", "Standard_A4_v2", "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", @@ -1733,35 +917,61 @@ def __init__( "Standard_K8S4_v1", "Standard_NK6", "Standard_NK12", "Standard_NV6", "Standard_NV12", "Standard_K8S5_v1", and "Custom". :paramtype vm_size: str or ~azure.mgmt.azurestackhci.models.VmSizeEnum - :keyword processors: number of processors for the virtual machine. + :keyword processors: number of processors for the virtual machine instance. :paramtype processors: int - :keyword memory_gb: RAM in gb for the virtual machine. - :paramtype memory_gb: int + :keyword memory_mb: RAM in MB for the virtual machine instance. + :paramtype memory_mb: int """ super().__init__(**kwargs) self.vm_size = vm_size self.processors = processors - self.memory_gb = memory_gb + self.memory_mb = memory_mb class HttpProxyConfiguration(_serialization.Model): """HTTP Proxy configuration for the VM. - :ivar https_proxy: The httpsProxy url. + :ivar http_proxy: The HTTP proxy server endpoint to use. + :vartype http_proxy: str + :ivar https_proxy: The HTTPS proxy server endpoint to use. :vartype https_proxy: str + :ivar no_proxy: The endpoints that should not go through proxy. + :vartype no_proxy: list[str] + :ivar trusted_ca: Alternative CA cert to use for connecting to proxy servers. + :vartype trusted_ca: str """ _attribute_map = { + "http_proxy": {"key": "httpProxy", "type": "str"}, "https_proxy": {"key": "httpsProxy", "type": "str"}, + "no_proxy": {"key": "noProxy", "type": "[str]"}, + "trusted_ca": {"key": "trustedCa", "type": "str"}, } - def __init__(self, *, https_proxy: Optional[str] = None, **kwargs): - """ - :keyword https_proxy: The httpsProxy url. + def __init__( + self, + *, + http_proxy: Optional[str] = None, + https_proxy: Optional[str] = None, + no_proxy: Optional[List[str]] = None, + trusted_ca: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword http_proxy: The HTTP proxy server endpoint to use. + :paramtype http_proxy: str + :keyword https_proxy: The HTTPS proxy server endpoint to use. :paramtype https_proxy: str + :keyword no_proxy: The endpoints that should not go through proxy. + :paramtype no_proxy: list[str] + :keyword trusted_ca: Alternative CA cert to use for connecting to proxy servers. + :paramtype trusted_ca: str """ super().__init__(**kwargs) + self.http_proxy = http_proxy self.https_proxy = https_proxy + self.no_proxy = no_proxy + self.trusted_ca = trusted_ca class HybridIdentityMetadata(ProxyResource): @@ -1777,7 +987,8 @@ class HybridIdentityMetadata(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: The system data. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.azurestackhci.models.SystemData :ivar resource_uid: The unique identifier for the resource. :vartype resource_uid: str @@ -1809,7 +1020,7 @@ class HybridIdentityMetadata(ProxyResource): "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, } - def __init__(self, *, resource_uid: Optional[str] = None, public_key: Optional[str] = None, **kwargs): + def __init__(self, *, resource_uid: Optional[str] = None, public_key: Optional[str] = None, **kwargs: Any) -> None: """ :keyword resource_uid: The unique identifier for the resource. :paramtype resource_uid: str @@ -1817,7 +1028,6 @@ def __init__(self, *, resource_uid: Optional[str] = None, public_key: Optional[s :paramtype public_key: str """ super().__init__(**kwargs) - self.system_data = None self.resource_uid = resource_uid self.public_key = public_key self.identity = None @@ -1844,7 +1054,9 @@ class HybridIdentityMetadataList(_serialization.Model): "value": {"key": "value", "type": "[HybridIdentityMetadata]"}, } - def __init__(self, *, value: List["_models.HybridIdentityMetadata"], next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: List["_models.HybridIdentityMetadata"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword next_link: Url to follow for getting next page of HybridIdentityMetadata. :paramtype next_link: str @@ -1880,7 +1092,7 @@ class Identity(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: Optional[Literal["SystemAssigned"]] = None, **kwargs): + def __init__(self, *, type: Optional[Literal["SystemAssigned"]] = None, **kwargs: Any) -> None: """ :keyword type: The identity type. Default value is "SystemAssigned". :paramtype type: str @@ -1891,6 +1103,59 @@ def __init__(self, *, type: Optional[Literal["SystemAssigned"]] = None, **kwargs self.type = type +class InstanceViewStatus(_serialization.Model): + """Instance view status. + + :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.azurestackhci.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 + """ + + _attribute_map = { + "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, + *, + code: Optional[str] = None, + level: Optional[Union[str, "_models.StatusLevelTypes"]] = None, + display_status: Optional[str] = None, + message: Optional[str] = None, + time: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword code: The status code. + :paramtype code: str + :keyword level: The level code. Known values are: "Info", "Warning", and "Error". + :paramtype level: str or ~azure.mgmt.azurestackhci.models.StatusLevelTypes + :keyword display_status: The short localizable label for the status. + :paramtype display_status: str + :keyword message: The detailed status message, including for alerts and error messages. + :paramtype message: str + :keyword time: The time of the status. + :paramtype time: ~datetime.datetime + """ + super().__init__(**kwargs) + self.code = code + self.level = level + self.display_status = display_status + self.message = message + self.time = time + + class InterfaceDNSSettings(_serialization.Model): """InterfaceDNSSettings. @@ -1902,7 +1167,7 @@ class InterfaceDNSSettings(_serialization.Model): "dns_servers": {"key": "dnsServers", "type": "[str]"}, } - def __init__(self, *, dns_servers: Optional[List[str]] = None, **kwargs): + def __init__(self, *, dns_servers: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword dns_servers: List of DNS server IP Addresses for the interface. :paramtype dns_servers: list[str] @@ -1911,96 +1176,92 @@ def __init__(self, *, dns_servers: Optional[List[str]] = None, **kwargs): self.dns_servers = dns_servers -class IpConfiguration(_serialization.Model): +class IPConfiguration(_serialization.Model): """InterfaceIPConfiguration iPConfiguration in a network interface. :ivar name: Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. :vartype name: str :ivar properties: InterfaceIPConfigurationPropertiesFormat properties of IP configuration. - :vartype properties: ~azure.mgmt.azurestackhci.models.IpConfigurationProperties + :vartype properties: ~azure.mgmt.azurestackhci.models.IPConfigurationProperties """ + _validation = { + "name": {"pattern": r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[_a-zA-Z0-9]$"}, + } + _attribute_map = { "name": {"key": "name", "type": "str"}, - "properties": {"key": "properties", "type": "IpConfigurationProperties"}, + "properties": {"key": "properties", "type": "IPConfigurationProperties"}, } def __init__( - self, *, name: Optional[str] = None, properties: Optional["_models.IpConfigurationProperties"] = None, **kwargs - ): + self, + *, + name: Optional[str] = None, + properties: Optional["_models.IPConfigurationProperties"] = None, + **kwargs: Any + ) -> None: """ :keyword name: Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. :paramtype name: str :keyword properties: InterfaceIPConfigurationPropertiesFormat properties of IP configuration. - :paramtype properties: ~azure.mgmt.azurestackhci.models.IpConfigurationProperties + :paramtype properties: ~azure.mgmt.azurestackhci.models.IPConfigurationProperties """ super().__init__(**kwargs) self.name = name self.properties = properties -class IpConfigurationProperties(_serialization.Model): +class IPConfigurationProperties(_serialization.Model): """InterfaceIPConfigurationPropertiesFormat properties of IP configuration. + Variables are only populated by the server, and will be ignored when sending a request. + :ivar gateway: Gateway for network interface. :vartype gateway: str :ivar prefix_length: prefixLength for network interface. :vartype prefix_length: str :ivar private_ip_address: PrivateIPAddress - Private IP address of the IP configuration. :vartype private_ip_address: str - :ivar private_ip_allocation_method: PrivateIPAllocationMethod - The private IP address - allocation method. Possible values include: 'Static', 'Dynamic'. Known values are: "Dynamic" - and "Static". - :vartype private_ip_allocation_method: str or - ~azure.mgmt.azurestackhci.models.PrivateIPAllocationMethodEnum :ivar subnet: Subnet - Name of Subnet bound to the IP configuration. - :vartype subnet: ~azure.mgmt.azurestackhci.models.IpConfigurationPropertiesSubnet + :vartype subnet: ~azure.mgmt.azurestackhci.models.IPConfigurationPropertiesSubnet """ + _validation = { + "gateway": {"readonly": True}, + "prefix_length": {"readonly": True}, + } + _attribute_map = { "gateway": {"key": "gateway", "type": "str"}, "prefix_length": {"key": "prefixLength", "type": "str"}, "private_ip_address": {"key": "privateIPAddress", "type": "str"}, - "private_ip_allocation_method": {"key": "privateIPAllocationMethod", "type": "str"}, - "subnet": {"key": "subnet", "type": "IpConfigurationPropertiesSubnet"}, + "subnet": {"key": "subnet", "type": "IPConfigurationPropertiesSubnet"}, } def __init__( self, *, - gateway: Optional[str] = None, - prefix_length: Optional[str] = None, private_ip_address: Optional[str] = None, - private_ip_allocation_method: Optional[Union[str, "_models.PrivateIPAllocationMethodEnum"]] = None, - subnet: Optional["_models.IpConfigurationPropertiesSubnet"] = None, - **kwargs - ): - """ - :keyword gateway: Gateway for network interface. - :paramtype gateway: str - :keyword prefix_length: prefixLength for network interface. - :paramtype prefix_length: str + subnet: Optional["_models.IPConfigurationPropertiesSubnet"] = None, + **kwargs: Any + ) -> None: + """ :keyword private_ip_address: PrivateIPAddress - Private IP address of the IP configuration. :paramtype private_ip_address: str - :keyword private_ip_allocation_method: PrivateIPAllocationMethod - The private IP address - allocation method. Possible values include: 'Static', 'Dynamic'. Known values are: "Dynamic" - and "Static". - :paramtype private_ip_allocation_method: str or - ~azure.mgmt.azurestackhci.models.PrivateIPAllocationMethodEnum :keyword subnet: Subnet - Name of Subnet bound to the IP configuration. - :paramtype subnet: ~azure.mgmt.azurestackhci.models.IpConfigurationPropertiesSubnet + :paramtype subnet: ~azure.mgmt.azurestackhci.models.IPConfigurationPropertiesSubnet """ super().__init__(**kwargs) - self.gateway = gateway - self.prefix_length = prefix_length + self.gateway = None + self.prefix_length = None self.private_ip_address = private_ip_address - self.private_ip_allocation_method = private_ip_allocation_method self.subnet = subnet -class IpConfigurationPropertiesSubnet(_serialization.Model): +class IPConfigurationPropertiesSubnet(_serialization.Model): """Subnet - Name of Subnet bound to the IP configuration. :ivar id: ID - The ARM resource id in the form of @@ -2012,7 +1273,7 @@ class IpConfigurationPropertiesSubnet(_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 - The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... @@ -2025,17 +1286,20 @@ def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=re class IPPool(_serialization.Model): """IPPool. - :ivar ip_pool_type: ip pool type. Known values are: "vm" and "vippool". + :ivar name: Name of the IP-Pool. + :vartype name: str + :ivar ip_pool_type: Type of the IP Pool [vm, vippool]. Known values are: "vm" and "vippool". :vartype ip_pool_type: str or ~azure.mgmt.azurestackhci.models.IPPoolTypeEnum - :ivar start: start of the ip address pool. + :ivar start: Start of the IP address pool. :vartype start: str - :ivar end: end of the ip address pool. + :ivar end: End of the IP address pool. :vartype end: str :ivar info: :vartype info: ~azure.mgmt.azurestackhci.models.IPPoolInfo """ _attribute_map = { + "name": {"key": "name", "type": "str"}, "ip_pool_type": {"key": "ipPoolType", "type": "str"}, "start": {"key": "start", "type": "str"}, "end": {"key": "end", "type": "str"}, @@ -2045,23 +1309,27 @@ class IPPool(_serialization.Model): def __init__( self, *, + name: Optional[str] = None, ip_pool_type: Optional[Union[str, "_models.IPPoolTypeEnum"]] = None, start: Optional[str] = None, end: Optional[str] = None, info: Optional["_models.IPPoolInfo"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword ip_pool_type: ip pool type. Known values are: "vm" and "vippool". + :keyword name: Name of the IP-Pool. + :paramtype name: str + :keyword ip_pool_type: Type of the IP Pool [vm, vippool]. Known values are: "vm" and "vippool". :paramtype ip_pool_type: str or ~azure.mgmt.azurestackhci.models.IPPoolTypeEnum - :keyword start: start of the ip address pool. + :keyword start: Start of the IP address pool. :paramtype start: str - :keyword end: end of the ip address pool. + :keyword end: End of the IP address pool. :paramtype end: str :keyword info: :paramtype info: ~azure.mgmt.azurestackhci.models.IPPoolInfo """ super().__init__(**kwargs) + self.name = name self.ip_pool_type = ip_pool_type self.start = start self.end = end @@ -2073,9 +1341,9 @@ class IPPoolInfo(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar used: no. of ip addresses allocated from the ip pool. + :ivar used: Number of IP addresses allocated from the IP Pool. :vartype used: str - :ivar available: no. of ip addresses available in the ip pool. + :ivar available: Number of IP addresses available in the IP Pool. :vartype available: str """ @@ -2089,293 +1357,238 @@ class IPPoolInfo(_serialization.Model): "available": {"key": "available", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.used = None self.available = None -class MachineExtension(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Describes a Machine Extension. +class LogicalNetworkPropertiesDhcpOptions(_serialization.Model): + """DhcpOptions contains an array of DNS servers available to VMs deployed in the logical network. + Standard DHCP option for a subnet overrides logical network DHCP options. + + :ivar dns_servers: The list of DNS servers IP addresses. + :vartype dns_servers: list[str] + """ + + _attribute_map = { + "dns_servers": {"key": "dnsServers", "type": "[str]"}, + } + + def __init__(self, *, dns_servers: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword dns_servers: The list of DNS servers IP addresses. + :paramtype dns_servers: list[str] + """ + super().__init__(**kwargs) + self.dns_servers = dns_servers + + +class LogicalNetworks(TrackedResource): # pylint: disable=too-many-instance-attributes + """The logical network resource definition. Variables are only populated by the server, and will be ignored when sending a request. - :ivar location: The geo-location where the resource lives. - :vartype location: str - :ivar system_data: The system data. - :vartype system_data: ~azure.mgmt.azurestackhci.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] + 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 id: Fully qualified resource ID for the resource. - :vartype id: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: 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 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.azurestackhci.models.MachineExtensionPropertiesInstanceView + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.azurestackhci.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 extended_location: The extendedLocation of the resource. + :vartype extended_location: ~azure.mgmt.azurestackhci.models.ExtendedLocation + :ivar dhcp_options: DhcpOptions contains an array of DNS servers available to VMs deployed in + the logical network. Standard DHCP option for a subnet overrides logical network DHCP options. + :vartype dhcp_options: ~azure.mgmt.azurestackhci.models.LogicalNetworkPropertiesDhcpOptions + :ivar subnets: Subnet - list of subnets under the logical network. + :vartype subnets: list[~azure.mgmt.azurestackhci.models.Subnet] + :ivar provisioning_state: Provisioning state of the logical network. Known values are: + "Succeeded", "Failed", "InProgress", "Accepted", "Deleting", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.azurestackhci.models.ProvisioningStateEnum + :ivar vm_switch_name: name of the network switch to be used for VMs. + :vartype vm_switch_name: str + :ivar status: The observed state of logical networks. + :vartype status: ~azure.mgmt.azurestackhci.models.LogicalNetworkStatus """ _validation = { - "system_data": {"readonly": True}, - "name": {"readonly": True}, "id": {"readonly": True}, + "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, "provisioning_state": {"readonly": True}, + "status": {"readonly": True}, } _attribute_map = { - "location": {"key": "location", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "name": {"key": "name", "type": "str"}, "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, "type": {"key": "type", "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"}, - "auto_upgrade_minor_version": {"key": "properties.autoUpgradeMinorVersion", "type": "bool"}, - "settings": {"key": "properties.settings", "type": "object"}, - "protected_settings": {"key": "properties.protectedSettings", "type": "object"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "dhcp_options": {"key": "properties.dhcpOptions", "type": "LogicalNetworkPropertiesDhcpOptions"}, + "subnets": {"key": "properties.subnets", "type": "[Subnet]"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "instance_view": {"key": "properties.instanceView", "type": "MachineExtensionPropertiesInstanceView"}, + "vm_switch_name": {"key": "properties.vmSwitchName", "type": "str"}, + "status": {"key": "properties.status", "type": "LogicalNetworkStatus"}, } def __init__( self, *, - location: Optional[str] = None, + 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, - auto_upgrade_minor_version: Optional[bool] = None, - settings: Optional[JSON] = None, - protected_settings: Optional[JSON] = None, - instance_view: Optional["_models.MachineExtensionPropertiesInstanceView"] = None, - **kwargs - ): - """ - :keyword location: The geo-location where the resource lives. - :paramtype location: str + extended_location: Optional["_models.ExtendedLocation"] = None, + dhcp_options: Optional["_models.LogicalNetworkPropertiesDhcpOptions"] = None, + subnets: Optional[List["_models.Subnet"]] = None, + vm_switch_name: Optional[str] = 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_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 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.azurestackhci.models.MachineExtensionPropertiesInstanceView + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword extended_location: The extendedLocation of the resource. + :paramtype extended_location: ~azure.mgmt.azurestackhci.models.ExtendedLocation + :keyword dhcp_options: DhcpOptions contains an array of DNS servers available to VMs deployed + in the logical network. Standard DHCP option for a subnet overrides logical network DHCP + options. + :paramtype dhcp_options: ~azure.mgmt.azurestackhci.models.LogicalNetworkPropertiesDhcpOptions + :keyword subnets: Subnet - list of subnets under the logical network. + :paramtype subnets: list[~azure.mgmt.azurestackhci.models.Subnet] + :keyword vm_switch_name: name of the network switch to be used for VMs. + :paramtype vm_switch_name: str """ - super().__init__(**kwargs) - self.location = location - self.system_data = None - self.tags = tags - self.name = None - self.id = None - self.type = None - 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.auto_upgrade_minor_version = auto_upgrade_minor_version - self.settings = settings - self.protected_settings = protected_settings + super().__init__(tags=tags, location=location, **kwargs) + self.extended_location = extended_location + self.dhcp_options = dhcp_options + self.subnets = subnets self.provisioning_state = None - self.instance_view = instance_view - + self.vm_switch_name = vm_switch_name + self.status = None -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. +class LogicalNetworksListResult(_serialization.Model): + """LogicalNetworksListResult. - :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.azurestackhci.models.MachineExtensionInstanceViewStatus + :ivar value: + :vartype value: list[~azure.mgmt.azurestackhci.models.LogicalNetworks] + :ivar next_link: + :vartype next_link: str """ - _validation = { - "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"}, + "value": {"key": "value", "type": "[LogicalNetworks]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, status: Optional["_models.MachineExtensionInstanceViewStatus"] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.LogicalNetworks"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword status: Instance view status. - :paramtype status: ~azure.mgmt.azurestackhci.models.MachineExtensionInstanceViewStatus + :keyword value: + :paramtype value: list[~azure.mgmt.azurestackhci.models.LogicalNetworks] + :keyword next_link: + :paramtype next_link: str """ super().__init__(**kwargs) - self.name = None - self.type = None - self.type_handler_version = None - self.status = status - - -class MachineExtensionInstanceViewStatus(_serialization.Model): - """Instance view status. - - 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.azurestackhci.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 = { - "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, **kwargs): - """ """ - super().__init__(**kwargs) - self.code = None - self.level = None - self.display_status = None - self.message = None - self.time = None - + self.value = value + self.next_link = next_link -class MachineExtensionPropertiesInstanceView(MachineExtensionInstanceView): - """The machine extension instance view. - Variables are only populated by the server, and will be ignored when sending a request. +class LogicalNetworkStatus(_serialization.Model): + """The observed state of logical networks. - :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.azurestackhci.models.MachineExtensionInstanceViewStatus + :ivar error_code: LogicalNetwork provisioning error code. + :vartype error_code: str + :ivar error_message: Descriptive error message. + :vartype error_message: str + :ivar provisioning_status: + :vartype provisioning_status: + ~azure.mgmt.azurestackhci.models.LogicalNetworkStatusProvisioningStatus """ - _validation = { - "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"}, + "error_code": {"key": "errorCode", "type": "str"}, + "error_message": {"key": "errorMessage", "type": "str"}, + "provisioning_status": {"key": "provisioningStatus", "type": "LogicalNetworkStatusProvisioningStatus"}, } - def __init__(self, *, status: Optional["_models.MachineExtensionInstanceViewStatus"] = None, **kwargs): + def __init__( + self, + *, + error_code: Optional[str] = None, + error_message: Optional[str] = None, + provisioning_status: Optional["_models.LogicalNetworkStatusProvisioningStatus"] = None, + **kwargs: Any + ) -> None: """ - :keyword status: Instance view status. - :paramtype status: ~azure.mgmt.azurestackhci.models.MachineExtensionInstanceViewStatus + :keyword error_code: LogicalNetwork provisioning error code. + :paramtype error_code: str + :keyword error_message: Descriptive error message. + :paramtype error_message: str + :keyword provisioning_status: + :paramtype provisioning_status: + ~azure.mgmt.azurestackhci.models.LogicalNetworkStatusProvisioningStatus """ - super().__init__(status=status, **kwargs) + super().__init__(**kwargs) + self.error_code = error_code + self.error_message = error_message + self.provisioning_status = provisioning_status -class MachineExtensionsListResult(_serialization.Model): - """Describes the Machine Extensions List Result. +class LogicalNetworkStatusProvisioningStatus(_serialization.Model): + """LogicalNetworkStatusProvisioningStatus. - :ivar value: The list of extensions. - :vartype value: list[~azure.mgmt.azurestackhci.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 + :ivar operation_id: The ID of the operation performed on the logical network. + :vartype operation_id: str + :ivar status: The status of the operation performed on the logical network [Succeeded, Failed, + InProgress]. Known values are: "Succeeded", "Failed", and "InProgress". + :vartype status: str or ~azure.mgmt.azurestackhci.models.Status """ _attribute_map = { - "value": {"key": "value", "type": "[MachineExtension]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "operation_id": {"key": "operationId", "type": "str"}, + "status": {"key": "status", "type": "str"}, } def __init__( - self, *, value: Optional[List["_models.MachineExtension"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + operation_id: Optional[str] = None, + status: Optional[Union[str, "_models.Status"]] = None, + **kwargs: Any + ) -> None: """ - :keyword value: The list of extensions. - :paramtype value: list[~azure.mgmt.azurestackhci.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 operation_id: The ID of the operation performed on the logical network. + :paramtype operation_id: str + :keyword status: The status of the operation performed on the logical network [Succeeded, + Failed, InProgress]. Known values are: "Succeeded", "Failed", and "InProgress". + :paramtype status: str or ~azure.mgmt.azurestackhci.models.Status """ super().__init__(**kwargs) - self.value = value - self.next_link = next_link + self.operation_id = operation_id + self.status = status -class ResourcePatch(_serialization.Model): - """Object containing updates for patch operations. +class LogicalNetworksUpdateRequest(_serialization.Model): + """The logical network resource patch definition. :ivar tags: Resource tags. :vartype tags: dict[str, str] @@ -2385,7 +1598,7 @@ class ResourcePatch(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -2394,88 +1607,7 @@ def __init__(self, *, tags: Optional[Dict[str, str]] = None, **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 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"}, - "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, - auto_upgrade_minor_version: Optional[bool] = None, - settings: Optional[JSON] = None, - protected_settings: Optional[JSON] = None, - **kwargs - ): - """ - :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 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.auto_upgrade_minor_version = auto_upgrade_minor_version - self.settings = settings - self.protected_settings = protected_settings - - -class Marketplacegalleryimages(TrackedResource): # pylint: disable=too-many-instance-attributes +class MarketplaceGalleryImages(TrackedResource): # pylint: disable=too-many-instance-attributes """The marketplace gallery image resource definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -2490,21 +1622,23 @@ class Marketplacegalleryimages(TrackedResource): # pylint: disable=too-many-ins :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.azurestackhci.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 extended_location: The extendedLocation of the resource. :vartype extended_location: ~azure.mgmt.azurestackhci.models.ExtendedLocation - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.azurestackhci.models.SystemData - :ivar container_name: Container Name for storage container. - :vartype container_name: str - :ivar os_type: operating system type that the gallery image uses. Expected to be linux or - windows. Known values are: "Windows" and "Linux". + :ivar container_id: Storage ContainerID of the storage container to be used for marketplace + gallery image. + :vartype container_id: str + :ivar os_type: Operating system type that the gallery image uses [Windows, Linux]. Known values + are: "Windows" and "Linux". :vartype os_type: str or ~azure.mgmt.azurestackhci.models.OperatingSystemTypes :ivar cloud_init_data_source: Datasource for the gallery image when provisioning with - cloud-init [Azure, NoCloud]. Known values are: "NoCloud" and "Azure". + cloud-init [NoCloud, Azure]. Known values are: "NoCloud" and "Azure". :vartype cloud_init_data_source: str or ~azure.mgmt.azurestackhci.models.CloudInitDataSource :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine [V1, V2]. Known values are: "V1" and "V2". @@ -2514,13 +1648,10 @@ class Marketplacegalleryimages(TrackedResource): # pylint: disable=too-many-ins :ivar version: Specifies information about the gallery image version that you want to create or update. :vartype version: ~azure.mgmt.azurestackhci.models.GalleryImageVersion - :ivar provisioning_state: Provisioning state of the gallery image. Known values are: - "Succeeded", "Failed", "InProgress", "Accepted", "Deleting", and "Canceled". + :ivar provisioning_state: Provisioning state of the marketplace gallery image. Known values + are: "Succeeded", "Failed", "InProgress", "Accepted", "Deleting", and "Canceled". :vartype provisioning_state: str or ~azure.mgmt.azurestackhci.models.ProvisioningStateEnum - :ivar resource_name: name of the object to be used in moc. - :vartype resource_name: str - :ivar status: MarketplaceGalleryImageStatus defines the observed state of - marketplacegalleryimages. + :ivar status: The observed state of marketplace gallery images. :vartype status: ~azure.mgmt.azurestackhci.models.MarketplaceGalleryImageStatus """ @@ -2528,8 +1659,8 @@ class Marketplacegalleryimages(TrackedResource): # pylint: disable=too-many-ins "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "location": {"required": True}, "system_data": {"readonly": True}, + "location": {"required": True}, "provisioning_state": {"readonly": True}, "status": {"readonly": True}, } @@ -2538,18 +1669,17 @@ class Marketplacegalleryimages(TrackedResource): # pylint: disable=too-many-ins "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"}, "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "container_name": {"key": "properties.containerName", "type": "str"}, + "container_id": {"key": "properties.containerId", "type": "str"}, "os_type": {"key": "properties.osType", "type": "str"}, "cloud_init_data_source": {"key": "properties.cloudInitDataSource", "type": "str"}, "hyper_v_generation": {"key": "properties.hyperVGeneration", "type": "str"}, "identifier": {"key": "properties.identifier", "type": "GalleryImageIdentifier"}, "version": {"key": "properties.version", "type": "GalleryImageVersion"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "resource_name": {"key": "properties.resourceName", "type": "str"}, "status": {"key": "properties.status", "type": "MarketplaceGalleryImageStatus"}, } @@ -2559,15 +1689,14 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, extended_location: Optional["_models.ExtendedLocation"] = None, - container_name: Optional[str] = None, + container_id: Optional[str] = None, os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = None, cloud_init_data_source: Optional[Union[str, "_models.CloudInitDataSource"]] = None, hyper_v_generation: Optional[Union[str, "_models.HyperVGeneration"]] = None, identifier: Optional["_models.GalleryImageIdentifier"] = None, version: Optional["_models.GalleryImageVersion"] = None, - resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -2575,13 +1704,14 @@ def __init__( :paramtype location: str :keyword extended_location: The extendedLocation of the resource. :paramtype extended_location: ~azure.mgmt.azurestackhci.models.ExtendedLocation - :keyword container_name: Container Name for storage container. - :paramtype container_name: str - :keyword os_type: operating system type that the gallery image uses. Expected to be linux or - windows. Known values are: "Windows" and "Linux". + :keyword container_id: Storage ContainerID of the storage container to be used for marketplace + gallery image. + :paramtype container_id: str + :keyword os_type: Operating system type that the gallery image uses [Windows, Linux]. Known + values are: "Windows" and "Linux". :paramtype os_type: str or ~azure.mgmt.azurestackhci.models.OperatingSystemTypes :keyword cloud_init_data_source: Datasource for the gallery image when provisioning with - cloud-init [Azure, NoCloud]. Known values are: "NoCloud" and "Azure". + cloud-init [NoCloud, Azure]. Known values are: "NoCloud" and "Azure". :paramtype cloud_init_data_source: str or ~azure.mgmt.azurestackhci.models.CloudInitDataSource :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine [V1, V2]. Known values are: "V1" and "V2". @@ -2591,84 +1721,62 @@ def __init__( :keyword version: Specifies information about the gallery image version that you want to create or update. :paramtype version: ~azure.mgmt.azurestackhci.models.GalleryImageVersion - :keyword resource_name: name of the object to be used in moc. - :paramtype resource_name: str """ super().__init__(tags=tags, location=location, **kwargs) self.extended_location = extended_location - self.system_data = None - self.container_name = container_name + self.container_id = container_id self.os_type = os_type self.cloud_init_data_source = cloud_init_data_source self.hyper_v_generation = hyper_v_generation self.identifier = identifier self.version = version self.provisioning_state = None - self.resource_name = resource_name self.status = None -class MarketplacegalleryimagesListResult(_serialization.Model): - """List of marketplacegalleryimages. - - Variables are only populated by the server, and will be ignored when sending a request. +class MarketplaceGalleryImagesListResult(_serialization.Model): + """MarketplaceGalleryImagesListResult. - :ivar value: The itemed list of marketplacegalleryimages. - :vartype value: list[~azure.mgmt.azurestackhci.models.Marketplacegalleryimages] - :ivar next_link: Link to the next set of results. + :ivar value: + :vartype value: list[~azure.mgmt.azurestackhci.models.MarketplaceGalleryImages] + :ivar next_link: :vartype next_link: str """ - _validation = { - "next_link": {"readonly": True}, - } - _attribute_map = { - "value": {"key": "value", "type": "[Marketplacegalleryimages]"}, + "value": {"key": "value", "type": "[MarketplaceGalleryImages]"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Marketplacegalleryimages"]] = None, **kwargs): + def __init__( + self, + *, + value: Optional[List["_models.MarketplaceGalleryImages"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword value: The itemed list of marketplacegalleryimages. - :paramtype value: list[~azure.mgmt.azurestackhci.models.Marketplacegalleryimages] + :keyword value: + :paramtype value: list[~azure.mgmt.azurestackhci.models.MarketplaceGalleryImages] + :keyword next_link: + :paramtype next_link: str """ super().__init__(**kwargs) self.value = value - self.next_link = None - - -class MarketplacegalleryimagesPatch(_serialization.Model): - """The marketplace gallery image resource patch definition. - - :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 + self.next_link = next_link class MarketplaceGalleryImageStatus(_serialization.Model): - """MarketplaceGalleryImageStatus defines the observed state of marketplacegalleryimages. + """The observed state of marketplace gallery images. - :ivar error_code: Marketplace gallery image provisioning error code. + :ivar error_code: MarketplaceGalleryImage provisioning error code. :vartype error_code: str :ivar error_message: Descriptive error message. :vartype error_message: str - :ivar provisioning_status: The provisioning status of the marketplace gallery image. + :ivar provisioning_status: :vartype provisioning_status: ~azure.mgmt.azurestackhci.models.MarketplaceGalleryImageStatusProvisioningStatus - :ivar download_status: The download status of the marketplace gallery image. + :ivar download_status: The download status of the gallery image. :vartype download_status: ~azure.mgmt.azurestackhci.models.MarketplaceGalleryImageStatusDownloadStatus :ivar progress_percentage: The progress of the operation in percentage. @@ -2691,17 +1799,17 @@ def __init__( provisioning_status: Optional["_models.MarketplaceGalleryImageStatusProvisioningStatus"] = None, download_status: Optional["_models.MarketplaceGalleryImageStatusDownloadStatus"] = None, progress_percentage: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword error_code: Marketplace gallery image provisioning error code. + :keyword error_code: MarketplaceGalleryImage provisioning error code. :paramtype error_code: str :keyword error_message: Descriptive error message. :paramtype error_message: str - :keyword provisioning_status: The provisioning status of the marketplace gallery image. + :keyword provisioning_status: :paramtype provisioning_status: ~azure.mgmt.azurestackhci.models.MarketplaceGalleryImageStatusProvisioningStatus - :keyword download_status: The download status of the marketplace gallery image. + :keyword download_status: The download status of the gallery image. :paramtype download_status: ~azure.mgmt.azurestackhci.models.MarketplaceGalleryImageStatusDownloadStatus :keyword progress_percentage: The progress of the operation in percentage. @@ -2716,7 +1824,7 @@ def __init__( class MarketplaceGalleryImageStatusDownloadStatus(_serialization.Model): - """The download status of the marketplace gallery image. + """The download status of the gallery image. :ivar download_size_in_mb: The downloaded sized of the image in MB. :vartype download_size_in_mb: int @@ -2726,7 +1834,7 @@ class MarketplaceGalleryImageStatusDownloadStatus(_serialization.Model): "download_size_in_mb": {"key": "downloadSizeInMB", "type": "int"}, } - def __init__(self, *, download_size_in_mb: Optional[int] = None, **kwargs): + def __init__(self, *, download_size_in_mb: Optional[int] = None, **kwargs: Any) -> None: """ :keyword download_size_in_mb: The downloaded sized of the image in MB. :paramtype download_size_in_mb: int @@ -2736,13 +1844,13 @@ def __init__(self, *, download_size_in_mb: Optional[int] = None, **kwargs): class MarketplaceGalleryImageStatusProvisioningStatus(_serialization.Model): - """The provisioning status of the marketplace gallery image. + """MarketplaceGalleryImageStatusProvisioningStatus. - :ivar operation_id: The ID of the operation performed on the marketplace gallery image. + :ivar operation_id: The ID of the operation performed on the gallery image. :vartype operation_id: str - :ivar status: The status of the operation performed on the marketplace gallery image - [Succeeded, Failed, InProgress]. Known values are: "Succeeded", "Failed", and "InProgress". - :vartype status: str or ~azure.mgmt.azurestackhci.models.ProvisioningStatusEnum + :ivar status: The status of the operation performed on the gallery image [Succeeded, Failed, + InProgress]. Known values are: "Succeeded", "Failed", and "InProgress". + :vartype status: str or ~azure.mgmt.azurestackhci.models.Status """ _attribute_map = { @@ -2754,22 +1862,42 @@ def __init__( self, *, operation_id: Optional[str] = None, - status: Optional[Union[str, "_models.ProvisioningStatusEnum"]] = None, - **kwargs - ): + status: Optional[Union[str, "_models.Status"]] = None, + **kwargs: Any + ) -> None: """ - :keyword operation_id: The ID of the operation performed on the marketplace gallery image. + :keyword operation_id: The ID of the operation performed on the gallery image. :paramtype operation_id: str - :keyword status: The status of the operation performed on the marketplace gallery image - [Succeeded, Failed, InProgress]. Known values are: "Succeeded", "Failed", and "InProgress". - :paramtype status: str or ~azure.mgmt.azurestackhci.models.ProvisioningStatusEnum + :keyword status: The status of the operation performed on the gallery image [Succeeded, Failed, + InProgress]. Known values are: "Succeeded", "Failed", and "InProgress". + :paramtype status: str or ~azure.mgmt.azurestackhci.models.Status """ super().__init__(**kwargs) self.operation_id = operation_id self.status = status -class Networkinterfaces(TrackedResource): # pylint: disable=too-many-instance-attributes +class MarketplaceGalleryImagesUpdateRequest(_serialization.Model): + """The marketplace gallery image resource patch definition. + + :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 NetworkInterfaces(TrackedResource): # pylint: disable=too-many-instance-attributes """The network interface resource definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -2784,27 +1912,26 @@ class Networkinterfaces(TrackedResource): # pylint: disable=too-many-instance-a :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.azurestackhci.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 extended_location: The extendedLocation of the resource. :vartype extended_location: ~azure.mgmt.azurestackhci.models.ExtendedLocation - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.azurestackhci.models.SystemData :ivar ip_configurations: IPConfigurations - A list of IPConfigurations of the network interface. - :vartype ip_configurations: list[~azure.mgmt.azurestackhci.models.IpConfiguration] + :vartype ip_configurations: list[~azure.mgmt.azurestackhci.models.IPConfiguration] :ivar mac_address: MacAddress - The MAC address of the network interface. :vartype mac_address: str :ivar dns_settings: DNS Settings for the interface. :vartype dns_settings: ~azure.mgmt.azurestackhci.models.InterfaceDNSSettings - :ivar provisioning_state: Provisioning state of the gallery image. Known values are: + :ivar provisioning_state: Provisioning state of the network interface. Known values are: "Succeeded", "Failed", "InProgress", "Accepted", "Deleting", and "Canceled". :vartype provisioning_state: str or ~azure.mgmt.azurestackhci.models.ProvisioningStateEnum - :ivar resource_name: name of the object to be used in moc. - :vartype resource_name: str - :ivar status: NetworkInterfaceStatus defines the observed state of network interfaces. + :ivar status: The observed state of network interfaces. :vartype status: ~azure.mgmt.azurestackhci.models.NetworkInterfaceStatus """ @@ -2812,8 +1939,8 @@ class Networkinterfaces(TrackedResource): # pylint: disable=too-many-instance-a "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "location": {"required": True}, "system_data": {"readonly": True}, + "location": {"required": True}, "provisioning_state": {"readonly": True}, "status": {"readonly": True}, } @@ -2822,15 +1949,14 @@ class Networkinterfaces(TrackedResource): # pylint: disable=too-many-instance-a "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"}, "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "ip_configurations": {"key": "properties.ipConfigurations", "type": "[IpConfiguration]"}, + "ip_configurations": {"key": "properties.ipConfigurations", "type": "[IPConfiguration]"}, "mac_address": {"key": "properties.macAddress", "type": "str"}, "dns_settings": {"key": "properties.dnsSettings", "type": "InterfaceDNSSettings"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "resource_name": {"key": "properties.resourceName", "type": "str"}, "status": {"key": "properties.status", "type": "NetworkInterfaceStatus"}, } @@ -2840,12 +1966,11 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, extended_location: Optional["_models.ExtendedLocation"] = None, - ip_configurations: Optional[List["_models.IpConfiguration"]] = None, + ip_configurations: Optional[List["_models.IPConfiguration"]] = None, mac_address: Optional[str] = None, dns_settings: Optional["_models.InterfaceDNSSettings"] = None, - resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -2855,45 +1980,45 @@ def __init__( :paramtype extended_location: ~azure.mgmt.azurestackhci.models.ExtendedLocation :keyword ip_configurations: IPConfigurations - A list of IPConfigurations of the network interface. - :paramtype ip_configurations: list[~azure.mgmt.azurestackhci.models.IpConfiguration] + :paramtype ip_configurations: list[~azure.mgmt.azurestackhci.models.IPConfiguration] :keyword mac_address: MacAddress - The MAC address of the network interface. :paramtype mac_address: str :keyword dns_settings: DNS Settings for the interface. :paramtype dns_settings: ~azure.mgmt.azurestackhci.models.InterfaceDNSSettings - :keyword resource_name: name of the object to be used in moc. - :paramtype resource_name: str """ super().__init__(tags=tags, location=location, **kwargs) self.extended_location = extended_location - self.system_data = None self.ip_configurations = ip_configurations self.mac_address = mac_address self.dns_settings = dns_settings self.provisioning_state = None - self.resource_name = resource_name self.status = None -class NetworkinterfacesListResult(_serialization.Model): - """NetworkinterfacesListResult. +class NetworkInterfacesListResult(_serialization.Model): + """NetworkInterfacesListResult. :ivar value: - :vartype value: list[~azure.mgmt.azurestackhci.models.Networkinterfaces] + :vartype value: list[~azure.mgmt.azurestackhci.models.NetworkInterfaces] :ivar next_link: :vartype next_link: str """ _attribute_map = { - "value": {"key": "value", "type": "[Networkinterfaces]"}, + "value": {"key": "value", "type": "[NetworkInterfaces]"}, "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, *, value: Optional[List["_models.Networkinterfaces"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.NetworkInterfaces"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: - :paramtype value: list[~azure.mgmt.azurestackhci.models.Networkinterfaces] + :paramtype value: list[~azure.mgmt.azurestackhci.models.NetworkInterfaces] :keyword next_link: :paramtype next_link: str """ @@ -2902,34 +2027,14 @@ def __init__( self.next_link = next_link -class NetworkinterfacesPatch(_serialization.Model): - """The network interface resource patch definition. - - :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 NetworkInterfaceStatus(_serialization.Model): - """NetworkInterfaceStatus defines the observed state of network interfaces. + """The observed state of network interfaces. :ivar error_code: NetworkInterface provisioning error code. :vartype error_code: str :ivar error_message: Descriptive error message. :vartype error_message: str - :ivar provisioning_status: The provisioning status of the network interface. + :ivar provisioning_status: :vartype provisioning_status: ~azure.mgmt.azurestackhci.models.NetworkInterfaceStatusProvisioningStatus """ @@ -2946,14 +2051,14 @@ def __init__( error_code: Optional[str] = None, error_message: Optional[str] = None, provisioning_status: Optional["_models.NetworkInterfaceStatusProvisioningStatus"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword error_code: NetworkInterface provisioning error code. :paramtype error_code: str :keyword error_message: Descriptive error message. :paramtype error_message: str - :keyword provisioning_status: The provisioning status of the network interface. + :keyword provisioning_status: :paramtype provisioning_status: ~azure.mgmt.azurestackhci.models.NetworkInterfaceStatusProvisioningStatus """ @@ -2964,13 +2069,13 @@ def __init__( class NetworkInterfaceStatusProvisioningStatus(_serialization.Model): - """The provisioning status of the network interface. + """NetworkInterfaceStatusProvisioningStatus. :ivar operation_id: The ID of the operation performed on the network interface. :vartype operation_id: str :ivar status: The status of the operation performed on the network interface [Succeeded, Failed, InProgress]. Known values are: "Succeeded", "Failed", and "InProgress". - :vartype status: str or ~azure.mgmt.azurestackhci.models.ProvisioningStatusEnum + :vartype status: str or ~azure.mgmt.azurestackhci.models.Status """ _attribute_map = { @@ -2982,26 +2087,46 @@ def __init__( self, *, operation_id: Optional[str] = None, - status: Optional[Union[str, "_models.ProvisioningStatusEnum"]] = None, - **kwargs - ): + status: Optional[Union[str, "_models.Status"]] = None, + **kwargs: Any + ) -> None: """ :keyword operation_id: The ID of the operation performed on the network interface. :paramtype operation_id: str :keyword status: The status of the operation performed on the network interface [Succeeded, Failed, InProgress]. Known values are: "Succeeded", "Failed", and "InProgress". - :paramtype status: str or ~azure.mgmt.azurestackhci.models.ProvisioningStatusEnum + :paramtype status: str or ~azure.mgmt.azurestackhci.models.Status """ super().__init__(**kwargs) self.operation_id = operation_id self.status = status +class NetworkInterfacesUpdateRequest(_serialization.Model): + """The network interface resource patch definition. + + :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 NetworkProfileUpdate(_serialization.Model): - """NetworkProfile - describes the network update configuration the virtual machine. + """NetworkProfile - describes the network update configuration the virtual machine instance. :ivar network_interfaces: NetworkInterfaces - list of network interfaces to be attached to the - virtual machine. + virtual machine instance. :vartype network_interfaces: list[~azure.mgmt.azurestackhci.models.NetworkProfileUpdateNetworkInterfacesItem] """ @@ -3014,11 +2139,11 @@ def __init__( self, *, network_interfaces: Optional[List["_models.NetworkProfileUpdateNetworkInterfacesItem"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword network_interfaces: NetworkInterfaces - list of network interfaces to be attached to - the virtual machine. + the virtual machine instance. :paramtype network_interfaces: list[~azure.mgmt.azurestackhci.models.NetworkProfileUpdateNetworkInterfacesItem] """ @@ -3037,7 +2162,7 @@ class NetworkProfileUpdateNetworkInterfacesItem(_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 - Resource ID of the network interface. :paramtype id: str @@ -3083,7 +2208,7 @@ class Operation(_serialization.Model): "action_type": {"key": "actionType", "type": "str"}, } - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: Localized display information for this particular operation. :paramtype display: ~azure.mgmt.azurestackhci.models.OperationDisplay @@ -3129,7 +2254,7 @@ class OperationDisplay(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None @@ -3139,7 +2264,8 @@ def __init__(self, **kwargs): class OperationListResult(_serialization.Model): - """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link + to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -3150,124 +2276,309 @@ class OperationListResult(_serialization.Model): """ _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class OsProfileUpdate(_serialization.Model): + """OsProfile - describes the update configuration of the operating system. + + :ivar computer_name: ComputerName - name of the computer. + :vartype computer_name: str + :ivar linux_configuration: + :vartype linux_configuration: + ~azure.mgmt.azurestackhci.models.OsProfileUpdateLinuxConfiguration + :ivar windows_configuration: + :vartype windows_configuration: + ~azure.mgmt.azurestackhci.models.OsProfileUpdateWindowsConfiguration + """ + + _attribute_map = { + "computer_name": {"key": "computerName", "type": "str"}, + "linux_configuration": {"key": "linuxConfiguration", "type": "OsProfileUpdateLinuxConfiguration"}, + "windows_configuration": {"key": "windowsConfiguration", "type": "OsProfileUpdateWindowsConfiguration"}, + } + + def __init__( + self, + *, + computer_name: Optional[str] = None, + linux_configuration: Optional["_models.OsProfileUpdateLinuxConfiguration"] = None, + windows_configuration: Optional["_models.OsProfileUpdateWindowsConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword computer_name: ComputerName - name of the computer. + :paramtype computer_name: str + :keyword linux_configuration: + :paramtype linux_configuration: + ~azure.mgmt.azurestackhci.models.OsProfileUpdateLinuxConfiguration + :keyword windows_configuration: + :paramtype windows_configuration: + ~azure.mgmt.azurestackhci.models.OsProfileUpdateWindowsConfiguration + """ + super().__init__(**kwargs) + self.computer_name = computer_name + self.linux_configuration = linux_configuration + self.windows_configuration = windows_configuration + + +class OsProfileUpdateLinuxConfiguration(_serialization.Model): + """OsProfileUpdateLinuxConfiguration. + + :ivar provision_vm_agent: Used to indicate whether Arc for Servers agent onboarding should be + triggered during the virtual machine instance creation process. + :vartype provision_vm_agent: bool + :ivar provision_vm_config_agent: Used to indicate whether the VM Config Agent should be + installed during the virtual machine creation process. + :vartype provision_vm_config_agent: bool + """ + + _attribute_map = { + "provision_vm_agent": {"key": "provisionVMAgent", "type": "bool"}, + "provision_vm_config_agent": {"key": "provisionVMConfigAgent", "type": "bool"}, + } + + def __init__( + self, + *, + provision_vm_agent: Optional[bool] = None, + provision_vm_config_agent: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword provision_vm_agent: Used to indicate whether Arc for Servers agent onboarding should + be triggered during the virtual machine instance creation process. + :paramtype provision_vm_agent: bool + :keyword provision_vm_config_agent: Used to indicate whether the VM Config Agent should be + installed during the virtual machine creation process. + :paramtype provision_vm_config_agent: bool + """ + super().__init__(**kwargs) + self.provision_vm_agent = provision_vm_agent + self.provision_vm_config_agent = provision_vm_config_agent + + +class OsProfileUpdateWindowsConfiguration(_serialization.Model): + """OsProfileUpdateWindowsConfiguration. + + :ivar provision_vm_agent: Used to indicate whether Arc for Servers agent onboarding should be + triggered during the virtual machine instance creation process. + :vartype provision_vm_agent: bool + :ivar provision_vm_config_agent: Used to indicate whether the VM Config Agent should be + installed during the virtual machine creation process. + :vartype provision_vm_config_agent: bool + """ + + _attribute_map = { + "provision_vm_agent": {"key": "provisionVMAgent", "type": "bool"}, + "provision_vm_config_agent": {"key": "provisionVMConfigAgent", "type": "bool"}, + } + + def __init__( + self, + *, + provision_vm_agent: Optional[bool] = None, + provision_vm_config_agent: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword provision_vm_agent: Used to indicate whether Arc for Servers agent onboarding should + be triggered during the virtual machine instance creation process. + :paramtype provision_vm_agent: bool + :keyword provision_vm_config_agent: Used to indicate whether the VM Config Agent should be + installed during the virtual machine creation process. + :paramtype provision_vm_config_agent: bool + """ + super().__init__(**kwargs) + self.provision_vm_agent = provision_vm_agent + self.provision_vm_config_agent = provision_vm_config_agent + + +class Route(_serialization.Model): + """Route - Route resource. + + :ivar name: Name - name of the subnet. + :vartype name: str + :ivar address_prefix: The destination CIDR to which the route applies. + :vartype address_prefix: str + :ivar next_hop_ip_address: The IP address packets should be forwarded to. Next hop values are + only allowed in routes where the next hop type is VirtualAppliance. + :vartype next_hop_ip_address: str + """ + + _validation = { + "name": {"pattern": r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[_a-zA-Z0-9]$"}, } _attribute_map = { - "value": {"key": "value", "type": "[Operation]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "address_prefix": {"key": "properties.addressPrefix", "type": "str"}, + "next_hop_ip_address": {"key": "properties.nextHopIpAddress", "type": "str"}, } - def __init__(self, **kwargs): - """ """ + def __init__( + self, + *, + name: Optional[str] = None, + address_prefix: Optional[str] = None, + next_hop_ip_address: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name - name of the subnet. + :paramtype name: str + :keyword address_prefix: The destination CIDR to which the route applies. + :paramtype address_prefix: str + :keyword next_hop_ip_address: The IP address packets should be forwarded to. Next hop values + are only allowed in routes where the next hop type is VirtualAppliance. + :paramtype next_hop_ip_address: str + """ super().__init__(**kwargs) - self.value = None - self.next_link = None + self.name = name + self.address_prefix = address_prefix + self.next_hop_ip_address = next_hop_ip_address -class PerNodeExtensionState(_serialization.Model): - """Status of Arc Extension for a particular node in HCI Cluster. +class RouteTable(_serialization.Model): + """Route table resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: Name of the node in HCI Cluster. + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar name: Resource name. :vartype name: str - :ivar extension: Fully qualified resource ID for the particular Arc Extension on this node. - :vartype extension: str - :ivar state: State of Arc Extension in this node. Known values are: "NotSpecified", "Error", - "Succeeded", "Canceled", "Failed", "Connected", "Disconnected", "Deleted", "Creating", - "Updating", "Deleting", and "Moving". - :vartype state: str or ~azure.mgmt.azurestackhci.models.NodeExtensionState + :ivar type: Resource type. + :vartype type: str + :ivar routes: Collection of routes contained within a route table. + :vartype routes: list[~azure.mgmt.azurestackhci.models.Route] """ _validation = { + "etag": {"readonly": True}, "name": {"readonly": True}, - "extension": {"readonly": True}, - "state": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { + "etag": {"key": "etag", "type": "str"}, "name": {"key": "name", "type": "str"}, - "extension": {"key": "extension", "type": "str"}, - "state": {"key": "state", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "routes": {"key": "properties.routes", "type": "[Route]"}, } - def __init__(self, **kwargs): - """ """ + def __init__(self, *, routes: Optional[List["_models.Route"]] = None, **kwargs: Any) -> None: + """ + :keyword routes: Collection of routes contained within a route table. + :paramtype routes: list[~azure.mgmt.azurestackhci.models.Route] + """ super().__init__(**kwargs) + self.etag = None self.name = None - self.extension = None - self.state = None - + self.type = None + self.routes = routes -class PerNodeState(_serialization.Model): - """Status of Arc agent for a particular node in HCI Cluster. - Variables are only populated by the server, and will be ignored when sending a request. +class SshConfiguration(_serialization.Model): + """SSH configuration for Linux based VMs running on Azure. - :ivar name: Name of the Node in HCI Cluster. - :vartype name: str - :ivar arc_instance: Fully qualified resource ID for the Arc agent of this node. - :vartype arc_instance: str - :ivar state: State of Arc agent in this node. Known values are: "NotSpecified", "Error", - "Succeeded", "Canceled", "Failed", "Connected", "Disconnected", "Deleted", "Creating", - "Updating", "Deleting", and "Moving". - :vartype state: str or ~azure.mgmt.azurestackhci.models.NodeArcState + :ivar public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :vartype public_keys: list[~azure.mgmt.azurestackhci.models.SshPublicKey] """ - _validation = { - "name": {"readonly": True}, - "arc_instance": {"readonly": True}, - "state": {"readonly": True}, + _attribute_map = { + "public_keys": {"key": "publicKeys", "type": "[SshPublicKey]"}, } + def __init__(self, *, public_keys: Optional[List["_models.SshPublicKey"]] = None, **kwargs: Any) -> None: + """ + :keyword public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :paramtype public_keys: list[~azure.mgmt.azurestackhci.models.SshPublicKey] + """ + super().__init__(**kwargs) + self.public_keys = public_keys + + +class SshPublicKey(_serialization.Model): + """Contains information about SSH certificate public key and the path on the Linux VM where the + public key is placed. + + :ivar path: Specifies the full path on the created VM where ssh public key is stored. If the + file already exists, the specified key is appended to the file. Example: + /home/user/.ssh/authorized_keys. + :vartype path: str + :ivar key_data: SSH public key certificate used to authenticate with the VM through ssh. The + key needs to be at least 2048-bit and in ssh-rsa format. :code:`
`:code:`
` For creating + ssh keys, see [Create SSH keys on Linux and Mac for Linux VMs in + Azure]https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). + :vartype key_data: str + """ + _attribute_map = { - "name": {"key": "name", "type": "str"}, - "arc_instance": {"key": "arcInstance", "type": "str"}, - "state": {"key": "state", "type": "str"}, + "path": {"key": "path", "type": "str"}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__(self, **kwargs): - """ """ + def __init__(self, *, path: Optional[str] = None, key_data: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword path: Specifies the full path on the created VM where ssh public key is stored. If the + file already exists, the specified key is appended to the file. Example: + /home/user/.ssh/authorized_keys. + :paramtype path: str + :keyword key_data: SSH public key certificate used to authenticate with the VM through ssh. The + key needs to be at least 2048-bit and in ssh-rsa format. :code:`
`:code:`
` For creating + ssh keys, see [Create SSH keys on Linux and Mac for Linux VMs in + Azure]https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). + :paramtype key_data: str + """ super().__init__(**kwargs) - self.name = None - self.arc_instance = None - self.state = None + self.path = path + self.key_data = key_data -class Storagecontainers(_serialization.Model): # pylint: disable=too-many-instance-attributes +class StorageContainers(TrackedResource): """The storage container resource definition. 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: Resource Id. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource Name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource Type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: The resource location. Required. - :vartype location: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.azurestackhci.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.azurestackhci.models.SystemData - :ivar extended_location: - :vartype extended_location: ~azure.mgmt.azurestackhci.models.StoragecontainersExtendedLocation + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar extended_location: The extendedLocation of the resource. + :vartype extended_location: ~azure.mgmt.azurestackhci.models.ExtendedLocation :ivar path: Path of the storage container on the disk. :vartype path: str - :ivar provisioning_state: - :vartype provisioning_state: str - :ivar resource_name: name of the object to be used in moc. - :vartype resource_name: str - :ivar available_size_mb: Amount of space available on the disk in MB. - :vartype available_size_mb: int - :ivar container_size_mb: Total size of the disk in MB. - :vartype container_size_mb: int - :ivar status: storageContainerStatus defines the observed state of storagecontainers. + :ivar provisioning_state: Provisioning state of the storage container. Known values are: + "Succeeded", "Failed", "InProgress", "Accepted", "Deleting", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.azurestackhci.models.ProvisioningStateEnum + :ivar status: The observed state of storage containers. :vartype status: ~azure.mgmt.azurestackhci.models.StorageContainerStatus """ @@ -3275,10 +2586,9 @@ class Storagecontainers(_serialization.Model): # pylint: disable=too-many-insta "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "location": {"required": True}, "system_data": {"readonly": True}, - "available_size_mb": {"readonly": True}, - "container_size_mb": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, "status": {"readonly": True}, } @@ -3286,15 +2596,12 @@ class Storagecontainers(_serialization.Model): # pylint: disable=too-many-insta "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "extended_location": {"key": "extendedLocation", "type": "StoragecontainersExtendedLocation"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, "path": {"key": "properties.path", "type": "str"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "resource_name": {"key": "properties.resourceName", "type": "str"}, - "available_size_mb": {"key": "properties.availableSizeMB", "type": "int"}, - "container_size_mb": {"key": "properties.containerSizeMB", "type": "int"}, "status": {"key": "properties.status", "type": "StorageContainerStatus"}, } @@ -3303,89 +2610,51 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - extended_location: Optional["_models.StoragecontainersExtendedLocation"] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, path: Optional[str] = None, - provisioning_state: Optional[str] = None, - resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword location: The resource location. Required. - :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword extended_location: - :paramtype extended_location: - ~azure.mgmt.azurestackhci.models.StoragecontainersExtendedLocation + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword extended_location: The extendedLocation of the resource. + :paramtype extended_location: ~azure.mgmt.azurestackhci.models.ExtendedLocation :keyword path: Path of the storage container on the disk. :paramtype path: str - :keyword provisioning_state: - :paramtype provisioning_state: str - :keyword resource_name: name of the object to be used in moc. - :paramtype resource_name: str """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = location - self.tags = tags - self.system_data = None + super().__init__(tags=tags, location=location, **kwargs) self.extended_location = extended_location self.path = path - self.provisioning_state = provisioning_state - self.resource_name = resource_name - self.available_size_mb = None - self.container_size_mb = None + self.provisioning_state = None self.status = None -class StoragecontainersExtendedLocation(_serialization.Model): - """StoragecontainersExtendedLocation. - - :ivar type: The extended location type. - :vartype type: str - :ivar name: The extended location name. - :vartype name: str - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, type: Optional[str] = None, name: Optional[str] = None, **kwargs): - """ - :keyword type: The extended location type. - :paramtype type: str - :keyword name: The extended location name. - :paramtype name: str - """ - super().__init__(**kwargs) - self.type = type - self.name = name - - -class StoragecontainersListResult(_serialization.Model): - """StoragecontainersListResult. +class StorageContainersListResult(_serialization.Model): + """StorageContainersListResult. :ivar value: - :vartype value: list[~azure.mgmt.azurestackhci.models.Storagecontainers] + :vartype value: list[~azure.mgmt.azurestackhci.models.StorageContainers] :ivar next_link: :vartype next_link: str """ _attribute_map = { - "value": {"key": "value", "type": "[Storagecontainers]"}, + "value": {"key": "value", "type": "[StorageContainers]"}, "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, *, value: Optional[List["_models.Storagecontainers"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.StorageContainers"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: - :paramtype value: list[~azure.mgmt.azurestackhci.models.Storagecontainers] + :paramtype value: list[~azure.mgmt.azurestackhci.models.StorageContainers] :keyword next_link: :paramtype next_link: str """ @@ -3394,28 +2663,8 @@ def __init__( self.next_link = next_link -class StoragecontainersPatch(_serialization.Model): - """The storage container resource patch definition. - - :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 StorageContainerStatus(_serialization.Model): - """storageContainerStatus defines the observed state of storagecontainers. + """The observed state of storage containers. :ivar error_code: StorageContainer provisioning error code. :vartype error_code: str @@ -3425,7 +2674,7 @@ class StorageContainerStatus(_serialization.Model): :vartype available_size_mb: int :ivar container_size_mb: Total size of the disk in MB. :vartype container_size_mb: int - :ivar provisioning_status: The provisioning status of the storage container. + :ivar provisioning_status: :vartype provisioning_status: ~azure.mgmt.azurestackhci.models.StorageContainerStatusProvisioningStatus """ @@ -3446,8 +2695,8 @@ def __init__( available_size_mb: Optional[int] = None, container_size_mb: Optional[int] = None, provisioning_status: Optional["_models.StorageContainerStatusProvisioningStatus"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword error_code: StorageContainer provisioning error code. :paramtype error_code: str @@ -3457,7 +2706,7 @@ def __init__( :paramtype available_size_mb: int :keyword container_size_mb: Total size of the disk in MB. :paramtype container_size_mb: int - :keyword provisioning_status: The provisioning status of the storage container. + :keyword provisioning_status: :paramtype provisioning_status: ~azure.mgmt.azurestackhci.models.StorageContainerStatusProvisioningStatus """ @@ -3470,13 +2719,13 @@ def __init__( class StorageContainerStatusProvisioningStatus(_serialization.Model): - """The provisioning status of the storage container. + """StorageContainerStatusProvisioningStatus. :ivar operation_id: The ID of the operation performed on the storage container. :vartype operation_id: str :ivar status: The status of the operation performed on the storage container [Succeeded, Failed, InProgress]. Known values are: "Succeeded", "Failed", and "InProgress". - :vartype status: str or ~azure.mgmt.azurestackhci.models.ProvisioningStatusEnum + :vartype status: str or ~azure.mgmt.azurestackhci.models.Status """ _attribute_map = { @@ -3488,25 +2737,45 @@ def __init__( self, *, operation_id: Optional[str] = None, - status: Optional[Union[str, "_models.ProvisioningStatusEnum"]] = None, - **kwargs - ): + status: Optional[Union[str, "_models.Status"]] = None, + **kwargs: Any + ) -> None: """ :keyword operation_id: The ID of the operation performed on the storage container. :paramtype operation_id: str :keyword status: The status of the operation performed on the storage container [Succeeded, Failed, InProgress]. Known values are: "Succeeded", "Failed", and "InProgress". - :paramtype status: str or ~azure.mgmt.azurestackhci.models.ProvisioningStatusEnum + :paramtype status: str or ~azure.mgmt.azurestackhci.models.Status """ super().__init__(**kwargs) self.operation_id = operation_id self.status = status +class StorageContainersUpdateRequest(_serialization.Model): + """The storage container resource patch definition. + + :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 StorageProfileUpdate(_serialization.Model): """StorageProfileUpdate. - :ivar data_disks: adds data disks to the virtual machine for the update call. + :ivar data_disks: adds data disks to the virtual machine instance for the update call. :vartype data_disks: list[~azure.mgmt.azurestackhci.models.StorageProfileUpdateDataDisksItem] """ @@ -3514,33 +2783,146 @@ class StorageProfileUpdate(_serialization.Model): "data_disks": {"key": "dataDisks", "type": "[StorageProfileUpdateDataDisksItem]"}, } - def __init__(self, *, data_disks: Optional[List["_models.StorageProfileUpdateDataDisksItem"]] = None, **kwargs): + def __init__( + self, *, data_disks: Optional[List["_models.StorageProfileUpdateDataDisksItem"]] = None, **kwargs: Any + ) -> None: """ - :keyword data_disks: adds data disks to the virtual machine for the update call. + :keyword data_disks: adds data disks to the virtual machine instance for the update call. :paramtype data_disks: list[~azure.mgmt.azurestackhci.models.StorageProfileUpdateDataDisksItem] """ super().__init__(**kwargs) self.data_disks = data_disks -class StorageProfileUpdateDataDisksItem(_serialization.Model): - """StorageProfileUpdateDataDisksItem. +class StorageProfileUpdateDataDisksItem(_serialization.Model): + """StorageProfileUpdateDataDisksItem. + + :ivar id: + :vartype id: str + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: + :paramtype id: str + """ + super().__init__(**kwargs) + self.id = id + + +class Subnet(_serialization.Model): + """Subnet. + + :ivar name: Name - The name of the resource that is unique within a resource group. This name + can be used to access the resource. + :vartype name: str + :ivar address_prefix: The address prefix for the subnet: Cidr for this subnet - IPv4, IPv6. + :vartype address_prefix: str + :ivar address_prefixes: List of address prefixes for the subnet. + :vartype address_prefixes: list[str] + :ivar ip_allocation_method: IPAllocationMethod - The IP address allocation method. Possible + values include: 'Static', 'Dynamic'. Known values are: "Dynamic" and "Static". + :vartype ip_allocation_method: str or ~azure.mgmt.azurestackhci.models.IpAllocationMethodEnum + :ivar ip_configuration_references: IPConfigurationReferences - list of + IPConfigurationReferences. + :vartype ip_configuration_references: + list[~azure.mgmt.azurestackhci.models.SubnetPropertiesFormatIpConfigurationReferencesItem] + :ivar route_table: Route table resource. + :vartype route_table: ~azure.mgmt.azurestackhci.models.RouteTable + :ivar ip_pools: network associated pool of IP Addresses. + :vartype ip_pools: list[~azure.mgmt.azurestackhci.models.IPPool] + :ivar vlan: Vlan to use for the subnet. + :vartype vlan: int + """ + + _validation = { + "name": {"pattern": r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[_a-zA-Z0-9]$"}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "address_prefix": {"key": "properties.addressPrefix", "type": "str"}, + "address_prefixes": {"key": "properties.addressPrefixes", "type": "[str]"}, + "ip_allocation_method": {"key": "properties.ipAllocationMethod", "type": "str"}, + "ip_configuration_references": { + "key": "properties.ipConfigurationReferences", + "type": "[SubnetPropertiesFormatIpConfigurationReferencesItem]", + }, + "route_table": {"key": "properties.routeTable", "type": "RouteTable"}, + "ip_pools": {"key": "properties.ipPools", "type": "[IPPool]"}, + "vlan": {"key": "properties.vlan", "type": "int"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + address_prefix: Optional[str] = None, + address_prefixes: Optional[List[str]] = None, + ip_allocation_method: Optional[Union[str, "_models.IpAllocationMethodEnum"]] = None, + ip_configuration_references: Optional[ + List["_models.SubnetPropertiesFormatIpConfigurationReferencesItem"] + ] = None, + route_table: Optional["_models.RouteTable"] = None, + ip_pools: Optional[List["_models.IPPool"]] = None, + vlan: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name - The name of the resource that is unique within a resource group. This + name can be used to access the resource. + :paramtype name: str + :keyword address_prefix: The address prefix for the subnet: Cidr for this subnet - IPv4, IPv6. + :paramtype address_prefix: str + :keyword address_prefixes: List of address prefixes for the subnet. + :paramtype address_prefixes: list[str] + :keyword ip_allocation_method: IPAllocationMethod - The IP address allocation method. Possible + values include: 'Static', 'Dynamic'. Known values are: "Dynamic" and "Static". + :paramtype ip_allocation_method: str or ~azure.mgmt.azurestackhci.models.IpAllocationMethodEnum + :keyword ip_configuration_references: IPConfigurationReferences - list of + IPConfigurationReferences. + :paramtype ip_configuration_references: + list[~azure.mgmt.azurestackhci.models.SubnetPropertiesFormatIpConfigurationReferencesItem] + :keyword route_table: Route table resource. + :paramtype route_table: ~azure.mgmt.azurestackhci.models.RouteTable + :keyword ip_pools: network associated pool of IP Addresses. + :paramtype ip_pools: list[~azure.mgmt.azurestackhci.models.IPPool] + :keyword vlan: Vlan to use for the subnet. + :paramtype vlan: int + """ + super().__init__(**kwargs) + self.name = name + self.address_prefix = address_prefix + self.address_prefixes = address_prefixes + self.ip_allocation_method = ip_allocation_method + self.ip_configuration_references = ip_configuration_references + self.route_table = route_table + self.ip_pools = ip_pools + self.vlan = vlan + + +class SubnetPropertiesFormatIpConfigurationReferencesItem(_serialization.Model): + """IPConfigurationReference - Describes a IPConfiguration under the virtual network. - :ivar name: - :vartype name: str + :ivar id: IPConfigurationID. + :vartype id: str """ _attribute_map = { - "name": {"key": "name", "type": "str"}, + "id": {"key": "ID", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, **kwargs): + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ - :keyword name: - :paramtype name: str + :keyword id: IPConfigurationID. + :paramtype id: str """ super().__init__(**kwargs) - self.name = name + self.id = id class SystemData(_serialization.Model): @@ -3580,8 +2962,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 @@ -3607,7 +2989,7 @@ def __init__( self.last_modified_at = last_modified_at -class Virtualharddisks(TrackedResource): # pylint: disable=too-many-instance-attributes +class VirtualHardDisks(TrackedResource): # pylint: disable=too-many-instance-attributes """The virtual hard disk resource definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -3622,18 +3004,19 @@ class Virtualharddisks(TrackedResource): # pylint: disable=too-many-instance-at :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.azurestackhci.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 extended_location: The extendedLocation of the resource. :vartype extended_location: ~azure.mgmt.azurestackhci.models.ExtendedLocation - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.azurestackhci.models.SystemData :ivar block_size_bytes: :vartype block_size_bytes: int - :ivar disk_size_bytes: diskSizeBytes - size of the disk in GB. - :vartype disk_size_bytes: int + :ivar disk_size_gb: Size of the disk in GB. + :vartype disk_size_gb: int :ivar dynamic: Boolean for enabling dynamic sizing on the virtual hard disk. :vartype dynamic: bool :ivar logical_sector_bytes: @@ -3646,14 +3029,12 @@ class Virtualharddisks(TrackedResource): # pylint: disable=too-many-instance-at :ivar disk_file_format: The format of the actual VHD file [vhd, vhdx]. Known values are: "vhdx" and "vhd". :vartype disk_file_format: str or ~azure.mgmt.azurestackhci.models.DiskFileFormat - :ivar provisioning_state: Provisioning state of the gallery image. Known values are: + :ivar provisioning_state: Provisioning state of the virtual hard disk. Known values are: "Succeeded", "Failed", "InProgress", "Accepted", "Deleting", and "Canceled". :vartype provisioning_state: str or ~azure.mgmt.azurestackhci.models.ProvisioningStateEnum :ivar container_id: Storage ContainerID of the storage container to be used for VHD. :vartype container_id: str - :ivar resource_name: name of the object to be used in moc. - :vartype resource_name: str - :ivar status: VirtualHardDiskStatus defines the observed state of virtualharddisks. + :ivar status: The observed state of virtual hard disks. :vartype status: ~azure.mgmt.azurestackhci.models.VirtualHardDiskStatus """ @@ -3661,8 +3042,8 @@ class Virtualharddisks(TrackedResource): # pylint: disable=too-many-instance-at "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "location": {"required": True}, "system_data": {"readonly": True}, + "location": {"required": True}, "provisioning_state": {"readonly": True}, "status": {"readonly": True}, } @@ -3671,12 +3052,12 @@ class Virtualharddisks(TrackedResource): # pylint: disable=too-many-instance-at "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"}, "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, - "system_data": {"key": "systemData", "type": "SystemData"}, "block_size_bytes": {"key": "properties.blockSizeBytes", "type": "int"}, - "disk_size_bytes": {"key": "properties.diskSizeBytes", "type": "int"}, + "disk_size_gb": {"key": "properties.diskSizeGB", "type": "int"}, "dynamic": {"key": "properties.dynamic", "type": "bool"}, "logical_sector_bytes": {"key": "properties.logicalSectorBytes", "type": "int"}, "physical_sector_bytes": {"key": "properties.physicalSectorBytes", "type": "int"}, @@ -3684,7 +3065,6 @@ class Virtualharddisks(TrackedResource): # pylint: disable=too-many-instance-at "disk_file_format": {"key": "properties.diskFileFormat", "type": "str"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "container_id": {"key": "properties.containerId", "type": "str"}, - "resource_name": {"key": "properties.resourceName", "type": "str"}, "status": {"key": "properties.status", "type": "VirtualHardDiskStatus"}, } @@ -3695,16 +3075,15 @@ def __init__( tags: Optional[Dict[str, str]] = None, extended_location: Optional["_models.ExtendedLocation"] = None, block_size_bytes: Optional[int] = None, - disk_size_bytes: Optional[int] = None, + disk_size_gb: Optional[int] = None, dynamic: Optional[bool] = None, logical_sector_bytes: Optional[int] = None, physical_sector_bytes: Optional[int] = None, hyper_v_generation: Optional[Union[str, "_models.HyperVGeneration"]] = None, disk_file_format: Optional[Union[str, "_models.DiskFileFormat"]] = None, container_id: Optional[str] = None, - resource_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -3714,8 +3093,8 @@ def __init__( :paramtype extended_location: ~azure.mgmt.azurestackhci.models.ExtendedLocation :keyword block_size_bytes: :paramtype block_size_bytes: int - :keyword disk_size_bytes: diskSizeBytes - size of the disk in GB. - :paramtype disk_size_bytes: int + :keyword disk_size_gb: Size of the disk in GB. + :paramtype disk_size_gb: int :keyword dynamic: Boolean for enabling dynamic sizing on the virtual hard disk. :paramtype dynamic: bool :keyword logical_sector_bytes: @@ -3730,14 +3109,11 @@ def __init__( :paramtype disk_file_format: str or ~azure.mgmt.azurestackhci.models.DiskFileFormat :keyword container_id: Storage ContainerID of the storage container to be used for VHD. :paramtype container_id: str - :keyword resource_name: name of the object to be used in moc. - :paramtype resource_name: str """ super().__init__(tags=tags, location=location, **kwargs) self.extended_location = extended_location - self.system_data = None self.block_size_bytes = block_size_bytes - self.disk_size_bytes = disk_size_bytes + self.disk_size_gb = disk_size_gb self.dynamic = dynamic self.logical_sector_bytes = logical_sector_bytes self.physical_sector_bytes = physical_sector_bytes @@ -3745,30 +3121,33 @@ def __init__( self.disk_file_format = disk_file_format self.provisioning_state = None self.container_id = container_id - self.resource_name = resource_name self.status = None -class VirtualharddisksListResult(_serialization.Model): - """VirtualharddisksListResult. +class VirtualHardDisksListResult(_serialization.Model): + """VirtualHardDisksListResult. :ivar value: - :vartype value: list[~azure.mgmt.azurestackhci.models.Virtualharddisks] + :vartype value: list[~azure.mgmt.azurestackhci.models.VirtualHardDisks] :ivar next_link: :vartype next_link: str """ _attribute_map = { - "value": {"key": "value", "type": "[Virtualharddisks]"}, + "value": {"key": "value", "type": "[VirtualHardDisks]"}, "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, *, value: Optional[List["_models.Virtualharddisks"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.VirtualHardDisks"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: - :paramtype value: list[~azure.mgmt.azurestackhci.models.Virtualharddisks] + :paramtype value: list[~azure.mgmt.azurestackhci.models.VirtualHardDisks] :keyword next_link: :paramtype next_link: str """ @@ -3777,34 +3156,14 @@ def __init__( self.next_link = next_link -class VirtualharddisksPatch(_serialization.Model): - """The virtual hard disk resource patch definition. - - :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 VirtualHardDiskStatus(_serialization.Model): - """VirtualHardDiskStatus defines the observed state of virtualharddisks. + """The observed state of virtual hard disks. :ivar error_code: VirtualHardDisk provisioning error code. :vartype error_code: str :ivar error_message: Descriptive error message. :vartype error_message: str - :ivar provisioning_status: The provisioning status of the virtual hard disk. + :ivar provisioning_status: :vartype provisioning_status: ~azure.mgmt.azurestackhci.models.VirtualHardDiskStatusProvisioningStatus """ @@ -3821,14 +3180,14 @@ def __init__( error_code: Optional[str] = None, error_message: Optional[str] = None, provisioning_status: Optional["_models.VirtualHardDiskStatusProvisioningStatus"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword error_code: VirtualHardDisk provisioning error code. :paramtype error_code: str :keyword error_message: Descriptive error message. :paramtype error_message: str - :keyword provisioning_status: The provisioning status of the virtual hard disk. + :keyword provisioning_status: :paramtype provisioning_status: ~azure.mgmt.azurestackhci.models.VirtualHardDiskStatusProvisioningStatus """ @@ -3839,13 +3198,13 @@ def __init__( class VirtualHardDiskStatusProvisioningStatus(_serialization.Model): - """The provisioning status of the virtual hard disk. + """VirtualHardDiskStatusProvisioningStatus. :ivar operation_id: The ID of the operation performed on the virtual hard disk. :vartype operation_id: str :ivar status: The status of the operation performed on the virtual hard disk [Succeeded, Failed, InProgress]. Known values are: "Succeeded", "Failed", and "InProgress". - :vartype status: str or ~azure.mgmt.azurestackhci.models.ProvisioningStatusEnum + :vartype status: str or ~azure.mgmt.azurestackhci.models.Status """ _attribute_map = { @@ -3857,27 +3216,77 @@ def __init__( self, *, operation_id: Optional[str] = None, - status: Optional[Union[str, "_models.ProvisioningStatusEnum"]] = None, - **kwargs - ): + status: Optional[Union[str, "_models.Status"]] = None, + **kwargs: Any + ) -> None: """ :keyword operation_id: The ID of the operation performed on the virtual hard disk. :paramtype operation_id: str :keyword status: The status of the operation performed on the virtual hard disk [Succeeded, Failed, InProgress]. Known values are: "Succeeded", "Failed", and "InProgress". - :paramtype status: str or ~azure.mgmt.azurestackhci.models.ProvisioningStatusEnum + :paramtype status: str or ~azure.mgmt.azurestackhci.models.Status """ super().__init__(**kwargs) self.operation_id = operation_id self.status = status -class Virtualmachines(TrackedResource): # pylint: disable=too-many-instance-attributes - """The virtual machine resource definition. +class VirtualHardDisksUpdateRequest(_serialization.Model): + """The virtual hard disk resource patch definition. - Variables are only populated by the server, and will be ignored when sending a request. + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ - All required parameters must be populated in order to send to Azure. + _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 VirtualMachineConfigAgentInstanceView(_serialization.Model): + """The instance view of the VM Config Agent running on the virtual machine. + + :ivar vm_config_agent_version: The VM Config Agent full version. + :vartype vm_config_agent_version: str + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.azurestackhci.models.InstanceViewStatus] + """ + + _attribute_map = { + "vm_config_agent_version": {"key": "vmConfigAgentVersion", "type": "str"}, + "statuses": {"key": "statuses", "type": "[InstanceViewStatus]"}, + } + + def __init__( + self, + *, + vm_config_agent_version: Optional[str] = None, + statuses: Optional[List["_models.InstanceViewStatus"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword vm_config_agent_version: The VM Config Agent full version. + :paramtype vm_config_agent_version: str + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.azurestackhci.models.InstanceViewStatus] + """ + super().__init__(**kwargs) + self.vm_config_agent_version = vm_config_agent_version + self.statuses = statuses + + +class VirtualMachineInstance(ProxyResource): # pylint: disable=too-many-instance-attributes + """The virtual machine instance resource definition. + + 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}. @@ -3887,55 +3296,56 @@ class Virtualmachines(TrackedResource): # pylint: disable=too-many-instance-att :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.azurestackhci.models.SystemData :ivar extended_location: The extendedLocation of the resource. :vartype extended_location: ~azure.mgmt.azurestackhci.models.ExtendedLocation :ivar identity: Identity for the resource. :vartype identity: ~azure.mgmt.azurestackhci.models.Identity - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.azurestackhci.models.SystemData :ivar hardware_profile: HardwareProfile - Specifies the hardware settings for the virtual - machine. + machine instance. :vartype hardware_profile: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesHardwareProfile - :ivar network_profile: NetworkProfile - describes the network configuration the virtual - machine. + ~azure.mgmt.azurestackhci.models.VirtualMachineInstancePropertiesHardwareProfile + :ivar network_profile: NetworkProfile - describes the network configuration the virtual machine + instance. :vartype network_profile: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesNetworkProfile + ~azure.mgmt.azurestackhci.models.VirtualMachineInstancePropertiesNetworkProfile :ivar os_profile: OsProfile - describes the configuration of the operating system and sets login data. - :vartype os_profile: ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfile - :ivar resource_name: name of the object to be used in moc. - :vartype resource_name: str + :vartype os_profile: ~azure.mgmt.azurestackhci.models.VirtualMachineInstancePropertiesOsProfile :ivar security_profile: SecurityProfile - Specifies the security settings for the virtual - machine. + machine instance. :vartype security_profile: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesSecurityProfile + ~azure.mgmt.azurestackhci.models.VirtualMachineInstancePropertiesSecurityProfile :ivar storage_profile: StorageProfile - contains information about the disks and storage - information for the virtual machine. + information for the virtual machine instance. :vartype storage_profile: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesStorageProfile - :ivar provisioning_state: Provisioning state of the gallery image. Known values are: + ~azure.mgmt.azurestackhci.models.VirtualMachineInstancePropertiesStorageProfile + :ivar http_proxy_config: HTTP Proxy configuration for the VM. + :vartype http_proxy_config: ~azure.mgmt.azurestackhci.models.HttpProxyConfiguration + :ivar provisioning_state: Provisioning state of the virtual machine instance. Known values are: "Succeeded", "Failed", "InProgress", "Accepted", "Deleting", and "Canceled". :vartype provisioning_state: str or ~azure.mgmt.azurestackhci.models.ProvisioningStateEnum - :ivar status: VirtualMachineStatus defines the observed state of virtualmachines. - :vartype status: ~azure.mgmt.azurestackhci.models.VirtualMachineStatus - :ivar guest_agent_profile: Guest agent status properties. - :vartype guest_agent_profile: ~azure.mgmt.azurestackhci.models.GuestAgentProfile + :ivar instance_view: The virtual machine instance view. + :vartype instance_view: ~azure.mgmt.azurestackhci.models.VirtualMachineInstanceView + :ivar status: The observed state of virtual machine instances. + :vartype status: ~azure.mgmt.azurestackhci.models.VirtualMachineInstanceStatus + :ivar guest_agent_install_status: Guest agent install status. + :vartype guest_agent_install_status: ~azure.mgmt.azurestackhci.models.GuestAgentInstallStatus :ivar vm_id: Unique identifier for the vm resource. :vartype vm_id: str + :ivar resource_uid: Unique identifier defined by ARC to identify the guest of the VM. + :vartype resource_uid: str """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "location": {"required": True}, "system_data": {"readonly": True}, "provisioning_state": {"readonly": True}, + "instance_view": {"readonly": True}, "status": {"readonly": True}, "vm_id": {"readonly": True}, } @@ -3944,108 +3354,123 @@ class Virtualmachines(TrackedResource): # pylint: disable=too-many-instance-att "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, "identity": {"key": "identity", "type": "Identity"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "hardware_profile": {"key": "properties.hardwareProfile", "type": "VirtualmachinesPropertiesHardwareProfile"}, - "network_profile": {"key": "properties.networkProfile", "type": "VirtualmachinesPropertiesNetworkProfile"}, - "os_profile": {"key": "properties.osProfile", "type": "VirtualmachinesPropertiesOsProfile"}, - "resource_name": {"key": "properties.resourceName", "type": "str"}, - "security_profile": {"key": "properties.securityProfile", "type": "VirtualmachinesPropertiesSecurityProfile"}, - "storage_profile": {"key": "properties.storageProfile", "type": "VirtualmachinesPropertiesStorageProfile"}, + "hardware_profile": { + "key": "properties.hardwareProfile", + "type": "VirtualMachineInstancePropertiesHardwareProfile", + }, + "network_profile": { + "key": "properties.networkProfile", + "type": "VirtualMachineInstancePropertiesNetworkProfile", + }, + "os_profile": {"key": "properties.osProfile", "type": "VirtualMachineInstancePropertiesOsProfile"}, + "security_profile": { + "key": "properties.securityProfile", + "type": "VirtualMachineInstancePropertiesSecurityProfile", + }, + "storage_profile": { + "key": "properties.storageProfile", + "type": "VirtualMachineInstancePropertiesStorageProfile", + }, + "http_proxy_config": {"key": "properties.httpProxyConfig", "type": "HttpProxyConfiguration"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "status": {"key": "properties.status", "type": "VirtualMachineStatus"}, - "guest_agent_profile": {"key": "properties.guestAgentProfile", "type": "GuestAgentProfile"}, + "instance_view": {"key": "properties.instanceView", "type": "VirtualMachineInstanceView"}, + "status": {"key": "properties.status", "type": "VirtualMachineInstanceStatus"}, + "guest_agent_install_status": {"key": "properties.guestAgentInstallStatus", "type": "GuestAgentInstallStatus"}, "vm_id": {"key": "properties.vmId", "type": "str"}, + "resource_uid": {"key": "properties.resourceUid", "type": "str"}, } def __init__( self, *, - location: str, - tags: Optional[Dict[str, str]] = None, extended_location: Optional["_models.ExtendedLocation"] = None, identity: Optional["_models.Identity"] = None, - hardware_profile: Optional["_models.VirtualmachinesPropertiesHardwareProfile"] = None, - network_profile: Optional["_models.VirtualmachinesPropertiesNetworkProfile"] = None, - os_profile: Optional["_models.VirtualmachinesPropertiesOsProfile"] = None, - resource_name: Optional[str] = None, - security_profile: Optional["_models.VirtualmachinesPropertiesSecurityProfile"] = None, - storage_profile: Optional["_models.VirtualmachinesPropertiesStorageProfile"] = None, - guest_agent_profile: Optional["_models.GuestAgentProfile"] = None, - **kwargs - ): + hardware_profile: Optional["_models.VirtualMachineInstancePropertiesHardwareProfile"] = None, + network_profile: Optional["_models.VirtualMachineInstancePropertiesNetworkProfile"] = None, + os_profile: Optional["_models.VirtualMachineInstancePropertiesOsProfile"] = None, + security_profile: Optional["_models.VirtualMachineInstancePropertiesSecurityProfile"] = None, + storage_profile: Optional["_models.VirtualMachineInstancePropertiesStorageProfile"] = None, + http_proxy_config: Optional["_models.HttpProxyConfiguration"] = None, + guest_agent_install_status: Optional["_models.GuestAgentInstallStatus"] = None, + resource_uid: Optional[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 :keyword extended_location: The extendedLocation of the resource. :paramtype extended_location: ~azure.mgmt.azurestackhci.models.ExtendedLocation :keyword identity: Identity for the resource. :paramtype identity: ~azure.mgmt.azurestackhci.models.Identity :keyword hardware_profile: HardwareProfile - Specifies the hardware settings for the virtual - machine. + machine instance. :paramtype hardware_profile: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesHardwareProfile + ~azure.mgmt.azurestackhci.models.VirtualMachineInstancePropertiesHardwareProfile :keyword network_profile: NetworkProfile - describes the network configuration the virtual - machine. + machine instance. :paramtype network_profile: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesNetworkProfile + ~azure.mgmt.azurestackhci.models.VirtualMachineInstancePropertiesNetworkProfile :keyword os_profile: OsProfile - describes the configuration of the operating system and sets login data. - :paramtype os_profile: ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfile - :keyword resource_name: name of the object to be used in moc. - :paramtype resource_name: str + :paramtype os_profile: + ~azure.mgmt.azurestackhci.models.VirtualMachineInstancePropertiesOsProfile :keyword security_profile: SecurityProfile - Specifies the security settings for the virtual - machine. + machine instance. :paramtype security_profile: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesSecurityProfile + ~azure.mgmt.azurestackhci.models.VirtualMachineInstancePropertiesSecurityProfile :keyword storage_profile: StorageProfile - contains information about the disks and storage - information for the virtual machine. + information for the virtual machine instance. :paramtype storage_profile: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesStorageProfile - :keyword guest_agent_profile: Guest agent status properties. - :paramtype guest_agent_profile: ~azure.mgmt.azurestackhci.models.GuestAgentProfile + ~azure.mgmt.azurestackhci.models.VirtualMachineInstancePropertiesStorageProfile + :keyword http_proxy_config: HTTP Proxy configuration for the VM. + :paramtype http_proxy_config: ~azure.mgmt.azurestackhci.models.HttpProxyConfiguration + :keyword guest_agent_install_status: Guest agent install status. + :paramtype guest_agent_install_status: ~azure.mgmt.azurestackhci.models.GuestAgentInstallStatus + :keyword resource_uid: Unique identifier defined by ARC to identify the guest of the VM. + :paramtype resource_uid: str """ - super().__init__(tags=tags, location=location, **kwargs) + super().__init__(**kwargs) self.extended_location = extended_location self.identity = identity - self.system_data = None self.hardware_profile = hardware_profile self.network_profile = network_profile self.os_profile = os_profile - self.resource_name = resource_name self.security_profile = security_profile self.storage_profile = storage_profile + self.http_proxy_config = http_proxy_config self.provisioning_state = None + self.instance_view = None self.status = None - self.guest_agent_profile = guest_agent_profile + self.guest_agent_install_status = guest_agent_install_status self.vm_id = None + self.resource_uid = resource_uid -class VirtualmachinesListResult(_serialization.Model): - """VirtualmachinesListResult. +class VirtualMachineInstanceListResult(_serialization.Model): + """VirtualMachineInstanceListResult. :ivar value: - :vartype value: list[~azure.mgmt.azurestackhci.models.Virtualmachines] + :vartype value: list[~azure.mgmt.azurestackhci.models.VirtualMachineInstance] :ivar next_link: :vartype next_link: str """ _attribute_map = { - "value": {"key": "value", "type": "[Virtualmachines]"}, + "value": {"key": "value", "type": "[VirtualMachineInstance]"}, "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, *, value: Optional[List["_models.Virtualmachines"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.VirtualMachineInstance"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: - :paramtype value: list[~azure.mgmt.azurestackhci.models.Virtualmachines] + :paramtype value: list[~azure.mgmt.azurestackhci.models.VirtualMachineInstance] :keyword next_link: :paramtype next_link: str """ @@ -4054,141 +3479,127 @@ def __init__( self.next_link = next_link -class VirtualmachinesPatch(_serialization.Model): - """The virtual machine resource patch definition. - - :ivar properties: Defines the resource properties for the update. - :vartype properties: ~azure.mgmt.azurestackhci.models.VirtualMachineUpdateProperties - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "VirtualMachineUpdateProperties"}, - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__( - self, - *, - properties: Optional["_models.VirtualMachineUpdateProperties"] = None, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): - """ - :keyword properties: Defines the resource properties for the update. - :paramtype properties: ~azure.mgmt.azurestackhci.models.VirtualMachineUpdateProperties - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.properties = properties - self.tags = tags - - -class VirtualmachinesPropertiesHardwareProfile(_serialization.Model): - """HardwareProfile - Specifies the hardware settings for the virtual machine. +class VirtualMachineInstancePropertiesHardwareProfile(_serialization.Model): + """HardwareProfile - Specifies the hardware settings for the virtual machine instance. - :ivar vm_size: - :vartype vm_size: str - :ivar processors: number of processors for the virtual machine. + :ivar vm_size: Known values are: "Default", "Standard_A2_v2", "Standard_A4_v2", + "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", + "Standard_D32s_v3", "Standard_DS2_v2", "Standard_DS3_v2", "Standard_DS4_v2", "Standard_DS5_v2", + "Standard_DS13_v2", "Standard_K8S_v1", "Standard_K8S2_v1", "Standard_K8S3_v1", + "Standard_K8S4_v1", "Standard_NK6", "Standard_NK12", "Standard_NV6", "Standard_NV12", + "Standard_K8S5_v1", and "Custom". + :vartype vm_size: str or ~azure.mgmt.azurestackhci.models.VmSizeEnum + :ivar processors: number of processors for the virtual machine instance. :vartype processors: int - :ivar memory_gb: RAM in gb for the virtual machine. - :vartype memory_gb: int + :ivar memory_mb: RAM in MB for the virtual machine instance. + :vartype memory_mb: int :ivar dynamic_memory_config: :vartype dynamic_memory_config: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesHardwareProfileDynamicMemoryConfig + ~azure.mgmt.azurestackhci.models.VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig """ _attribute_map = { "vm_size": {"key": "vmSize", "type": "str"}, "processors": {"key": "processors", "type": "int"}, - "memory_gb": {"key": "memoryGB", "type": "int"}, + "memory_mb": {"key": "memoryMB", "type": "int"}, "dynamic_memory_config": { "key": "dynamicMemoryConfig", - "type": "VirtualmachinesPropertiesHardwareProfileDynamicMemoryConfig", + "type": "VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig", }, } def __init__( self, *, - vm_size: Optional[str] = None, + vm_size: Optional[Union[str, "_models.VmSizeEnum"]] = None, processors: Optional[int] = None, - memory_gb: Optional[int] = None, - dynamic_memory_config: Optional["_models.VirtualmachinesPropertiesHardwareProfileDynamicMemoryConfig"] = None, - **kwargs - ): - """ - :keyword vm_size: - :paramtype vm_size: str - :keyword processors: number of processors for the virtual machine. + memory_mb: Optional[int] = None, + dynamic_memory_config: Optional[ + "_models.VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig" + ] = None, + **kwargs: Any + ) -> None: + """ + :keyword vm_size: Known values are: "Default", "Standard_A2_v2", "Standard_A4_v2", + "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", + "Standard_D32s_v3", "Standard_DS2_v2", "Standard_DS3_v2", "Standard_DS4_v2", "Standard_DS5_v2", + "Standard_DS13_v2", "Standard_K8S_v1", "Standard_K8S2_v1", "Standard_K8S3_v1", + "Standard_K8S4_v1", "Standard_NK6", "Standard_NK12", "Standard_NV6", "Standard_NV12", + "Standard_K8S5_v1", and "Custom". + :paramtype vm_size: str or ~azure.mgmt.azurestackhci.models.VmSizeEnum + :keyword processors: number of processors for the virtual machine instance. :paramtype processors: int - :keyword memory_gb: RAM in gb for the virtual machine. - :paramtype memory_gb: int + :keyword memory_mb: RAM in MB for the virtual machine instance. + :paramtype memory_mb: int :keyword dynamic_memory_config: :paramtype dynamic_memory_config: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesHardwareProfileDynamicMemoryConfig + ~azure.mgmt.azurestackhci.models.VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig """ super().__init__(**kwargs) self.vm_size = vm_size self.processors = processors - self.memory_gb = memory_gb + self.memory_mb = memory_mb self.dynamic_memory_config = dynamic_memory_config -class VirtualmachinesPropertiesHardwareProfileDynamicMemoryConfig(_serialization.Model): - """VirtualmachinesPropertiesHardwareProfileDynamicMemoryConfig. +class VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig(_serialization.Model): + """VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig. - :ivar maximum_memory_gb: - :vartype maximum_memory_gb: int - :ivar minimum_memory_gb: - :vartype minimum_memory_gb: int - :ivar target_memory_buffer: + :ivar maximum_memory_mb: + :vartype maximum_memory_mb: int + :ivar minimum_memory_mb: + :vartype minimum_memory_mb: int + :ivar target_memory_buffer: Defines the amount of extra memory that should be reserved for a + virtual machine instance at runtime, as a percentage of the total memory that the virtual + machine instance is thought to need. This only applies to virtual systems with dynamic memory + enabled. This property can be in the range of 5 to 2000. :vartype target_memory_buffer: int """ _attribute_map = { - "maximum_memory_gb": {"key": "maximumMemoryGB", "type": "int"}, - "minimum_memory_gb": {"key": "minimumMemoryGB", "type": "int"}, + "maximum_memory_mb": {"key": "maximumMemoryMB", "type": "int"}, + "minimum_memory_mb": {"key": "minimumMemoryMB", "type": "int"}, "target_memory_buffer": {"key": "targetMemoryBuffer", "type": "int"}, } def __init__( self, *, - maximum_memory_gb: Optional[int] = None, - minimum_memory_gb: Optional[int] = None, + maximum_memory_mb: Optional[int] = None, + minimum_memory_mb: Optional[int] = None, target_memory_buffer: Optional[int] = None, - **kwargs - ): - """ - :keyword maximum_memory_gb: - :paramtype maximum_memory_gb: int - :keyword minimum_memory_gb: - :paramtype minimum_memory_gb: int - :keyword target_memory_buffer: + **kwargs: Any + ) -> None: + """ + :keyword maximum_memory_mb: + :paramtype maximum_memory_mb: int + :keyword minimum_memory_mb: + :paramtype minimum_memory_mb: int + :keyword target_memory_buffer: Defines the amount of extra memory that should be reserved for a + virtual machine instance at runtime, as a percentage of the total memory that the virtual + machine instance is thought to need. This only applies to virtual systems with dynamic memory + enabled. This property can be in the range of 5 to 2000. :paramtype target_memory_buffer: int """ super().__init__(**kwargs) - self.maximum_memory_gb = maximum_memory_gb - self.minimum_memory_gb = minimum_memory_gb + self.maximum_memory_mb = maximum_memory_mb + self.minimum_memory_mb = minimum_memory_mb self.target_memory_buffer = target_memory_buffer -class VirtualmachinesPropertiesNetworkProfile(_serialization.Model): - """NetworkProfile - describes the network configuration the virtual machine. +class VirtualMachineInstancePropertiesNetworkProfile(_serialization.Model): + """NetworkProfile - describes the network configuration the virtual machine instance. :ivar network_interfaces: NetworkInterfaces - list of network interfaces to be attached to the - virtual machine. + virtual machine instance. :vartype network_interfaces: - list[~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesNetworkProfileNetworkInterfacesItem] + list[~azure.mgmt.azurestackhci.models.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem] """ _attribute_map = { "network_interfaces": { "key": "networkInterfaces", - "type": "[VirtualmachinesPropertiesNetworkProfileNetworkInterfacesItem]", + "type": "[VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem]", }, } @@ -4196,22 +3607,22 @@ def __init__( self, *, network_interfaces: Optional[ - List["_models.VirtualmachinesPropertiesNetworkProfileNetworkInterfacesItem"] + List["_models.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem"] ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword network_interfaces: NetworkInterfaces - list of network interfaces to be attached to - the virtual machine. + the virtual machine instance. :paramtype network_interfaces: - list[~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesNetworkProfileNetworkInterfacesItem] + list[~azure.mgmt.azurestackhci.models.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem] """ super().__init__(**kwargs) self.network_interfaces = network_interfaces -class VirtualmachinesPropertiesNetworkProfileNetworkInterfacesItem(_serialization.Model): - """VirtualmachinesPropertiesNetworkProfileNetworkInterfacesItem. +class VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem(_serialization.Model): + """VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem. :ivar id: ID - Resource Id of the network interface. :vartype id: str @@ -4221,7 +3632,7 @@ class VirtualmachinesPropertiesNetworkProfileNetworkInterfacesItem(_serializatio "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 - Resource Id of the network interface. :paramtype id: str @@ -4230,7 +3641,7 @@ def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=re self.id = id -class VirtualmachinesPropertiesOsProfile(_serialization.Model): +class VirtualMachineInstancePropertiesOsProfile(_serialization.Model): """OsProfile - describes the configuration of the operating system and sets login data. :ivar admin_password: AdminPassword - admin password. @@ -4240,15 +3651,12 @@ class VirtualmachinesPropertiesOsProfile(_serialization.Model): :ivar computer_name: ComputerName - name of the compute. :vartype computer_name: str :ivar linux_configuration: LinuxConfiguration - linux specific configuration values for the - virtual machine. + virtual machine instance. :vartype linux_configuration: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfileLinuxConfiguration - :ivar os_type: OsType - string specifying whether the OS is Linux or Windows. Known values are: - "Linux" and "Windows". - :vartype os_type: str or ~azure.mgmt.azurestackhci.models.OsTypeEnum - :ivar windows_configuration: Windows Configuration for the virtual machine. + ~azure.mgmt.azurestackhci.models.VirtualMachineInstancePropertiesOsProfileLinuxConfiguration + :ivar windows_configuration: Windows Configuration for the virtual machine instance. :vartype windows_configuration: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfileWindowsConfiguration + ~azure.mgmt.azurestackhci.models.VirtualMachineInstancePropertiesOsProfileWindowsConfiguration """ _attribute_map = { @@ -4257,12 +3665,11 @@ class VirtualmachinesPropertiesOsProfile(_serialization.Model): "computer_name": {"key": "computerName", "type": "str"}, "linux_configuration": { "key": "linuxConfiguration", - "type": "VirtualmachinesPropertiesOsProfileLinuxConfiguration", + "type": "VirtualMachineInstancePropertiesOsProfileLinuxConfiguration", }, - "os_type": {"key": "osType", "type": "str"}, "windows_configuration": { "key": "windowsConfiguration", - "type": "VirtualmachinesPropertiesOsProfileWindowsConfiguration", + "type": "VirtualMachineInstancePropertiesOsProfileWindowsConfiguration", }, } @@ -4272,11 +3679,10 @@ def __init__( admin_password: Optional[str] = None, admin_username: Optional[str] = None, computer_name: Optional[str] = None, - linux_configuration: Optional["_models.VirtualmachinesPropertiesOsProfileLinuxConfiguration"] = None, - os_type: Optional[Union[str, "_models.OsTypeEnum"]] = None, - windows_configuration: Optional["_models.VirtualmachinesPropertiesOsProfileWindowsConfiguration"] = None, - **kwargs - ): + linux_configuration: Optional["_models.VirtualMachineInstancePropertiesOsProfileLinuxConfiguration"] = None, + windows_configuration: Optional["_models.VirtualMachineInstancePropertiesOsProfileWindowsConfiguration"] = None, + **kwargs: Any + ) -> None: """ :keyword admin_password: AdminPassword - admin password. :paramtype admin_password: str @@ -4285,301 +3691,180 @@ def __init__( :keyword computer_name: ComputerName - name of the compute. :paramtype computer_name: str :keyword linux_configuration: LinuxConfiguration - linux specific configuration values for the - virtual machine. + virtual machine instance. :paramtype linux_configuration: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfileLinuxConfiguration - :keyword os_type: OsType - string specifying whether the OS is Linux or Windows. Known values - are: "Linux" and "Windows". - :paramtype os_type: str or ~azure.mgmt.azurestackhci.models.OsTypeEnum - :keyword windows_configuration: Windows Configuration for the virtual machine. + ~azure.mgmt.azurestackhci.models.VirtualMachineInstancePropertiesOsProfileLinuxConfiguration + :keyword windows_configuration: Windows Configuration for the virtual machine instance. :paramtype windows_configuration: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfileWindowsConfiguration + ~azure.mgmt.azurestackhci.models.VirtualMachineInstancePropertiesOsProfileWindowsConfiguration """ super().__init__(**kwargs) self.admin_password = admin_password self.admin_username = admin_username self.computer_name = computer_name self.linux_configuration = linux_configuration - self.os_type = os_type self.windows_configuration = windows_configuration -class VirtualmachinesPropertiesOsProfileLinuxConfiguration(_serialization.Model): - """LinuxConfiguration - linux specific configuration values for the virtual machine. +class VirtualMachineInstancePropertiesOsProfileLinuxConfiguration(_serialization.Model): + """LinuxConfiguration - linux specific configuration values for the virtual machine instance. :ivar disable_password_authentication: DisablePasswordAuthentication - whether password authentication should be disabled. :vartype disable_password_authentication: bool - :ivar ssh: SSH - contains settings related to ssh configuration. - :vartype ssh: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfileLinuxConfigurationSsh + :ivar ssh: Specifies the ssh key configuration for a Linux OS. + :vartype ssh: ~azure.mgmt.azurestackhci.models.SshConfiguration :ivar provision_vm_agent: Used to indicate whether Arc for Servers agent onboarding should be - triggered during the virtual machine creation process. + triggered during the virtual machine instance creation process. :vartype provision_vm_agent: bool + :ivar provision_vm_config_agent: Used to indicate whether the VM Config Agent should be + installed during the virtual machine creation process. + :vartype provision_vm_config_agent: bool """ _attribute_map = { "disable_password_authentication": {"key": "disablePasswordAuthentication", "type": "bool"}, - "ssh": {"key": "ssh", "type": "VirtualmachinesPropertiesOsProfileLinuxConfigurationSsh"}, + "ssh": {"key": "ssh", "type": "SshConfiguration"}, "provision_vm_agent": {"key": "provisionVMAgent", "type": "bool"}, + "provision_vm_config_agent": {"key": "provisionVMConfigAgent", "type": "bool"}, } def __init__( self, *, disable_password_authentication: Optional[bool] = None, - ssh: Optional["_models.VirtualmachinesPropertiesOsProfileLinuxConfigurationSsh"] = None, - provision_vm_agent: Optional[bool] = None, - **kwargs - ): + ssh: Optional["_models.SshConfiguration"] = None, + provision_vm_agent: bool = True, + provision_vm_config_agent: bool = True, + **kwargs: Any + ) -> None: """ :keyword disable_password_authentication: DisablePasswordAuthentication - whether password authentication should be disabled. :paramtype disable_password_authentication: bool - :keyword ssh: SSH - contains settings related to ssh configuration. - :paramtype ssh: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfileLinuxConfigurationSsh + :keyword ssh: Specifies the ssh key configuration for a Linux OS. + :paramtype ssh: ~azure.mgmt.azurestackhci.models.SshConfiguration :keyword provision_vm_agent: Used to indicate whether Arc for Servers agent onboarding should - be triggered during the virtual machine creation process. + be triggered during the virtual machine instance creation process. :paramtype provision_vm_agent: bool + :keyword provision_vm_config_agent: Used to indicate whether the VM Config Agent should be + installed during the virtual machine creation process. + :paramtype provision_vm_config_agent: bool """ super().__init__(**kwargs) self.disable_password_authentication = disable_password_authentication self.ssh = ssh self.provision_vm_agent = provision_vm_agent + self.provision_vm_config_agent = provision_vm_config_agent -class VirtualmachinesPropertiesOsProfileLinuxConfigurationSsh(_serialization.Model): - """SSH - contains settings related to ssh configuration. - - :ivar public_keys: PublicKeys - The list of SSH public keys used to authenticate with linux - based VMs. - :vartype public_keys: - list[~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfileLinuxConfigurationSshPublicKeysItem] - """ - - _attribute_map = { - "public_keys": { - "key": "publicKeys", - "type": "[VirtualmachinesPropertiesOsProfileLinuxConfigurationSshPublicKeysItem]", - }, - } - - def __init__( - self, - *, - public_keys: Optional[ - List["_models.VirtualmachinesPropertiesOsProfileLinuxConfigurationSshPublicKeysItem"] - ] = None, - **kwargs - ): - """ - :keyword public_keys: PublicKeys - The list of SSH public keys used to authenticate with linux - based VMs. - :paramtype public_keys: - list[~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfileLinuxConfigurationSshPublicKeysItem] - """ - super().__init__(**kwargs) - self.public_keys = public_keys - - -class VirtualmachinesPropertiesOsProfileLinuxConfigurationSshPublicKeysItem(_serialization.Model): - """VirtualmachinesPropertiesOsProfileLinuxConfigurationSshPublicKeysItem. - - :ivar key_data: KeyData - SSH public key certificate used to authenticate with the VM through - ssh. The key needs to be at least 2048-bit and in ssh-rsa format. :code:`
`:code:`
` For - creating ssh keys, see `Create SSH keys on Linux and Mac for Li nux VMs in Azure - `_. - :vartype key_data: str - :ivar path: Path - Specifies the full path on the created VM where ssh public key is stored. If - the file already exists, the specified key is appended to the file. Example: - /home/user/.ssh/authorized_keys. - :vartype path: str - """ - - _attribute_map = { - "key_data": {"key": "keyData", "type": "str"}, - "path": {"key": "path", "type": "str"}, - } - - def __init__(self, *, key_data: Optional[str] = None, path: Optional[str] = None, **kwargs): - """ - :keyword key_data: KeyData - SSH public key certificate used to authenticate with the VM - through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. - :code:`
`:code:`
` For creating ssh keys, see `Create SSH keys on Linux and Mac for Li - nux VMs in Azure - `_. - :paramtype key_data: str - :keyword path: Path - Specifies the full path on the created VM where ssh public key is stored. - If the file already exists, the specified key is appended to the file. Example: - /home/user/.ssh/authorized_keys. - :paramtype path: str - """ - super().__init__(**kwargs) - self.key_data = key_data - self.path = path - - -class VirtualmachinesPropertiesOsProfileWindowsConfiguration(_serialization.Model): - """Windows Configuration for the virtual machine. +class VirtualMachineInstancePropertiesOsProfileWindowsConfiguration(_serialization.Model): + """Windows Configuration for the virtual machine instance. :ivar enable_automatic_updates: Whether to EnableAutomaticUpdates on the machine. :vartype enable_automatic_updates: bool - :ivar ssh: SSH Configuration. - :vartype ssh: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfileWindowsConfigurationSsh - :ivar time_zone: TimeZone for the virtual machine. + :ivar ssh: Specifies the ssh key configuration for Windows OS. + :vartype ssh: ~azure.mgmt.azurestackhci.models.SshConfiguration + :ivar time_zone: TimeZone for the virtual machine instance. :vartype time_zone: str :ivar provision_vm_agent: Used to indicate whether Arc for Servers agent onboarding should be - triggered during the virtual machine creation process. + triggered during the virtual machine instance creation process. :vartype provision_vm_agent: bool + :ivar provision_vm_config_agent: Used to indicate whether the VM Config Agent should be + installed during the virtual machine creation process. + :vartype provision_vm_config_agent: bool """ _attribute_map = { "enable_automatic_updates": {"key": "enableAutomaticUpdates", "type": "bool"}, - "ssh": {"key": "ssh", "type": "VirtualmachinesPropertiesOsProfileWindowsConfigurationSsh"}, + "ssh": {"key": "ssh", "type": "SshConfiguration"}, "time_zone": {"key": "timeZone", "type": "str"}, "provision_vm_agent": {"key": "provisionVMAgent", "type": "bool"}, + "provision_vm_config_agent": {"key": "provisionVMConfigAgent", "type": "bool"}, } def __init__( self, *, enable_automatic_updates: Optional[bool] = None, - ssh: Optional["_models.VirtualmachinesPropertiesOsProfileWindowsConfigurationSsh"] = None, + ssh: Optional["_models.SshConfiguration"] = None, time_zone: Optional[str] = None, - provision_vm_agent: Optional[bool] = None, - **kwargs - ): + provision_vm_agent: bool = True, + provision_vm_config_agent: bool = True, + **kwargs: Any + ) -> None: """ :keyword enable_automatic_updates: Whether to EnableAutomaticUpdates on the machine. :paramtype enable_automatic_updates: bool - :keyword ssh: SSH Configuration. - :paramtype ssh: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfileWindowsConfigurationSsh - :keyword time_zone: TimeZone for the virtual machine. + :keyword ssh: Specifies the ssh key configuration for Windows OS. + :paramtype ssh: ~azure.mgmt.azurestackhci.models.SshConfiguration + :keyword time_zone: TimeZone for the virtual machine instance. :paramtype time_zone: str :keyword provision_vm_agent: Used to indicate whether Arc for Servers agent onboarding should - be triggered during the virtual machine creation process. + be triggered during the virtual machine instance creation process. :paramtype provision_vm_agent: bool + :keyword provision_vm_config_agent: Used to indicate whether the VM Config Agent should be + installed during the virtual machine creation process. + :paramtype provision_vm_config_agent: bool """ super().__init__(**kwargs) self.enable_automatic_updates = enable_automatic_updates self.ssh = ssh self.time_zone = time_zone self.provision_vm_agent = provision_vm_agent + self.provision_vm_config_agent = provision_vm_config_agent -class VirtualmachinesPropertiesOsProfileWindowsConfigurationSsh(_serialization.Model): - """SSH Configuration. - - :ivar public_keys: PublicKeys - The list of SSH public keys used to authenticate with linux - based VMs. - :vartype public_keys: - list[~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfileWindowsConfigurationSshPublicKeysItem] - """ - - _attribute_map = { - "public_keys": { - "key": "publicKeys", - "type": "[VirtualmachinesPropertiesOsProfileWindowsConfigurationSshPublicKeysItem]", - }, - } - - def __init__( - self, - *, - public_keys: Optional[ - List["_models.VirtualmachinesPropertiesOsProfileWindowsConfigurationSshPublicKeysItem"] - ] = None, - **kwargs - ): - """ - :keyword public_keys: PublicKeys - The list of SSH public keys used to authenticate with linux - based VMs. - :paramtype public_keys: - list[~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfileWindowsConfigurationSshPublicKeysItem] - """ - super().__init__(**kwargs) - self.public_keys = public_keys - - -class VirtualmachinesPropertiesOsProfileWindowsConfigurationSshPublicKeysItem(_serialization.Model): - """VirtualmachinesPropertiesOsProfileWindowsConfigurationSshPublicKeysItem. - - :ivar key_data: KeyData - SSH public key certificate used to authenticate with the VM through - ssh. The key needs to be at least 2048-bit and in ssh-rsa format. :code:`
`:code:`
` For - creating ssh keys, see `Create SSH keys on Linux and Mac for Li nux VMs in Azure - `_. - :vartype key_data: str - :ivar path: Path - Specifies the full path on the created VM where ssh public key is stored. If - the file already exists, the specified key is appended to the file. Example: - /home/user/.ssh/authorized_keys. - :vartype path: str - """ - - _attribute_map = { - "key_data": {"key": "keyData", "type": "str"}, - "path": {"key": "path", "type": "str"}, - } - - def __init__(self, *, key_data: Optional[str] = None, path: Optional[str] = None, **kwargs): - """ - :keyword key_data: KeyData - SSH public key certificate used to authenticate with the VM - through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. - :code:`
`:code:`
` For creating ssh keys, see `Create SSH keys on Linux and Mac for Li - nux VMs in Azure - `_. - :paramtype key_data: str - :keyword path: Path - Specifies the full path on the created VM where ssh public key is stored. - If the file already exists, the specified key is appended to the file. Example: - /home/user/.ssh/authorized_keys. - :paramtype path: str - """ - super().__init__(**kwargs) - self.key_data = key_data - self.path = path - - -class VirtualmachinesPropertiesSecurityProfile(_serialization.Model): - """SecurityProfile - Specifies the security settings for the virtual machine. +class VirtualMachineInstancePropertiesSecurityProfile(_serialization.Model): + """SecurityProfile - Specifies the security settings for the virtual machine instance. :ivar enable_tpm: :vartype enable_tpm: bool :ivar uefi_settings: :vartype uefi_settings: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesSecurityProfileUefiSettings + ~azure.mgmt.azurestackhci.models.VirtualMachineInstancePropertiesSecurityProfileUefiSettings + :ivar security_type: Specifies the SecurityType of the virtual machine. EnableTPM and + SecureBootEnabled must be set to true for SecurityType to function. Known values are: + "TrustedLaunch" and "ConfidentialVM". + :vartype security_type: str or ~azure.mgmt.azurestackhci.models.SecurityTypes """ _attribute_map = { "enable_tpm": {"key": "enableTPM", "type": "bool"}, - "uefi_settings": {"key": "uefiSettings", "type": "VirtualmachinesPropertiesSecurityProfileUefiSettings"}, + "uefi_settings": {"key": "uefiSettings", "type": "VirtualMachineInstancePropertiesSecurityProfileUefiSettings"}, + "security_type": {"key": "securityType", "type": "str"}, } def __init__( self, *, - enable_tpm: Optional[bool] = None, - uefi_settings: Optional["_models.VirtualmachinesPropertiesSecurityProfileUefiSettings"] = None, - **kwargs - ): + enable_tpm: bool = False, + uefi_settings: Optional["_models.VirtualMachineInstancePropertiesSecurityProfileUefiSettings"] = None, + security_type: Optional[Union[str, "_models.SecurityTypes"]] = None, + **kwargs: Any + ) -> None: """ :keyword enable_tpm: :paramtype enable_tpm: bool :keyword uefi_settings: :paramtype uefi_settings: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesSecurityProfileUefiSettings + ~azure.mgmt.azurestackhci.models.VirtualMachineInstancePropertiesSecurityProfileUefiSettings + :keyword security_type: Specifies the SecurityType of the virtual machine. EnableTPM and + SecureBootEnabled must be set to true for SecurityType to function. Known values are: + "TrustedLaunch" and "ConfidentialVM". + :paramtype security_type: str or ~azure.mgmt.azurestackhci.models.SecurityTypes """ super().__init__(**kwargs) self.enable_tpm = enable_tpm self.uefi_settings = uefi_settings + self.security_type = security_type -class VirtualmachinesPropertiesSecurityProfileUefiSettings(_serialization.Model): - """VirtualmachinesPropertiesSecurityProfileUefiSettings. +class VirtualMachineInstancePropertiesSecurityProfileUefiSettings(_serialization.Model): + """VirtualMachineInstancePropertiesSecurityProfileUefiSettings. :ivar secure_boot_enabled: Specifies whether secure boot should be enabled on the virtual - machine. + machine instance. :vartype secure_boot_enabled: bool """ @@ -4587,150 +3872,170 @@ class VirtualmachinesPropertiesSecurityProfileUefiSettings(_serialization.Model) "secure_boot_enabled": {"key": "secureBootEnabled", "type": "bool"}, } - def __init__(self, *, secure_boot_enabled: Optional[bool] = None, **kwargs): + def __init__(self, *, secure_boot_enabled: bool = False, **kwargs: Any) -> None: """ :keyword secure_boot_enabled: Specifies whether secure boot should be enabled on the virtual - machine. + machine instance. :paramtype secure_boot_enabled: bool """ super().__init__(**kwargs) self.secure_boot_enabled = secure_boot_enabled -class VirtualmachinesPropertiesStorageProfile(_serialization.Model): - """StorageProfile - contains information about the disks and storage information for the virtual machine. +class VirtualMachineInstancePropertiesStorageProfile(_serialization.Model): + """StorageProfile - contains information about the disks and storage information for the virtual + machine instance. - :ivar data_disks: adds data disks to the virtual machine. + :ivar data_disks: adds data disks to the virtual machine instance. :vartype data_disks: - list[~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesStorageProfileDataDisksItem] - :ivar image_reference: Which Image to use for the virtual machine. + list[~azure.mgmt.azurestackhci.models.VirtualMachineInstancePropertiesStorageProfileDataDisksItem] + :ivar image_reference: Which Image to use for the virtual machine instance. :vartype image_reference: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesStorageProfileImageReference + ~azure.mgmt.azurestackhci.models.VirtualMachineInstancePropertiesStorageProfileImageReference :ivar os_disk: VHD to attach as OS disk. :vartype os_disk: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesStorageProfileOsDisk - :ivar vm_config_container_name: Name of the storage container that hosts the VM configuration + ~azure.mgmt.azurestackhci.models.VirtualMachineInstancePropertiesStorageProfileOsDisk + :ivar vm_config_storage_path_id: Id of the storage container that hosts the VM configuration file. - :vartype vm_config_container_name: str + :vartype vm_config_storage_path_id: str """ _attribute_map = { - "data_disks": {"key": "dataDisks", "type": "[VirtualmachinesPropertiesStorageProfileDataDisksItem]"}, - "image_reference": {"key": "imageReference", "type": "VirtualmachinesPropertiesStorageProfileImageReference"}, - "os_disk": {"key": "osDisk", "type": "VirtualmachinesPropertiesStorageProfileOsDisk"}, - "vm_config_container_name": {"key": "vmConfigContainerName", "type": "str"}, + "data_disks": {"key": "dataDisks", "type": "[VirtualMachineInstancePropertiesStorageProfileDataDisksItem]"}, + "image_reference": { + "key": "imageReference", + "type": "VirtualMachineInstancePropertiesStorageProfileImageReference", + }, + "os_disk": {"key": "osDisk", "type": "VirtualMachineInstancePropertiesStorageProfileOsDisk"}, + "vm_config_storage_path_id": {"key": "vmConfigStoragePathId", "type": "str"}, } def __init__( self, *, - data_disks: Optional[List["_models.VirtualmachinesPropertiesStorageProfileDataDisksItem"]] = None, - image_reference: Optional["_models.VirtualmachinesPropertiesStorageProfileImageReference"] = None, - os_disk: Optional["_models.VirtualmachinesPropertiesStorageProfileOsDisk"] = None, - vm_config_container_name: Optional[str] = None, - **kwargs - ): - """ - :keyword data_disks: adds data disks to the virtual machine. + data_disks: Optional[List["_models.VirtualMachineInstancePropertiesStorageProfileDataDisksItem"]] = None, + image_reference: Optional["_models.VirtualMachineInstancePropertiesStorageProfileImageReference"] = None, + os_disk: Optional["_models.VirtualMachineInstancePropertiesStorageProfileOsDisk"] = None, + vm_config_storage_path_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword data_disks: adds data disks to the virtual machine instance. :paramtype data_disks: - list[~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesStorageProfileDataDisksItem] - :keyword image_reference: Which Image to use for the virtual machine. + list[~azure.mgmt.azurestackhci.models.VirtualMachineInstancePropertiesStorageProfileDataDisksItem] + :keyword image_reference: Which Image to use for the virtual machine instance. :paramtype image_reference: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesStorageProfileImageReference + ~azure.mgmt.azurestackhci.models.VirtualMachineInstancePropertiesStorageProfileImageReference :keyword os_disk: VHD to attach as OS disk. :paramtype os_disk: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesStorageProfileOsDisk - :keyword vm_config_container_name: Name of the storage container that hosts the VM - configuration file. - :paramtype vm_config_container_name: str + ~azure.mgmt.azurestackhci.models.VirtualMachineInstancePropertiesStorageProfileOsDisk + :keyword vm_config_storage_path_id: Id of the storage container that hosts the VM configuration + file. + :paramtype vm_config_storage_path_id: str """ super().__init__(**kwargs) self.data_disks = data_disks self.image_reference = image_reference self.os_disk = os_disk - self.vm_config_container_name = vm_config_container_name + self.vm_config_storage_path_id = vm_config_storage_path_id -class VirtualmachinesPropertiesStorageProfileDataDisksItem(_serialization.Model): - """VirtualmachinesPropertiesStorageProfileDataDisksItem. +class VirtualMachineInstancePropertiesStorageProfileDataDisksItem(_serialization.Model): + """VirtualMachineInstancePropertiesStorageProfileDataDisksItem. - :ivar name: - :vartype name: str + :ivar id: Resource ID of the data disk. + :vartype id: str """ _attribute_map = { - "name": {"key": "name", "type": "str"}, + "id": {"key": "id", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, **kwargs): + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ - :keyword name: - :paramtype name: str + :keyword id: Resource ID of the data disk. + :paramtype id: str """ super().__init__(**kwargs) - self.name = name + self.id = id -class VirtualmachinesPropertiesStorageProfileImageReference(_serialization.Model): - """Which Image to use for the virtual machine. +class VirtualMachineInstancePropertiesStorageProfileImageReference(_serialization.Model): + """Which Image to use for the virtual machine instance. - :ivar name: Name - Name of the image. - :vartype name: str + :ivar id: Resource ID of the image. + :vartype id: str """ _attribute_map = { - "name": {"key": "name", "type": "str"}, + "id": {"key": "id", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, **kwargs): + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ - :keyword name: Name - Name of the image. - :paramtype name: str + :keyword id: Resource ID of the image. + :paramtype id: str """ super().__init__(**kwargs) - self.name = name + self.id = id -class VirtualmachinesPropertiesStorageProfileOsDisk(_serialization.Model): +class VirtualMachineInstancePropertiesStorageProfileOsDisk(_serialization.Model): """VHD to attach as OS disk. - :ivar id: Specifies the virtual hard disk's ID. + :ivar id: Resource ID of the OS disk. :vartype id: str + :ivar os_type: This property allows you to specify the type of the OS that is included in the + disk if creating a VM from user-image or a specialized VHD. Possible values are: **Windows,** + **Linux.**. Known values are: "Windows" and "Linux". + :vartype os_type: str or ~azure.mgmt.azurestackhci.models.OperatingSystemTypes """ _attribute_map = { "id": {"key": "id", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = None, + **kwargs: Any + ) -> None: """ - :keyword id: Specifies the virtual hard disk's ID. + :keyword id: Resource ID of the OS disk. :paramtype id: str + :keyword os_type: This property allows you to specify the type of the OS that is included in + the disk if creating a VM from user-image or a specialized VHD. Possible values are: + **Windows,** **Linux.**. Known values are: "Windows" and "Linux". + :paramtype os_type: str or ~azure.mgmt.azurestackhci.models.OperatingSystemTypes """ super().__init__(**kwargs) self.id = id + self.os_type = os_type -class VirtualMachineStatus(_serialization.Model): - """VirtualMachineStatus defines the observed state of virtualmachines. +class VirtualMachineInstanceStatus(_serialization.Model): + """The observed state of virtual machine instances. :ivar error_code: VirtualMachine provisioning error code. :vartype error_code: str :ivar error_message: Descriptive error message. :vartype error_message: str - :ivar power_state: The power state of the virtual machine. Known values are: "Deallocated", - "Deallocating", "Running", "Starting", "Stopped", "Stopping", and "Unknown". + :ivar power_state: The power state of the virtual machine instance. Known values are: + "Deallocated", "Deallocating", "Running", "Starting", "Stopped", "Stopping", and "Unknown". :vartype power_state: str or ~azure.mgmt.azurestackhci.models.PowerStateEnum - :ivar provisioning_status: The provisioning status of the virtual machine. + :ivar provisioning_status: :vartype provisioning_status: - ~azure.mgmt.azurestackhci.models.VirtualMachineStatusProvisioningStatus + ~azure.mgmt.azurestackhci.models.VirtualMachineInstanceStatusProvisioningStatus """ _attribute_map = { "error_code": {"key": "errorCode", "type": "str"}, "error_message": {"key": "errorMessage", "type": "str"}, "power_state": {"key": "powerState", "type": "str"}, - "provisioning_status": {"key": "provisioningStatus", "type": "VirtualMachineStatusProvisioningStatus"}, + "provisioning_status": {"key": "provisioningStatus", "type": "VirtualMachineInstanceStatusProvisioningStatus"}, } def __init__( @@ -4739,20 +4044,20 @@ def __init__( error_code: Optional[str] = None, error_message: Optional[str] = None, power_state: Optional[Union[str, "_models.PowerStateEnum"]] = None, - provisioning_status: Optional["_models.VirtualMachineStatusProvisioningStatus"] = None, - **kwargs - ): + provisioning_status: Optional["_models.VirtualMachineInstanceStatusProvisioningStatus"] = None, + **kwargs: Any + ) -> None: """ :keyword error_code: VirtualMachine provisioning error code. :paramtype error_code: str :keyword error_message: Descriptive error message. :paramtype error_message: str - :keyword power_state: The power state of the virtual machine. Known values are: "Deallocated", - "Deallocating", "Running", "Starting", "Stopped", "Stopping", and "Unknown". + :keyword power_state: The power state of the virtual machine instance. Known values are: + "Deallocated", "Deallocating", "Running", "Starting", "Stopped", "Stopping", and "Unknown". :paramtype power_state: str or ~azure.mgmt.azurestackhci.models.PowerStateEnum - :keyword provisioning_status: The provisioning status of the virtual machine. + :keyword provisioning_status: :paramtype provisioning_status: - ~azure.mgmt.azurestackhci.models.VirtualMachineStatusProvisioningStatus + ~azure.mgmt.azurestackhci.models.VirtualMachineInstanceStatusProvisioningStatus """ super().__init__(**kwargs) self.error_code = error_code @@ -4761,14 +4066,14 @@ def __init__( self.provisioning_status = provisioning_status -class VirtualMachineStatusProvisioningStatus(_serialization.Model): - """The provisioning status of the virtual machine. +class VirtualMachineInstanceStatusProvisioningStatus(_serialization.Model): + """VirtualMachineInstanceStatusProvisioningStatus. - :ivar operation_id: The ID of the operation performed on the virtual machine. + :ivar operation_id: The ID of the operation performed on the virtual machine instance. :vartype operation_id: str - :ivar status: The status of the operation performed on the virtual machine [Succeeded, Failed, - InProgress]. Known values are: "Succeeded", "Failed", and "InProgress". - :vartype status: str or ~azure.mgmt.azurestackhci.models.ProvisioningStatusEnum + :ivar status: The status of the operation performed on the virtual machine instance [Succeeded, + Failed, InProgress]. Known values are: "Succeeded", "Failed", and "InProgress". + :vartype status: str or ~azure.mgmt.azurestackhci.models.Status """ _attribute_map = { @@ -4780,38 +4085,41 @@ def __init__( self, *, operation_id: Optional[str] = None, - status: Optional[Union[str, "_models.ProvisioningStatusEnum"]] = None, - **kwargs - ): + status: Optional[Union[str, "_models.Status"]] = None, + **kwargs: Any + ) -> None: """ - :keyword operation_id: The ID of the operation performed on the virtual machine. + :keyword operation_id: The ID of the operation performed on the virtual machine instance. :paramtype operation_id: str - :keyword status: The status of the operation performed on the virtual machine [Succeeded, - Failed, InProgress]. Known values are: "Succeeded", "Failed", and "InProgress". - :paramtype status: str or ~azure.mgmt.azurestackhci.models.ProvisioningStatusEnum + :keyword status: The status of the operation performed on the virtual machine instance + [Succeeded, Failed, InProgress]. Known values are: "Succeeded", "Failed", and "InProgress". + :paramtype status: str or ~azure.mgmt.azurestackhci.models.Status """ super().__init__(**kwargs) self.operation_id = operation_id self.status = status -class VirtualMachineUpdateProperties(_serialization.Model): +class VirtualMachineInstanceUpdateProperties(_serialization.Model): """Defines the resource properties for the update. :ivar hardware_profile: HardwareProfile - Specifies the hardware settings for the virtual - machine. + machine instance. :vartype hardware_profile: ~azure.mgmt.azurestackhci.models.HardwareProfileUpdate :ivar storage_profile: :vartype storage_profile: ~azure.mgmt.azurestackhci.models.StorageProfileUpdate :ivar network_profile: NetworkProfile - describes the network update configuration the virtual - machine. + machine instance. :vartype network_profile: ~azure.mgmt.azurestackhci.models.NetworkProfileUpdate + :ivar os_profile: OsProfile - describes the update configuration of the operating system. + :vartype os_profile: ~azure.mgmt.azurestackhci.models.OsProfileUpdate """ _attribute_map = { "hardware_profile": {"key": "hardwareProfile", "type": "HardwareProfileUpdate"}, "storage_profile": {"key": "storageProfile", "type": "StorageProfileUpdate"}, "network_profile": {"key": "networkProfile", "type": "NetworkProfileUpdate"}, + "os_profile": {"key": "osProfile", "type": "OsProfileUpdate"}, } def __init__( @@ -4820,377 +4128,77 @@ def __init__( hardware_profile: Optional["_models.HardwareProfileUpdate"] = None, storage_profile: Optional["_models.StorageProfileUpdate"] = None, network_profile: Optional["_models.NetworkProfileUpdate"] = None, - **kwargs - ): + os_profile: Optional["_models.OsProfileUpdate"] = None, + **kwargs: Any + ) -> None: """ :keyword hardware_profile: HardwareProfile - Specifies the hardware settings for the virtual - machine. + machine instance. :paramtype hardware_profile: ~azure.mgmt.azurestackhci.models.HardwareProfileUpdate :keyword storage_profile: :paramtype storage_profile: ~azure.mgmt.azurestackhci.models.StorageProfileUpdate :keyword network_profile: NetworkProfile - describes the network update configuration the - virtual machine. + virtual machine instance. :paramtype network_profile: ~azure.mgmt.azurestackhci.models.NetworkProfileUpdate + :keyword os_profile: OsProfile - describes the update configuration of the operating system. + :paramtype os_profile: ~azure.mgmt.azurestackhci.models.OsProfileUpdate """ super().__init__(**kwargs) self.hardware_profile = hardware_profile self.storage_profile = storage_profile self.network_profile = network_profile + self.os_profile = os_profile -class Virtualnetworks(TrackedResource): # pylint: disable=too-many-instance-attributes - """The virtual network resource definition. - - 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 tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar extended_location: The extendedLocation of the resource. - :vartype extended_location: ~azure.mgmt.azurestackhci.models.ExtendedLocation - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.azurestackhci.models.SystemData - :ivar network_type: Type of the network. Known values are: "NAT", "Transparent", "L2Bridge", - "L2Tunnel", "ICS", "Private", "Overlay", "Internal", and "Mirrored". - :vartype network_type: str or ~azure.mgmt.azurestackhci.models.NetworkTypeEnum - :ivar subnets: Subnet - list of subnets under the virtual network. - :vartype subnets: list[~azure.mgmt.azurestackhci.models.VirtualnetworksPropertiesSubnetsItem] - :ivar provisioning_state: Provisioning state of the gallery image. Known values are: - "Succeeded", "Failed", "InProgress", "Accepted", "Deleting", and "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.azurestackhci.models.ProvisioningStateEnum - :ivar resource_name: name of the object to be used in moc. - :vartype resource_name: str - :ivar status: VirtualNetworkStatus defines the observed state of virtual networks. - :vartype status: ~azure.mgmt.azurestackhci.models.VirtualNetworkStatus - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "system_data": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "status": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "network_type": {"key": "properties.networkType", "type": "str"}, - "subnets": {"key": "properties.subnets", "type": "[VirtualnetworksPropertiesSubnetsItem]"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "resource_name": {"key": "properties.resourceName", "type": "str"}, - "status": {"key": "properties.status", "type": "VirtualNetworkStatus"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - extended_location: Optional["_models.ExtendedLocation"] = None, - network_type: Optional[Union[str, "_models.NetworkTypeEnum"]] = None, - subnets: Optional[List["_models.VirtualnetworksPropertiesSubnetsItem"]] = None, - resource_name: Optional[str] = None, - **kwargs - ): - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword extended_location: The extendedLocation of the resource. - :paramtype extended_location: ~azure.mgmt.azurestackhci.models.ExtendedLocation - :keyword network_type: Type of the network. Known values are: "NAT", "Transparent", "L2Bridge", - "L2Tunnel", "ICS", "Private", "Overlay", "Internal", and "Mirrored". - :paramtype network_type: str or ~azure.mgmt.azurestackhci.models.NetworkTypeEnum - :keyword subnets: Subnet - list of subnets under the virtual network. - :paramtype subnets: list[~azure.mgmt.azurestackhci.models.VirtualnetworksPropertiesSubnetsItem] - :keyword resource_name: name of the object to be used in moc. - :paramtype resource_name: str - """ - super().__init__(tags=tags, location=location, **kwargs) - self.extended_location = extended_location - self.system_data = None - self.network_type = network_type - self.subnets = subnets - self.provisioning_state = None - self.resource_name = resource_name - self.status = None - - -class VirtualnetworksListResult(_serialization.Model): - """VirtualnetworksListResult. - - :ivar value: - :vartype value: list[~azure.mgmt.azurestackhci.models.Virtualnetworks] - :ivar next_link: - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Virtualnetworks]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.Virtualnetworks"]] = None, next_link: Optional[str] = None, **kwargs - ): - """ - :keyword value: - :paramtype value: list[~azure.mgmt.azurestackhci.models.Virtualnetworks] - :keyword next_link: - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class VirtualnetworksPatch(_serialization.Model): - """The virtual network resource patch definition. - - :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 VirtualnetworksPropertiesSubnetsItem(_serialization.Model): - """Subnet subnet in a virtual network resource. - - :ivar name: Name - The name of the resource that is unique within a resource group. This name - can be used to access the resource. - :vartype name: str - :ivar address_prefix: Cidr for this subnet - IPv4, IPv6. - :vartype address_prefix: str - :ivar address_prefixes: AddressPrefixes - List of address prefixes for the subnet. - :vartype address_prefixes: list[str] - :ivar ip_allocation_method: IPAllocationMethod - The IP address allocation method. Possible - values include: 'Static', 'Dynamic'. Known values are: "Dynamic" and "Static". - :vartype ip_allocation_method: str or ~azure.mgmt.azurestackhci.models.IpAllocationMethodEnum - :ivar ip_configuration_references: IPConfigurationReferences - list of - IPConfigurationReferences. - :vartype ip_configuration_references: - list[~azure.mgmt.azurestackhci.models.ComponentsVqks9HSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesIpconfigurationreferencesItems] - :ivar route_table: RouteTable for the subnet. - :vartype route_table: - ~azure.mgmt.azurestackhci.models.ComponentsL15GkaSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesRoutetable - :ivar ip_pools: network associated pool of IP Addresses. - :vartype ip_pools: list[~azure.mgmt.azurestackhci.models.IPPool] - :ivar vlan: Vlan to use for the subnet. - :vartype vlan: int - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "address_prefix": {"key": "properties.addressPrefix", "type": "str"}, - "address_prefixes": {"key": "properties.addressPrefixes", "type": "[str]"}, - "ip_allocation_method": {"key": "properties.ipAllocationMethod", "type": "str"}, - "ip_configuration_references": { - "key": "properties.ipConfigurationReferences", - "type": "[ComponentsVqks9HSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesIpconfigurationreferencesItems]", - }, - "route_table": { - "key": "properties.routeTable", - "type": "ComponentsL15GkaSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesRoutetable", - }, - "ip_pools": {"key": "properties.ipPools", "type": "[IPPool]"}, - "vlan": {"key": "properties.vlan", "type": "int"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - address_prefix: Optional[str] = None, - address_prefixes: Optional[List[str]] = None, - ip_allocation_method: Optional[Union[str, "_models.IpAllocationMethodEnum"]] = None, - ip_configuration_references: Optional[ - List[ - "_models.ComponentsVqks9HSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesIpconfigurationreferencesItems" - ] - ] = None, - route_table: Optional[ - "_models.ComponentsL15GkaSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesRoutetable" - ] = None, - ip_pools: Optional[List["_models.IPPool"]] = None, - vlan: Optional[int] = None, - **kwargs - ): - """ - :keyword name: Name - The name of the resource that is unique within a resource group. This - name can be used to access the resource. - :paramtype name: str - :keyword address_prefix: Cidr for this subnet - IPv4, IPv6. - :paramtype address_prefix: str - :keyword address_prefixes: AddressPrefixes - List of address prefixes for the subnet. - :paramtype address_prefixes: list[str] - :keyword ip_allocation_method: IPAllocationMethod - The IP address allocation method. Possible - values include: 'Static', 'Dynamic'. Known values are: "Dynamic" and "Static". - :paramtype ip_allocation_method: str or ~azure.mgmt.azurestackhci.models.IpAllocationMethodEnum - :keyword ip_configuration_references: IPConfigurationReferences - list of - IPConfigurationReferences. - :paramtype ip_configuration_references: - list[~azure.mgmt.azurestackhci.models.ComponentsVqks9HSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesIpconfigurationreferencesItems] - :keyword route_table: RouteTable for the subnet. - :paramtype route_table: - ~azure.mgmt.azurestackhci.models.ComponentsL15GkaSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesRoutetable - :keyword ip_pools: network associated pool of IP Addresses. - :paramtype ip_pools: list[~azure.mgmt.azurestackhci.models.IPPool] - :keyword vlan: Vlan to use for the subnet. - :paramtype vlan: int - """ - super().__init__(**kwargs) - self.name = name - self.address_prefix = address_prefix - self.address_prefixes = address_prefixes - self.ip_allocation_method = ip_allocation_method - self.ip_configuration_references = ip_configuration_references - self.route_table = route_table - self.ip_pools = ip_pools - self.vlan = vlan - - -class VirtualnetworksPropertiesSubnetsPropertiesItemsItem(_serialization.Model): - """Route is associated with a subnet. - - :ivar name: Name - name of the subnet. - :vartype name: str - :ivar address_prefix: AddressPrefix - The destination CIDR to which the route applies. - :vartype address_prefix: str - :ivar next_hop_ip_address: NextHopIPAddress - The IP address packets should be forwarded to. - Next hop values are only allowed in routes where the next hop type is VirtualAppliance. - :vartype next_hop_ip_address: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "address_prefix": {"key": "properties.addressPrefix", "type": "str"}, - "next_hop_ip_address": {"key": "properties.nextHopIpAddress", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - address_prefix: Optional[str] = None, - next_hop_ip_address: Optional[str] = None, - **kwargs - ): - """ - :keyword name: Name - name of the subnet. - :paramtype name: str - :keyword address_prefix: AddressPrefix - The destination CIDR to which the route applies. - :paramtype address_prefix: str - :keyword next_hop_ip_address: NextHopIPAddress - The IP address packets should be forwarded to. - Next hop values are only allowed in routes where the next hop type is VirtualAppliance. - :paramtype next_hop_ip_address: str - """ - super().__init__(**kwargs) - self.name = name - self.address_prefix = address_prefix - self.next_hop_ip_address = next_hop_ip_address - - -class VirtualNetworkStatus(_serialization.Model): - """VirtualNetworkStatus defines the observed state of virtual networks. +class VirtualMachineInstanceUpdateRequest(_serialization.Model): + """The virtual machine instance resource patch definition. - :ivar error_code: VirtualNetwork provisioning error code. - :vartype error_code: str - :ivar error_message: Descriptive error message. - :vartype error_message: str - :ivar provisioning_status: The provisioning status of the virtual network. - :vartype provisioning_status: - ~azure.mgmt.azurestackhci.models.VirtualNetworkStatusProvisioningStatus + :ivar properties: Defines the resource properties for the update. + :vartype properties: ~azure.mgmt.azurestackhci.models.VirtualMachineInstanceUpdateProperties + :ivar identity: Identity for the resource. + :vartype identity: ~azure.mgmt.azurestackhci.models.Identity """ _attribute_map = { - "error_code": {"key": "errorCode", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - "provisioning_status": {"key": "provisioningStatus", "type": "VirtualNetworkStatusProvisioningStatus"}, + "properties": {"key": "properties", "type": "VirtualMachineInstanceUpdateProperties"}, + "identity": {"key": "identity", "type": "Identity"}, } def __init__( self, *, - error_code: Optional[str] = None, - error_message: Optional[str] = None, - provisioning_status: Optional["_models.VirtualNetworkStatusProvisioningStatus"] = None, - **kwargs - ): + properties: Optional["_models.VirtualMachineInstanceUpdateProperties"] = None, + identity: Optional["_models.Identity"] = None, + **kwargs: Any + ) -> None: """ - :keyword error_code: VirtualNetwork provisioning error code. - :paramtype error_code: str - :keyword error_message: Descriptive error message. - :paramtype error_message: str - :keyword provisioning_status: The provisioning status of the virtual network. - :paramtype provisioning_status: - ~azure.mgmt.azurestackhci.models.VirtualNetworkStatusProvisioningStatus + :keyword properties: Defines the resource properties for the update. + :paramtype properties: ~azure.mgmt.azurestackhci.models.VirtualMachineInstanceUpdateProperties + :keyword identity: Identity for the resource. + :paramtype identity: ~azure.mgmt.azurestackhci.models.Identity """ super().__init__(**kwargs) - self.error_code = error_code - self.error_message = error_message - self.provisioning_status = provisioning_status + self.properties = properties + self.identity = identity -class VirtualNetworkStatusProvisioningStatus(_serialization.Model): - """The provisioning status of the virtual network. +class VirtualMachineInstanceView(_serialization.Model): + """The instance view of a virtual machine. - :ivar operation_id: The ID of the operation performed on the virtual network. - :vartype operation_id: str - :ivar status: The status of the operation performed on the virtual network [Succeeded, Failed, - InProgress]. Known values are: "Succeeded", "Failed", and "InProgress". - :vartype status: str or ~azure.mgmt.azurestackhci.models.ProvisioningStatusEnum + :ivar vm_agent: The VM Config Agent running on the virtual machine. + :vartype vm_agent: ~azure.mgmt.azurestackhci.models.VirtualMachineConfigAgentInstanceView """ _attribute_map = { - "operation_id": {"key": "operationId", "type": "str"}, - "status": {"key": "status", "type": "str"}, + "vm_agent": {"key": "vmAgent", "type": "VirtualMachineConfigAgentInstanceView"}, } def __init__( - self, - *, - operation_id: Optional[str] = None, - status: Optional[Union[str, "_models.ProvisioningStatusEnum"]] = None, - **kwargs - ): + self, *, vm_agent: Optional["_models.VirtualMachineConfigAgentInstanceView"] = None, **kwargs: Any + ) -> None: """ - :keyword operation_id: The ID of the operation performed on the virtual network. - :paramtype operation_id: str - :keyword status: The status of the operation performed on the virtual network [Succeeded, - Failed, InProgress]. Known values are: "Succeeded", "Failed", and "InProgress". - :paramtype status: str or ~azure.mgmt.azurestackhci.models.ProvisioningStatusEnum + :keyword vm_agent: The VM Config Agent running on the virtual machine. + :paramtype vm_agent: ~azure.mgmt.azurestackhci.models.VirtualMachineConfigAgentInstanceView """ super().__init__(**kwargs) - self.operation_id = operation_id - self.status = status + self.vm_agent = vm_agent diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/__init__.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/__init__.py index ed88648db3111..1ff6bf5d9fef8 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/__init__.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/__init__.py @@ -6,42 +6,34 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._arc_settings_operations import ArcSettingsOperations -from ._clusters_operations import ClustersOperations -from ._extensions_operations import ExtensionsOperations -from ._galleryimages_operations import GalleryimagesOperations -from ._marketplacegalleryimages_operations import MarketplacegalleryimagesOperations -from ._networkinterfaces_operations import NetworkinterfacesOperations +from ._gallery_images_operations import GalleryImagesOperations from ._operations import Operations -from ._storagecontainers_operations import StoragecontainersOperations -from ._virtualharddisks_operations import VirtualharddisksOperations -from ._virtualmachines_operations import VirtualmachinesOperations +from ._logical_networks_operations import LogicalNetworksOperations +from ._marketplace_gallery_images_operations import MarketplaceGalleryImagesOperations +from ._network_interfaces_operations import NetworkInterfacesOperations +from ._storage_containers_operations import StorageContainersOperations +from ._virtual_hard_disks_operations import VirtualHardDisksOperations +from ._virtual_machine_instances_operations import VirtualMachineInstancesOperations from ._hybrid_identity_metadata_operations import HybridIdentityMetadataOperations -from ._machine_extensions_operations import MachineExtensionsOperations from ._guest_agent_operations import GuestAgentOperations from ._guest_agents_operations import GuestAgentsOperations -from ._virtualnetworks_operations import VirtualnetworksOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - "ArcSettingsOperations", - "ClustersOperations", - "ExtensionsOperations", - "GalleryimagesOperations", - "MarketplacegalleryimagesOperations", - "NetworkinterfacesOperations", + "GalleryImagesOperations", "Operations", - "StoragecontainersOperations", - "VirtualharddisksOperations", - "VirtualmachinesOperations", + "LogicalNetworksOperations", + "MarketplaceGalleryImagesOperations", + "NetworkInterfacesOperations", + "StorageContainersOperations", + "VirtualHardDisksOperations", + "VirtualMachineInstancesOperations", "HybridIdentityMetadataOperations", - "MachineExtensionsOperations", "GuestAgentOperations", "GuestAgentsOperations", - "VirtualnetworksOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_arc_settings_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_arc_settings_operations.py deleted file mode 100644 index a69d7a3cac84b..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_arc_settings_operations.py +++ /dev/null @@ -1,655 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- -import sys -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 - -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]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_cluster_request( - resource_group_name: str, cluster_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_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_get_request( - resource_group_name: str, cluster_name: str, arc_setting_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "arcSettingName": _SERIALIZER.url("arc_setting_name", arc_setting_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_create_request( - resource_group_name: str, cluster_name: str, arc_setting_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "arcSettingName": _SERIALIZER.url("arc_setting_name", arc_setting_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_delete_request( - resource_group_name: str, cluster_name: str, arc_setting_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "arcSettingName": _SERIALIZER.url("arc_setting_name", arc_setting_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) - - -class ArcSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.azurestackhci.AzureStackHCIClient`'s - :attr:`arc_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_cluster( - self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> Iterable["_models.ArcSetting"]: - """Get ArcSetting resources of HCI Cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ArcSetting or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.ArcSetting] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ArcSettingList] = 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_cluster_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_cluster.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("ArcSettingList", 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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_cluster.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings" - } - - @distributed_trace - def get( - self, resource_group_name: str, cluster_name: str, arc_setting_name: str, **kwargs: Any - ) -> _models.ArcSetting: - """Get ArcSetting resource details of HCI Cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. Required. - :type arc_setting_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ArcSetting or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.ArcSetting - :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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ArcSetting] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - arc_setting_name=arc_setting_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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("ArcSetting", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}" - } - - @overload - def create( - self, - resource_group_name: str, - cluster_name: str, - arc_setting_name: str, - arc_setting: _models.ArcSetting, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ArcSetting: - """Create ArcSetting for HCI cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. Required. - :type arc_setting_name: str - :param arc_setting: Parameters supplied to the Create ArcSetting resource for this HCI cluster. - Required. - :type arc_setting: ~azure.mgmt.azurestackhci.models.ArcSetting - :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: ArcSetting or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.ArcSetting - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - resource_group_name: str, - cluster_name: str, - arc_setting_name: str, - arc_setting: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ArcSetting: - """Create ArcSetting for HCI cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. Required. - :type arc_setting_name: str - :param arc_setting: Parameters supplied to the Create ArcSetting resource for this HCI cluster. - Required. - :type arc_setting: 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: ArcSetting or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.ArcSetting - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, - resource_group_name: str, - cluster_name: str, - arc_setting_name: str, - arc_setting: Union[_models.ArcSetting, IO], - **kwargs: Any - ) -> _models.ArcSetting: - """Create ArcSetting for HCI cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. Required. - :type arc_setting_name: str - :param arc_setting: Parameters supplied to the Create ArcSetting resource for this HCI cluster. - Is either a model type or a IO type. Required. - :type arc_setting: ~azure.mgmt.azurestackhci.models.ArcSetting 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: ArcSetting or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.ArcSetting - :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: Literal["2021-09-01-preview"] = 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.ArcSetting] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(arc_setting, (IO, bytes)): - _content = arc_setting - else: - _json = self._serialize.body(arc_setting, "ArcSetting") - - request = build_create_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - arc_setting_name=arc_setting_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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("ArcSetting", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, cluster_name: str, arc_setting_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: Literal["2021-09-01-preview"] = 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, - cluster_name=cluster_name, - arc_setting_name=arc_setting_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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}" - } - - @distributed_trace - def begin_delete( - self, resource_group_name: str, cluster_name: str, arc_setting_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete ArcSetting resource details of HCI Cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. Required. - :type arc_setting_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: Literal["2021-09-01-preview"] = 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, - cluster_name=cluster_name, - arc_setting_name=arc_setting_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, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}" - } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_clusters_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_clusters_operations.py deleted file mode 100644 index d77bb0ad16dfb..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_clusters_operations.py +++ /dev/null @@ -1,839 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- -import sys -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 - -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]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/clusters") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _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_by_resource_group_request(resource_group_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _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_get_request(resource_group_name: str, cluster_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_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_create_request( - resource_group_name: str, cluster_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_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, cluster_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_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, cluster_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_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) - - -class ClustersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.azurestackhci.AzureStackHCIClient`'s - :attr:`clusters` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Cluster"]: - """List all HCI clusters in a subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Cluster or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Cluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ClusterList] = 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_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.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("ClusterList", 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/clusters" - } - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Cluster"]: - """List all HCI clusters in a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Cluster or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Cluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ClusterList] = 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_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.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("ClusterList", 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters" - } - - @distributed_trace - def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _models.Cluster: - """Get HCI cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Cluster or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Cluster - :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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Cluster] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - cluster_name=cluster_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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("Cluster", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}" - } - - @overload - def create( - self, - resource_group_name: str, - cluster_name: str, - cluster: _models.Cluster, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Cluster: - """Create an HCI cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param cluster: Details of the HCI cluster. Required. - :type cluster: ~azure.mgmt.azurestackhci.models.Cluster - :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: Cluster or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Cluster - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - resource_group_name: str, - cluster_name: str, - cluster: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Cluster: - """Create an HCI cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param cluster: Details of the HCI cluster. Required. - :type cluster: 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: Cluster or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Cluster - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, resource_group_name: str, cluster_name: str, cluster: Union[_models.Cluster, IO], **kwargs: Any - ) -> _models.Cluster: - """Create an HCI cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param cluster: Details of the HCI cluster. Is either a model type or a IO type. Required. - :type cluster: ~azure.mgmt.azurestackhci.models.Cluster 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: Cluster or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Cluster - :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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Cluster] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(cluster, (IO, bytes)): - _content = cluster - else: - _json = self._serialize.body(cluster, "Cluster") - - request = build_create_request( - resource_group_name=resource_group_name, - cluster_name=cluster_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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("Cluster", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}" - } - - @overload - def update( - self, - resource_group_name: str, - cluster_name: str, - cluster: _models.ClusterPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Cluster: - """Update an HCI cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param cluster: Details of the HCI cluster. Required. - :type cluster: ~azure.mgmt.azurestackhci.models.ClusterPatch - :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: Cluster or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Cluster - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - cluster_name: str, - cluster: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Cluster: - """Update an HCI cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param cluster: Details of the HCI cluster. Required. - :type cluster: 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: Cluster or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Cluster - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, resource_group_name: str, cluster_name: str, cluster: Union[_models.ClusterPatch, IO], **kwargs: Any - ) -> _models.Cluster: - """Update an HCI cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param cluster: Details of the HCI cluster. Is either a model type or a IO type. Required. - :type cluster: ~azure.mgmt.azurestackhci.models.ClusterPatch 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: Cluster or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Cluster - :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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Cluster] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(cluster, (IO, bytes)): - _content = cluster - else: - _json = self._serialize.body(cluster, "ClusterPatch") - - request = build_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("Cluster", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}" - } - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> None: - """Delete an HCI cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_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: Literal["2021-09-01-preview"] = 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, - cluster_name=cluster_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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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.AzureStackHCI/clusters/{clusterName}" - } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_machine_extensions_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_gallery_images_operations.py similarity index 64% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_machine_extensions_operations.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_gallery_images_operations.py index 4e40c42839040..ef17ca3413f59 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_machine_extensions_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_gallery_images_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +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]] @@ -43,72 +39,77 @@ _SERIALIZER.client_side_validation = False -def build_create_or_update_request( - resource_group_name: str, name: str, extension_name: str, subscription_id: str, **kwargs: Any +def build_get_request( + resource_group_name: str, gallery_image_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "name": _SERIALIZER.url("name", name, "str"), - "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), + "galleryImageName": _SERIALIZER.url( + "gallery_image_name", + gallery_image_name, + "str", + max_length=80, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[a-zA-Z0-9]$", + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # 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) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_request( - resource_group_name: str, name: str, extension_name: str, subscription_id: str, **kwargs: Any +def build_create_or_update_request( + resource_group_name: str, gallery_image_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) 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.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "name": _SERIALIZER.url("name", name, "str"), - "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), + "galleryImageName": _SERIALIZER.url( + "gallery_image_name", + gallery_image_name, + "str", + max_length=80, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[a-zA-Z0-9]$", + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -118,35 +119,39 @@ def build_update_request( _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) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - resource_group_name: str, name: str, extension_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, gallery_image_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "name": _SERIALIZER.url("name", name, "str"), - "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), + "galleryImageName": _SERIALIZER.url( + "gallery_image_name", + gallery_image_name, + "str", + max_length=80, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[a-zA-Z0-9]$", + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -157,72 +162,96 @@ def build_delete_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - resource_group_name: str, name: str, extension_name: str, subscription_id: str, **kwargs: Any +def build_update_request( + resource_group_name: str, gallery_image_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + 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.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "name": _SERIALIZER.url("name", name, "str"), - "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), + "galleryImageName": _SERIALIZER.url( + "gallery_image_name", + gallery_image_name, + "str", + max_length=80, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[a-zA-Z0-9]$", + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # 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="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_virtual_machines_request( - resource_group_name: str, name: str, subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any -) -> HttpRequest: +def build_list_request(resource_group_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{name}/extensions", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "name": _SERIALIZER.url("name", name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_all_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/galleryImages") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**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") @@ -230,14 +259,14 @@ def build_list_by_virtual_machines_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -class MachineExtensionsOperations: +class GalleryImagesOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.azurestackhci.AzureStackHCIClient`'s - :attr:`machine_extensions` attribute. + :attr:`gallery_images` attribute. """ models = _models @@ -249,14 +278,76 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace + def get(self, resource_group_name: str, gallery_image_name: str, **kwargs: Any) -> _models.GalleryImages: + """Gets a gallery image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_image_name: Name of the gallery image. Required. + :type gallery_image_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GalleryImages or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.GalleryImages + :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.GalleryImages] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + gallery_image_name=gallery_image_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("GalleryImages", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}" + } + def _create_or_update_initial( self, resource_group_name: str, - name: str, - extension_name: str, - extension_parameters: Union[_models.MachineExtension, IO], + gallery_image_name: str, + gallery_images: Union[_models.GalleryImages, IO], **kwargs: Any - ) -> _models.MachineExtension: + ) -> _models.GalleryImages: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -268,24 +359,21 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MachineExtension] = kwargs.pop("cls", None) + cls: ClsType[_models.GalleryImages] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(extension_parameters, (IO, bytes)): - _content = extension_parameters + if isinstance(gallery_images, (IOBase, bytes)): + _content = gallery_images else: - _json = self._serialize.body(extension_parameters, "MachineExtension") + _json = self._serialize.body(gallery_images, "GalleryImages") request = build_create_or_update_request( resource_group_name=resource_group_name, - name=name, - extension_name=extension_name, + gallery_image_name=gallery_image_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -298,8 +386,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 @@ -310,10 +399,10 @@ def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("MachineExtension", pipeline_response) + deserialized = self._deserialize("GalleryImages", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("MachineExtension", pipeline_response) + deserialized = self._deserialize("GalleryImages", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -321,33 +410,29 @@ def _create_or_update_initial( return deserialized # type: ignore _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}" } @overload def begin_create_or_update( self, resource_group_name: str, - name: str, - extension_name: str, - extension_parameters: _models.MachineExtension, + gallery_image_name: str, + gallery_images: _models.GalleryImages, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.MachineExtension]: - """The operation to create or update the extension. + ) -> LROPoller[_models.GalleryImages]: + """The operation to create or update a gallery image. Please note some properties can be set only + during gallery image creation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param name: The name of the machine where the extension should be created or updated. - Required. - :type 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.azurestackhci.models.MachineExtension + :param gallery_image_name: Name of the gallery image. Required. + :type gallery_image_name: str + :param gallery_images: Required. + :type gallery_images: ~azure.mgmt.azurestackhci.models.GalleryImages :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -359,9 +444,9 @@ def begin_create_or_update( :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 + :return: An instance of LROPoller that returns either GalleryImages or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.MachineExtension] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.GalleryImages] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -369,26 +454,22 @@ def begin_create_or_update( def begin_create_or_update( self, resource_group_name: str, - name: str, - extension_name: str, - extension_parameters: IO, + gallery_image_name: str, + gallery_images: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.MachineExtension]: - """The operation to create or update the extension. + ) -> LROPoller[_models.GalleryImages]: + """The operation to create or update a gallery image. Please note some properties can be set only + during gallery image creation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param name: The name of the machine where the extension should be created or updated. - Required. - :type 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 + :param gallery_image_name: Name of the gallery image. Required. + :type gallery_image_name: str + :param gallery_images: Required. + :type gallery_images: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -400,9 +481,9 @@ def begin_create_or_update( :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 + :return: An instance of LROPoller that returns either GalleryImages or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.MachineExtension] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.GalleryImages] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -410,24 +491,20 @@ def begin_create_or_update( def begin_create_or_update( self, resource_group_name: str, - name: str, - extension_name: str, - extension_parameters: Union[_models.MachineExtension, IO], + gallery_image_name: str, + gallery_images: Union[_models.GalleryImages, IO], **kwargs: Any - ) -> LROPoller[_models.MachineExtension]: - """The operation to create or update the extension. + ) -> LROPoller[_models.GalleryImages]: + """The operation to create or update a gallery image. Please note some properties can be set only + during gallery image creation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param name: The name of the machine where the extension should be created or updated. - Required. - :type 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 model type or a IO type. Required. - :type extension_parameters: ~azure.mgmt.azurestackhci.models.MachineExtension or IO + :param gallery_image_name: Name of the gallery image. Required. + :type gallery_image_name: str + :param gallery_images: Is either a GalleryImages type or a IO type. Required. + :type gallery_images: ~azure.mgmt.azurestackhci.models.GalleryImages or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -439,28 +516,25 @@ def begin_create_or_update( :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 + :return: An instance of LROPoller that returns either GalleryImages or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.MachineExtension] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.GalleryImages] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MachineExtension] = kwargs.pop("cls", None) + cls: ClsType[_models.GalleryImages] = 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, - name=name, - extension_name=extension_name, - extension_parameters=extension_parameters, + gallery_image_name=gallery_image_name, + gallery_images=gallery_images, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -471,7 +545,7 @@ def begin_create_or_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MachineExtension", pipeline_response) + deserialized = self._deserialize("GalleryImages", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized @@ -494,17 +568,134 @@ def get_long_running_output(pipeline_response): 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.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, gallery_image_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, + gallery_image_name=gallery_image_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) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, gallery_image_name: str, **kwargs: Any) -> LROPoller[None]: + """The operation to delete a gallery image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gallery_image_name: Name of the gallery image. Required. + :type gallery_image_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, + gallery_image_name=gallery_image_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, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}" } def _update_initial( self, resource_group_name: str, - name: str, - extension_name: str, - extension_parameters: Union[_models.MachineExtensionUpdate, IO], + gallery_image_name: str, + gallery_images: Union[_models.GalleryImagesUpdateRequest, IO], **kwargs: Any - ) -> _models.MachineExtension: + ) -> Optional[_models.GalleryImages]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -516,24 +707,21 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MachineExtension] = kwargs.pop("cls", None) + cls: ClsType[Optional[_models.GalleryImages]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(extension_parameters, (IO, bytes)): - _content = extension_parameters + if isinstance(gallery_images, (IOBase, bytes)): + _content = gallery_images else: - _json = self._serialize.body(extension_parameters, "MachineExtensionUpdate") + _json = self._serialize.body(gallery_images, "GalleryImagesUpdateRequest") request = build_update_request( resource_group_name=resource_group_name, - name=name, - extension_name=extension_name, + gallery_image_name=gallery_image_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -546,56 +734,54 @@ 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 - if response.status_code not in [200, 201]: + 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) + deserialized = self._deserialize("GalleryImages", pipeline_response) - if response.status_code == 201: - deserialized = self._deserialize("MachineExtension", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) - return deserialized # type: ignore + return deserialized _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}" } @overload def begin_update( self, resource_group_name: str, - name: str, - extension_name: str, - extension_parameters: _models.MachineExtensionUpdate, + gallery_image_name: str, + gallery_images: _models.GalleryImagesUpdateRequest, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.MachineExtension]: - """The operation to update the extension. + ) -> LROPoller[_models.GalleryImages]: + """The operation to update a gallery image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param name: The name of the machine where the extension should be created or updated. - Required. - :type 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.azurestackhci.models.MachineExtensionUpdate + :param gallery_image_name: Name of the gallery image. Required. + :type gallery_image_name: str + :param gallery_images: Required. + :type gallery_images: ~azure.mgmt.azurestackhci.models.GalleryImagesUpdateRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -607,9 +793,9 @@ def begin_update( :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 + :return: An instance of LROPoller that returns either GalleryImages or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.MachineExtension] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.GalleryImages] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -617,26 +803,21 @@ def begin_update( def begin_update( self, resource_group_name: str, - name: str, - extension_name: str, - extension_parameters: IO, + gallery_image_name: str, + gallery_images: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.MachineExtension]: - """The operation to update the extension. + ) -> LROPoller[_models.GalleryImages]: + """The operation to update a gallery image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param name: The name of the machine where the extension should be created or updated. - Required. - :type 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 + :param gallery_image_name: Name of the gallery image. Required. + :type gallery_image_name: str + :param gallery_images: Required. + :type gallery_images: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -648,9 +829,9 @@ def begin_update( :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 + :return: An instance of LROPoller that returns either GalleryImages or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.MachineExtension] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.GalleryImages] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -658,24 +839,19 @@ def begin_update( def begin_update( self, resource_group_name: str, - name: str, - extension_name: str, - extension_parameters: Union[_models.MachineExtensionUpdate, IO], + gallery_image_name: str, + gallery_images: Union[_models.GalleryImagesUpdateRequest, IO], **kwargs: Any - ) -> LROPoller[_models.MachineExtension]: - """The operation to update the extension. + ) -> LROPoller[_models.GalleryImages]: + """The operation to update a gallery image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param name: The name of the machine where the extension should be created or updated. - Required. - :type 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 model type or a IO type. Required. - :type extension_parameters: ~azure.mgmt.azurestackhci.models.MachineExtensionUpdate or IO + :param gallery_image_name: Name of the gallery image. Required. + :type gallery_image_name: str + :param gallery_images: Is either a GalleryImagesUpdateRequest type or a IO type. Required. + :type gallery_images: ~azure.mgmt.azurestackhci.models.GalleryImagesUpdateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -687,28 +863,25 @@ def begin_update( :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 + :return: An instance of LROPoller that returns either GalleryImages or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.MachineExtension] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.GalleryImages] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MachineExtension] = kwargs.pop("cls", None) + cls: ClsType[_models.GalleryImages] = 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, - name=name, - extension_name=extension_name, - extension_parameters=extension_parameters, + gallery_image_name=gallery_image_name, + gallery_images=gallery_images, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -719,13 +892,15 @@ def begin_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MachineExtension", pipeline_response) + deserialized = self._deserialize("GalleryImages", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + 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: @@ -740,144 +915,28 @@ def get_long_running_output(pipeline_response): return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, 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: Literal["2021-09-01-preview"] = 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, - name=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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}" } @distributed_trace - def begin_delete(self, resource_group_name: str, name: str, extension_name: str, **kwargs: Any) -> LROPoller[None]: - """The operation to delete the extension. + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.GalleryImages"]: + """Lists all of the gallery images in the specified resource group. Use the nextLink property in + the response to get the next page of gallery images. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param name: The name of the machine where the extension should be deleted. Required. - :type 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] + :return: An iterator like instance of either GalleryImages or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.GalleryImages] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = 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, - name=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.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}" - } - - @distributed_trace - def get(self, resource_group_name: str, name: str, extension_name: str, **kwargs: Any) -> _models.MachineExtension: - """The operation to get the extension. + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GalleryImagesListResult] = kwargs.pop("cls", None) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param name: The name of the machine containing the extension. Required. - :type 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.azurestackhci.models.MachineExtension - :raises ~azure.core.exceptions.HttpResponseError: - """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -886,74 +945,82 @@ def get(self, resource_group_name: str, name: str, extension_name: str, **kwargs } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def prepare_request(next_link=None): + if not next_link: - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.MachineExtension] = kwargs.pop("cls", None) + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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) - request = build_get_request( - resource_group_name=resource_group_name, - name=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) + 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 - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) + def extract_data(pipeline_response): + deserialized = self._deserialize("GalleryImagesListResult", 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) - response = pipeline_response.http_response + def get_next(next_link=None): + request = prepare_request(next_link) - 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) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - deserialized = self._deserialize("MachineExtension", pipeline_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) - if cls: - return cls(pipeline_response, deserialized, {}) + return pipeline_response - return deserialized + return ItemPaged(get_next, extract_data) - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}" + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages" } @distributed_trace - def list_by_virtual_machines( - self, resource_group_name: str, name: str, expand: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.MachineExtension"]: - """The operation to get all extensions of a non-Azure machine. + def list_all(self, **kwargs: Any) -> Iterable["_models.GalleryImages"]: + """Lists all of the gallery images in the specified subscription. Use the nextLink property in the + response to get the next page of gallery images. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param name: The name of the machine containing the extension. Required. - :type 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.azurestackhci.models.MachineExtension] + :return: An iterator like instance of either GalleryImages or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.GalleryImages] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.MachineExtensionsListResult] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GalleryImagesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -966,13 +1033,10 @@ def list_by_virtual_machines( def prepare_request(next_link=None): if not next_link: - request = build_list_by_virtual_machines_request( - resource_group_name=resource_group_name, - name=name, + request = build_list_all_request( subscription_id=self._config.subscription_id, - expand=expand, api_version=api_version, - template_url=self.list_by_virtual_machines.metadata["url"], + template_url=self.list_all.metadata["url"], headers=_headers, params=_params, ) @@ -998,7 +1062,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize("MachineExtensionsListResult", pipeline_response) + deserialized = self._deserialize("GalleryImagesListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -1007,8 +1071,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 @@ -1021,6 +1086,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_virtual_machines.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{name}/extensions" - } + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/galleryImages"} diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_galleryimages_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_galleryimages_operations.py deleted file mode 100644 index 1f9810b41de5e..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_galleryimages_operations.py +++ /dev/null @@ -1,950 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- -import sys -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 - -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]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_retrieve_request( - resource_group_name: str, galleryimages_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages/{galleryimagesName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryimagesName": _SERIALIZER.url( - "galleryimages_name", galleryimages_name, "str", max_length=64, min_length=3 - ), - } - - _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_create_or_update_request( - resource_group_name: str, galleryimages_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages/{galleryimagesName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryimagesName": _SERIALIZER.url( - "galleryimages_name", galleryimages_name, "str", max_length=64, min_length=3 - ), - } - - _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_delete_request( - resource_group_name: str, galleryimages_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages/{galleryimagesName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryimagesName": _SERIALIZER.url( - "galleryimages_name", galleryimages_name, "str", max_length=64, min_length=3 - ), - } - - _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_update_request( - resource_group_name: str, galleryimages_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages/{galleryimagesName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "galleryimagesName": _SERIALIZER.url( - "galleryimages_name", galleryimages_name, "str", max_length=64, min_length=3 - ), - } - - _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_list_by_resource_group_request(resource_group_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _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_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/galleryimages") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _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 GalleryimagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.azurestackhci.AzureStackHCIClient`'s - :attr:`galleryimages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def retrieve(self, resource_group_name: str, galleryimages_name: str, **kwargs: Any) -> _models.Galleryimages: - """Gets galleryimages by resource name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param galleryimages_name: Name of the gallery image. Required. - :type galleryimages_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Galleryimages or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Galleryimages - :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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Galleryimages] = kwargs.pop("cls", None) - - request = build_retrieve_request( - resource_group_name=resource_group_name, - galleryimages_name=galleryimages_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.retrieve.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("Galleryimages", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - retrieve.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages/{galleryimagesName}" - } - - def _create_or_update_initial( - self, - resource_group_name: str, - galleryimages_name: str, - galleryimages: Union[_models.Galleryimages, IO], - **kwargs: Any - ) -> _models.Galleryimages: - 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: Literal["2021-09-01-preview"] = 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.Galleryimages] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(galleryimages, (IO, bytes)): - _content = galleryimages - else: - _json = self._serialize.body(galleryimages, "Galleryimages") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - galleryimages_name=galleryimages_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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("Galleryimages", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Galleryimages", 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.AzureStackHCI/galleryimages/{galleryimagesName}" - } - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - galleryimages_name: str, - galleryimages: _models.Galleryimages, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Galleryimages]: - """Create or update a gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param galleryimages_name: Name of the gallery image. Required. - :type galleryimages_name: str - :param galleryimages: Required. - :type galleryimages: ~azure.mgmt.azurestackhci.models.Galleryimages - :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 Galleryimages or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Galleryimages] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - galleryimages_name: str, - galleryimages: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Galleryimages]: - """Create or update a gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param galleryimages_name: Name of the gallery image. Required. - :type galleryimages_name: str - :param galleryimages: Required. - :type galleryimages: 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 Galleryimages or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Galleryimages] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - galleryimages_name: str, - galleryimages: Union[_models.Galleryimages, IO], - **kwargs: Any - ) -> LROPoller[_models.Galleryimages]: - """Create or update a gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param galleryimages_name: Name of the gallery image. Required. - :type galleryimages_name: str - :param galleryimages: Is either a model type or a IO type. Required. - :type galleryimages: ~azure.mgmt.azurestackhci.models.Galleryimages 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 Galleryimages or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Galleryimages] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = 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.Galleryimages] = 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, - galleryimages_name=galleryimages_name, - galleryimages=galleryimages, - 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("Galleryimages", 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.AzureStackHCI/galleryimages/{galleryimagesName}" - } - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, galleryimages_name: str, **kwargs: Any - ) -> None: - """Delete a gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param galleryimages_name: Name of the gallery image. Required. - :type galleryimages_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: Literal["2021-09-01-preview"] = 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, - galleryimages_name=galleryimages_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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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.AzureStackHCI/galleryimages/{galleryimagesName}" - } - - @overload - def update( - self, - resource_group_name: str, - galleryimages_name: str, - galleryimages: _models.GalleryimagesPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Galleryimages: - """Update a gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param galleryimages_name: Name of the gallery image. Required. - :type galleryimages_name: str - :param galleryimages: Required. - :type galleryimages: ~azure.mgmt.azurestackhci.models.GalleryimagesPatch - :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: Galleryimages or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Galleryimages - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - galleryimages_name: str, - galleryimages: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Galleryimages: - """Update a gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param galleryimages_name: Name of the gallery image. Required. - :type galleryimages_name: str - :param galleryimages: Required. - :type galleryimages: 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: Galleryimages or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Galleryimages - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - galleryimages_name: str, - galleryimages: Union[_models.GalleryimagesPatch, IO], - **kwargs: Any - ) -> _models.Galleryimages: - """Update a gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param galleryimages_name: Name of the gallery image. Required. - :type galleryimages_name: str - :param galleryimages: Is either a model type or a IO type. Required. - :type galleryimages: ~azure.mgmt.azurestackhci.models.GalleryimagesPatch 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: Galleryimages or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Galleryimages - :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: Literal["2021-09-01-preview"] = 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.Galleryimages] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(galleryimages, (IO, bytes)): - _content = galleryimages - else: - _json = self._serialize.body(galleryimages, "GalleryimagesPatch") - - request = build_update_request( - resource_group_name=resource_group_name, - galleryimages_name=galleryimages_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("Galleryimages", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Galleryimages", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages/{galleryimagesName}" - } - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Galleryimages"]: - """Lists all galleryimages under the resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Galleryimages or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Galleryimages] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.GalleryimagesListResult] = 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_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.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("GalleryimagesListResult", 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages" - } - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Galleryimages"]: - """List all galleryimages under the subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Galleryimages or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Galleryimages] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.GalleryimagesListResult] = 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_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.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("GalleryimagesListResult", 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/galleryimages" - } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_guest_agent_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_guest_agent_operations.py index 65084cf3d77d0..2f97d0b38fe5c 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_guest_agent_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_guest_agent_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -28,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +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]] @@ -41,33 +37,24 @@ _SERIALIZER.client_side_validation = False -def build_create_request( - resource_group_name: str, virtual_machine_name: str, name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_create_request(resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) 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.AzureStackHCI/virtualMachines/{virtualMachineName}/guestAgents/{name}", + "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), - "name": _SERIALIZER.url("name", name, "str"), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -80,32 +67,23 @@ def build_create_request( return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - resource_group_name: str, virtual_machine_name: str, name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_get_request(resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/guestAgents/{name}", + "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), - "name": _SERIALIZER.url("name", name, "str"), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -116,32 +94,23 @@ def build_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request( - resource_group_name: str, virtual_machine_name: str, name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_delete_request(resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/guestAgents/{name}", + "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), - "name": _SERIALIZER.url("name", name, "str"), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -172,12 +141,7 @@ def __init__(self, *args, **kwargs): 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, - name: str, - body: Optional[Union[_models.GuestAgent, IO]] = None, - **kwargs: Any + self, resource_uri: str, body: Optional[Union[_models.GuestAgent, IO]] = None, **kwargs: Any ) -> _models.GuestAgent: error_map = { 401: ClientAuthenticationError, @@ -190,16 +154,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.GuestAgent] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -208,10 +170,7 @@ def _create_initial( _json = None request = build_create_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - name=name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, content_type=content_type, json=_json, @@ -223,8 +182,9 @@ def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -246,15 +206,13 @@ def _create_initial( return deserialized # type: ignore _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/guestAgents/{name}" + "url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default" } @overload def begin_create( self, - resource_group_name: str, - virtual_machine_name: str, - name: str, + resource_uri: str, body: Optional[_models.GuestAgent] = None, *, content_type: str = "application/json", @@ -264,13 +222,9 @@ def begin_create( Create Or Update GuestAgent. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param name: Name of the guestAgents. Required. - :type name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :param body: Request payload. Default value is None. :type body: ~azure.mgmt.azurestackhci.models.GuestAgent :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -291,26 +245,15 @@ def begin_create( @overload def begin_create( - self, - resource_group_name: str, - virtual_machine_name: str, - name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any + self, resource_uri: str, body: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GuestAgent]: """Implements GuestAgent PUT method. Create Or Update GuestAgent. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param name: Name of the guestAgents. Required. - :type name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :param body: Request payload. Default value is None. :type body: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -331,25 +274,16 @@ def begin_create( @distributed_trace def begin_create( - self, - resource_group_name: str, - virtual_machine_name: str, - name: str, - body: Optional[Union[_models.GuestAgent, IO]] = None, - **kwargs: Any + self, resource_uri: str, body: Optional[Union[_models.GuestAgent, IO]] = None, **kwargs: Any ) -> LROPoller[_models.GuestAgent]: """Implements GuestAgent PUT method. Create Or Update GuestAgent. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param name: Name of the guestAgents. Required. - :type name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Request payload. Is either a GuestAgent type or a IO type. Default value is None. :type body: ~azure.mgmt.azurestackhci.models.GuestAgent or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -369,9 +303,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.GuestAgent] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -379,9 +311,7 @@ def begin_create( 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, - name=name, + resource_uri=resource_uri, body=body, api_version=api_version, content_type=content_type, @@ -416,22 +346,18 @@ def get_long_running_output(pipeline_response): return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/guestAgents/{name}" + "url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default" } @distributed_trace - def get(self, resource_group_name: str, virtual_machine_name: str, name: str, **kwargs: Any) -> _models.GuestAgent: + def get(self, resource_uri: str, **kwargs: Any) -> _models.GuestAgent: """Gets GuestAgent. Implements GuestAgent GET method. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param name: Name of the GuestAgent. Required. - :type name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response :return: GuestAgent or the result of cls(response) :rtype: ~azure.mgmt.azurestackhci.models.GuestAgent @@ -448,16 +374,11 @@ def get(self, resource_group_name: str, virtual_machine_name: str, name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GuestAgent] = kwargs.pop("cls", None) request = build_get_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - name=name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, template_url=self.get.metadata["url"], headers=_headers, @@ -466,8 +387,9 @@ def get(self, resource_group_name: str, virtual_machine_name: str, name: str, ** request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -485,11 +407,11 @@ def get(self, resource_group_name: str, virtual_machine_name: str, name: str, ** return deserialized get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/guestAgents/{name}" + "url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default" } def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtual_machine_name: str, name: str, **kwargs: Any + self, resource_uri: str, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -502,16 +424,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - name=name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, template_url=self._delete_initial.metadata["url"], headers=_headers, @@ -520,39 +437,38 @@ 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 - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/guestAgents/{name}" + "url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default" } @distributed_trace - def begin_delete( - self, resource_group_name: str, virtual_machine_name: str, name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes an GuestAgent. + def begin_delete(self, resource_uri: str, **kwargs: Any) -> LROPoller[None]: + """Deleted an GuestAgent. Implements GuestAgent DELETE method. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param name: Name of the GuestAgent. Required. - :type name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -568,18 +484,14 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_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) 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, - name=name, + resource_uri=resource_uri, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -608,5 +520,5 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/guestAgents/{name}" + "url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default" } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_guest_agents_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_guest_agents_operations.py index b8196463b9dc3..ae279b8e846c8 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_guest_agents_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_guest_agents_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 @@ -28,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +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]] @@ -41,31 +36,22 @@ _SERIALIZER.client_side_validation = False -def build_list_by_virtual_machines_request( - resource_group_name: str, virtual_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_list_request(resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/guestAgents", + "template_url", "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents" ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -96,18 +82,14 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_by_virtual_machines( - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any - ) -> Iterable["_models.GuestAgent"]: + def list(self, resource_uri: str, **kwargs: Any) -> Iterable["_models.GuestAgent"]: """Implements GET GuestAgent in a vm. Returns the list of GuestAgent of the given vm. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GuestAgent or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.GuestAgent] @@ -116,9 +98,7 @@ def list_by_virtual_machines( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GuestAgentList] = kwargs.pop("cls", None) error_map = { @@ -132,12 +112,10 @@ def list_by_virtual_machines( def prepare_request(next_link=None): if not next_link: - request = build_list_by_virtual_machines_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, + request = build_list_request( + resource_uri=resource_uri, api_version=api_version, - template_url=self.list_by_virtual_machines.metadata["url"], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -172,8 +150,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 @@ -186,6 +165,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_virtual_machines.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/guestAgents" + list.metadata = { + "url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents" } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_hybrid_identity_metadata_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_hybrid_identity_metadata_operations.py index 641299c17dba8..e4b48785099fd 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_hybrid_identity_metadata_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_hybrid_identity_metadata_operations.py @@ -6,8 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -28,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +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]] @@ -41,71 +36,23 @@ _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: +def build_get_request(resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}", + "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/hybridIdentityMetadata/default", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), - "metadataName": _SERIALIZER.url("metadata_name", metadata_name, "str"), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "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 + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -116,67 +63,23 @@ def build_get_request( 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "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_virtual_machines_request( - resource_group_name: str, virtual_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_list_request(resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/hybridIdentityMetadata", + "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/hybridIdentityMetadata", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -206,183 +109,15 @@ def __init__(self, *args, **kwargs): 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. The name is case insensitive. - 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.azurestackhci.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.azurestackhci.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. The name is case insensitive. - 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.azurestackhci.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. The name is case insensitive. - 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 model type or a IO type. Default value is None. - :type body: ~azure.mgmt.azurestackhci.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.azurestackhci.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: Literal["2021-09-01-preview"] = 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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.AzureStackHCI/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}" - } - @distributed_trace - def get( - self, resource_group_name: str, virtual_machine_name: str, metadata_name: str, **kwargs: Any - ) -> _models.HybridIdentityMetadata: + def get(self, resource_uri: str, **kwargs: Any) -> _models.HybridIdentityMetadata: """Gets HybridIdentityMetadata. Implements HybridIdentityMetadata GET method. - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response :return: HybridIdentityMetadata or the result of cls(response) :rtype: ~azure.mgmt.azurestackhci.models.HybridIdentityMetadata @@ -399,16 +134,11 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HybridIdentityMetadata] = kwargs.pop("cls", None) request = build_get_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - metadata_name=metadata_name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, template_url=self.get.metadata["url"], headers=_headers, @@ -417,8 +147,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 @@ -436,89 +167,18 @@ def get( return deserialized get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/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. The name is case insensitive. - 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: Literal["2021-09-01-preview"] = 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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.AzureStackHCI/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}" + "url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/hybridIdentityMetadata/default" } @distributed_trace - def list_by_virtual_machines( - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any - ) -> Iterable["_models.HybridIdentityMetadata"]: + def list(self, resource_uri: 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either HybridIdentityMetadata or the result of cls(response) @@ -528,9 +188,7 @@ def list_by_virtual_machines( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HybridIdentityMetadataList] = kwargs.pop("cls", None) error_map = { @@ -544,12 +202,10 @@ def list_by_virtual_machines( def prepare_request(next_link=None): if not next_link: - request = build_list_by_virtual_machines_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, + request = build_list_request( + resource_uri=resource_uri, api_version=api_version, - template_url=self.list_by_virtual_machines.metadata["url"], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -584,8 +240,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 @@ -598,6 +255,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_virtual_machines.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/hybridIdentityMetadata" + list.metadata = { + "url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/hybridIdentityMetadata" } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_extensions_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_logical_networks_operations.py similarity index 64% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_extensions_operations.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_logical_networks_operations.py index 63667a6e745e3..af3753b59134c 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_extensions_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_logical_networks_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +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]] @@ -43,32 +39,36 @@ _SERIALIZER.client_side_validation = False -def build_list_by_arc_setting_request( - resource_group_name: str, cluster_name: str, arc_setting_name: str, subscription_id: str, **kwargs: Any +def build_get_request( + resource_group_name: str, logical_network_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "arcSettingName": _SERIALIZER.url("arc_setting_name", arc_setting_name, "str"), + "logicalNetworkName": _SERIALIZER.url( + "logical_network_name", + logical_network_name, + "str", + max_length=64, + min_length=2, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,62}[_a-zA-Z0-9]$", + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -79,126 +79,120 @@ def build_list_by_arc_setting_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - resource_group_name: str, - cluster_name: str, - arc_setting_name: str, - extension_name: str, - subscription_id: str, - **kwargs: Any +def build_create_or_update_request( + resource_group_name: str, logical_network_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + 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.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "arcSettingName": _SERIALIZER.url("arc_setting_name", arc_setting_name, "str"), - "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), + "logicalNetworkName": _SERIALIZER.url( + "logical_network_name", + logical_network_name, + "str", + max_length=64, + min_length=2, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,62}[_a-zA-Z0-9]$", + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # 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="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_request( - resource_group_name: str, - cluster_name: str, - arc_setting_name: str, - extension_name: str, - subscription_id: str, - **kwargs: Any +def build_delete_request( + resource_group_name: str, logical_network_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "arcSettingName": _SERIALIZER.url("arc_setting_name", arc_setting_name, "str"), - "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), + "logicalNetworkName": _SERIALIZER.url( + "logical_network_name", + logical_network_name, + "str", + max_length=64, + min_length=2, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,62}[_a-zA-Z0-9]$", + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # 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) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( - resource_group_name: str, - cluster_name: str, - arc_setting_name: str, - extension_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, logical_network_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) 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.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "arcSettingName": _SERIALIZER.url("arc_setting_name", arc_setting_name, "str"), - "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), + "logicalNetworkName": _SERIALIZER.url( + "logical_network_name", + logical_network_name, + "str", + max_length=64, + min_length=2, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,62}[_a-zA-Z0-9]$", + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -211,38 +205,26 @@ def build_update_request( return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request( - resource_group_name: str, - cluster_name: str, - arc_setting_name: str, - extension_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: +def build_list_request(resource_group_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "arcSettingName": _SERIALIZER.url("arc_setting_name", arc_setting_name, "str"), - "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -250,17 +232,43 @@ def build_delete_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -class ExtensionsOperations: +def build_list_all_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/logicalNetworks" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class LogicalNetworksOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.azurestackhci.AzureStackHCIClient`'s - :attr:`extensions` attribute. + :attr:`logical_networks` attribute. """ models = _models @@ -273,121 +281,17 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_by_arc_setting( - self, resource_group_name: str, cluster_name: str, arc_setting_name: str, **kwargs: Any - ) -> Iterable["_models.Extension"]: - """List all Extensions under ArcSetting resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. Required. - :type arc_setting_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Extension or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ExtensionList] = 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_arc_setting_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - arc_setting_name=arc_setting_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_arc_setting.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("ExtensionList", 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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_arc_setting.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions" - } - - @distributed_trace - def get( - self, resource_group_name: str, cluster_name: str, arc_setting_name: str, extension_name: str, **kwargs: Any - ) -> _models.Extension: - """Get particular Arc Extension of HCI Cluster. + def get(self, resource_group_name: str, logical_network_name: str, **kwargs: Any) -> _models.LogicalNetworks: + """get. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. Required. - :type arc_setting_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str + :param logical_network_name: Name of the logical network. Required. + :type logical_network_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Extension or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Extension + :return: LogicalNetworks or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.LogicalNetworks :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -401,16 +305,12 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Extension] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LogicalNetworks] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, - cluster_name=cluster_name, - arc_setting_name=arc_setting_name, - extension_name=extension_name, + logical_network_name=logical_network_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata["url"], @@ -420,8 +320,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 @@ -431,7 +332,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Extension", pipeline_response) + deserialized = self._deserialize("LogicalNetworks", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -439,18 +340,16 @@ def get( return deserialized get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}" } - def _create_initial( + def _create_or_update_initial( self, resource_group_name: str, - cluster_name: str, - arc_setting_name: str, - extension_name: str, - extension: Union[_models.Extension, IO], + logical_network_name: str, + logical_networks: Union[_models.LogicalNetworks, IO], **kwargs: Any - ) -> _models.Extension: + ) -> _models.LogicalNetworks: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -462,39 +361,36 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_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.Extension] = kwargs.pop("cls", None) + cls: ClsType[_models.LogicalNetworks] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(extension, (IO, bytes)): - _content = extension + if isinstance(logical_networks, (IOBase, bytes)): + _content = logical_networks else: - _json = self._serialize.body(extension, "Extension") + _json = self._serialize.body(logical_networks, "LogicalNetworks") - request = build_create_request( + request = build_create_or_update_request( resource_group_name=resource_group_name, - cluster_name=cluster_name, - arc_setting_name=arc_setting_name, - extension_name=extension_name, + logical_network_name=logical_network_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"], + 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -505,46 +401,40 @@ def _create_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("Extension", pipeline_response) + deserialized = self._deserialize("LogicalNetworks", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("Extension", pipeline_response) + deserialized = self._deserialize("LogicalNetworks", 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.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}" + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}" } @overload - def begin_create( + def begin_create_or_update( self, resource_group_name: str, - cluster_name: str, - arc_setting_name: str, - extension_name: str, - extension: _models.Extension, + logical_network_name: str, + logical_networks: _models.LogicalNetworks, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Extension]: - """Create Extension for HCI cluster. + ) -> LROPoller[_models.LogicalNetworks]: + """The operation to create or update a logical network. Please note some properties can be set + only during logical network creation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. Required. - :type arc_setting_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension: Details of the Machine Extension to be created. Required. - :type extension: ~azure.mgmt.azurestackhci.models.Extension + :param logical_network_name: Name of the logical network. Required. + :type logical_network_name: str + :param logical_networks: Required. + :type logical_networks: ~azure.mgmt.azurestackhci.models.LogicalNetworks :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -556,37 +446,32 @@ def begin_create( :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 Extension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Extension] + :return: An instance of LROPoller that returns either LogicalNetworks or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.LogicalNetworks] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create( + def begin_create_or_update( self, resource_group_name: str, - cluster_name: str, - arc_setting_name: str, - extension_name: str, - extension: IO, + logical_network_name: str, + logical_networks: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Extension]: - """Create Extension for HCI cluster. + ) -> LROPoller[_models.LogicalNetworks]: + """The operation to create or update a logical network. Please note some properties can be set + only during logical network creation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. Required. - :type arc_setting_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension: Details of the Machine Extension to be created. Required. - :type extension: IO + :param logical_network_name: Name of the logical network. Required. + :type logical_network_name: str + :param logical_networks: Required. + :type logical_networks: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -598,36 +483,30 @@ def begin_create( :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 Extension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Extension] + :return: An instance of LROPoller that returns either LogicalNetworks or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.LogicalNetworks] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create( + def begin_create_or_update( self, resource_group_name: str, - cluster_name: str, - arc_setting_name: str, - extension_name: str, - extension: Union[_models.Extension, IO], + logical_network_name: str, + logical_networks: Union[_models.LogicalNetworks, IO], **kwargs: Any - ) -> LROPoller[_models.Extension]: - """Create Extension for HCI cluster. + ) -> LROPoller[_models.LogicalNetworks]: + """The operation to create or update a logical network. Please note some properties can be set + only during logical network creation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. Required. - :type arc_setting_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension: Details of the Machine Extension to be created. Is either a model type or a - IO type. Required. - :type extension: ~azure.mgmt.azurestackhci.models.Extension or IO + :param logical_network_name: Name of the logical network. Required. + :type logical_network_name: str + :param logical_networks: Is either a LogicalNetworks type or a IO type. Required. + :type logical_networks: ~azure.mgmt.azurestackhci.models.LogicalNetworks or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -639,28 +518,25 @@ def begin_create( :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 Extension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Extension] + :return: An instance of LROPoller that returns either LogicalNetworks or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.LogicalNetworks] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_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.Extension] = kwargs.pop("cls", None) + cls: ClsType[_models.LogicalNetworks] = 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( + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, - cluster_name=cluster_name, - arc_setting_name=arc_setting_name, - extension_name=extension_name, - extension=extension, + logical_network_name=logical_network_name, + logical_networks=logical_networks, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -671,7 +547,7 @@ def begin_create( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Extension", pipeline_response) + deserialized = self._deserialize("LogicalNetworks", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized @@ -693,19 +569,135 @@ def get_long_running_output(pipeline_response): ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}" + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, logical_network_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, + logical_network_name=logical_network_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) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, logical_network_name: str, **kwargs: Any) -> LROPoller[None]: + """The operation to delete a logical network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param logical_network_name: Name of the logical network. Required. + :type logical_network_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, + logical_network_name=logical_network_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, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}" } def _update_initial( self, resource_group_name: str, - cluster_name: str, - arc_setting_name: str, - extension_name: str, - extension: Union[_models.Extension, IO], + logical_network_name: str, + logical_networks: Union[_models.LogicalNetworksUpdateRequest, IO], **kwargs: Any - ) -> _models.Extension: + ) -> Optional[_models.LogicalNetworks]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -717,25 +709,21 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_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.Extension] = kwargs.pop("cls", None) + cls: ClsType[Optional[_models.LogicalNetworks]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(extension, (IO, bytes)): - _content = extension + if isinstance(logical_networks, (IOBase, bytes)): + _content = logical_networks else: - _json = self._serialize.body(extension, "Extension") + _json = self._serialize.body(logical_networks, "LogicalNetworksUpdateRequest") request = build_update_request( resource_group_name=resource_group_name, - cluster_name=cluster_name, - arc_setting_name=arc_setting_name, - extension_name=extension_name, + logical_network_name=logical_network_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -748,54 +736,54 @@ 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 - if response.status_code not in [201]: + 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 = self._deserialize("Extension", pipeline_response) + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("LogicalNetworks", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}" } @overload def begin_update( self, resource_group_name: str, - cluster_name: str, - arc_setting_name: str, - extension_name: str, - extension: _models.Extension, + logical_network_name: str, + logical_networks: _models.LogicalNetworksUpdateRequest, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Extension]: - """Update Extension for HCI cluster. + ) -> LROPoller[_models.LogicalNetworks]: + """The operation to update a logical network. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. Required. - :type arc_setting_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension: Details of the Machine Extension to be created. Required. - :type extension: ~azure.mgmt.azurestackhci.models.Extension + :param logical_network_name: Name of the logical network. Required. + :type logical_network_name: str + :param logical_networks: Required. + :type logical_networks: ~azure.mgmt.azurestackhci.models.LogicalNetworksUpdateRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -807,8 +795,9 @@ def begin_update( :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 Extension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Extension] + :return: An instance of LROPoller that returns either LogicalNetworks or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.LogicalNetworks] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -816,28 +805,21 @@ def begin_update( def begin_update( self, resource_group_name: str, - cluster_name: str, - arc_setting_name: str, - extension_name: str, - extension: IO, + logical_network_name: str, + logical_networks: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Extension]: - """Update Extension for HCI cluster. + ) -> LROPoller[_models.LogicalNetworks]: + """The operation to update a logical network. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. Required. - :type arc_setting_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension: Details of the Machine Extension to be created. Required. - :type extension: IO + :param logical_network_name: Name of the logical network. Required. + :type logical_network_name: str + :param logical_networks: Required. + :type logical_networks: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -849,8 +831,9 @@ def begin_update( :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 Extension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Extension] + :return: An instance of LROPoller that returns either LogicalNetworks or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.LogicalNetworks] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -858,27 +841,19 @@ def begin_update( def begin_update( self, resource_group_name: str, - cluster_name: str, - arc_setting_name: str, - extension_name: str, - extension: Union[_models.Extension, IO], + logical_network_name: str, + logical_networks: Union[_models.LogicalNetworksUpdateRequest, IO], **kwargs: Any - ) -> LROPoller[_models.Extension]: - """Update Extension for HCI cluster. + ) -> LROPoller[_models.LogicalNetworks]: + """The operation to update a logical network. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. Required. - :type arc_setting_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension: Details of the Machine Extension to be created. Is either a model type or a - IO type. Required. - :type extension: ~azure.mgmt.azurestackhci.models.Extension or IO + :param logical_network_name: Name of the logical network. Required. + :type logical_network_name: str + :param logical_networks: Is either a LogicalNetworksUpdateRequest type or a IO type. Required. + :type logical_networks: ~azure.mgmt.azurestackhci.models.LogicalNetworksUpdateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -890,28 +865,25 @@ def begin_update( :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 Extension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Extension] + :return: An instance of LROPoller that returns either LogicalNetworks or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.LogicalNetworks] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_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.Extension] = kwargs.pop("cls", None) + cls: ClsType[_models.LogicalNetworks] = 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, - cluster_name=cluster_name, - arc_setting_name=arc_setting_name, - extension_name=extension_name, - extension=extension, + logical_network_name=logical_network_name, + logical_networks=logical_networks, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -922,14 +894,14 @@ def begin_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Extension", pipeline_response) + deserialized = self._deserialize("LogicalNetworks", 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": "original-uri"}, **kwargs) + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) @@ -945,12 +917,28 @@ def get_long_running_output(pipeline_response): return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}" } - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, cluster_name: str, arc_setting_name: str, extension_name: str, **kwargs: Any - ) -> None: + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.LogicalNetworks"]: + """Lists all of the logical networks in the specified resource group. Use the nextLink property in + the response to get the next page of logical networks. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LogicalNetworks or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.LogicalNetworks] + :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.LogicalNetworksListResult] = kwargs.pop("cls", None) + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -959,119 +947,145 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def prepare_request(next_link=None): + if not next_link: - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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) - request = build_delete_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - arc_setting_name=arc_setting_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) + 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 - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) + def extract_data(pipeline_response): + deserialized = self._deserialize("LogicalNetworksListResult", 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) - response = pipeline_response.http_response + def get_next(next_link=None): + request = prepare_request(next_link) - 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) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - if cls: - return cls(pipeline_response, None, {}) + 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) - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}" + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks" } @distributed_trace - def begin_delete( - self, resource_group_name: str, cluster_name: str, arc_setting_name: str, extension_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete particular Arc Extension of HCI Cluster. + def list_all(self, **kwargs: Any) -> Iterable["_models.LogicalNetworks"]: + """Lists all of the logical networks in the specified subscription. Use the nextLink property in + the response to get the next page of logical networks. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster. Required. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. Required. - :type arc_setting_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] + :return: An iterator like instance of either LogicalNetworks or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.LogicalNetworks] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = 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, - cluster_name=cluster_name, - arc_setting_name=arc_setting_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) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LogicalNetworksListResult] = kwargs.pop("cls", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + 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_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.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("LogicalNetworksListResult", pipeline_response) + list_of_elem = deserialized.value if cls: - return cls(pipeline_response, None, {}) + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) - 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, + 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 ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + response = pipeline_response.http_response - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}" - } + 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_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/logicalNetworks"} diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_marketplacegalleryimages_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_marketplace_gallery_images_operations.py similarity index 58% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_marketplacegalleryimages_operations.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_marketplace_gallery_images_operations.py index a22271bd40280..0d55cae87d671 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_marketplacegalleryimages_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_marketplace_gallery_images_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +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]] @@ -44,32 +40,35 @@ def build_get_request( - resource_group_name: str, marketplacegalleryimages_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, marketplace_gallery_image_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplacegalleryimages/{marketplacegalleryimagesName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "marketplacegalleryimagesName": _SERIALIZER.url( - "marketplacegalleryimages_name", marketplacegalleryimages_name, "str", max_length=64, min_length=3 + "marketplaceGalleryImageName": _SERIALIZER.url( + "marketplace_gallery_image_name", + marketplace_gallery_image_name, + "str", + max_length=80, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[a-zA-Z0-9]$", ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -81,33 +80,36 @@ def build_get_request( def build_create_or_update_request( - resource_group_name: str, marketplacegalleryimages_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, marketplace_gallery_image_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) 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.AzureStackHCI/marketplacegalleryimages/{marketplacegalleryimagesName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "marketplacegalleryimagesName": _SERIALIZER.url( - "marketplacegalleryimages_name", marketplacegalleryimages_name, "str", max_length=64, min_length=3 + "marketplaceGalleryImageName": _SERIALIZER.url( + "marketplace_gallery_image_name", + marketplace_gallery_image_name, + "str", + max_length=80, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[a-zA-Z0-9]$", ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -121,32 +123,35 @@ def build_create_or_update_request( def build_delete_request( - resource_group_name: str, marketplacegalleryimages_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, marketplace_gallery_image_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplacegalleryimages/{marketplacegalleryimagesName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "marketplacegalleryimagesName": _SERIALIZER.url( - "marketplacegalleryimages_name", marketplacegalleryimages_name, "str", max_length=64, min_length=3 + "marketplaceGalleryImageName": _SERIALIZER.url( + "marketplace_gallery_image_name", + marketplace_gallery_image_name, + "str", + max_length=80, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[a-zA-Z0-9]$", ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -158,33 +163,36 @@ def build_delete_request( def build_update_request( - resource_group_name: str, marketplacegalleryimages_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, marketplace_gallery_image_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) 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.AzureStackHCI/marketplacegalleryimages/{marketplacegalleryimagesName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "marketplacegalleryimagesName": _SERIALIZER.url( - "marketplacegalleryimages_name", marketplacegalleryimages_name, "str", max_length=64, min_length=3 + "marketplaceGalleryImageName": _SERIALIZER.url( + "marketplace_gallery_image_name", + marketplace_gallery_image_name, + "str", + max_length=80, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[a-zA-Z0-9]$", ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -197,19 +205,17 @@ def build_update_request( return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_list_request(resource_group_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplacegalleryimages", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), @@ -218,7 +224,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -229,24 +235,22 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_list_all_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/marketplacegalleryimages" + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages" ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -257,14 +261,14 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -class MarketplacegalleryimagesOperations: +class MarketplaceGalleryImagesOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.azurestackhci.AzureStackHCIClient`'s - :attr:`marketplacegalleryimages` attribute. + :attr:`marketplace_gallery_images` attribute. """ models = _models @@ -278,18 +282,18 @@ def __init__(self, *args, **kwargs): @distributed_trace def get( - self, resource_group_name: str, marketplacegalleryimages_name: str, **kwargs: Any - ) -> _models.Marketplacegalleryimages: - """Gets marketplacegalleryimages by resource name. + self, resource_group_name: str, marketplace_gallery_image_name: str, **kwargs: Any + ) -> _models.MarketplaceGalleryImages: + """Gets a marketplace gallery image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param marketplacegalleryimages_name: Name of the marketplace gallery image. Required. - :type marketplacegalleryimages_name: str + :param marketplace_gallery_image_name: Name of the marketplace gallery image. Required. + :type marketplace_gallery_image_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Marketplacegalleryimages or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Marketplacegalleryimages + :return: MarketplaceGalleryImages or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.MarketplaceGalleryImages :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -303,14 +307,12 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Marketplacegalleryimages] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MarketplaceGalleryImages] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, - marketplacegalleryimages_name=marketplacegalleryimages_name, + marketplace_gallery_image_name=marketplace_gallery_image_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata["url"], @@ -320,8 +322,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 @@ -331,7 +334,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Marketplacegalleryimages", pipeline_response) + deserialized = self._deserialize("MarketplaceGalleryImages", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -339,16 +342,16 @@ def get( return deserialized get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplacegalleryimages/{marketplacegalleryimagesName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}" } def _create_or_update_initial( self, resource_group_name: str, - marketplacegalleryimages_name: str, - marketplacegalleryimages: Union[_models.Marketplacegalleryimages, IO], + marketplace_gallery_image_name: str, + marketplace_gallery_images: Union[_models.MarketplaceGalleryImages, IO], **kwargs: Any - ) -> _models.Marketplacegalleryimages: + ) -> _models.MarketplaceGalleryImages: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -360,23 +363,21 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_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.Marketplacegalleryimages] = kwargs.pop("cls", None) + cls: ClsType[_models.MarketplaceGalleryImages] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(marketplacegalleryimages, (IO, bytes)): - _content = marketplacegalleryimages + if isinstance(marketplace_gallery_images, (IOBase, bytes)): + _content = marketplace_gallery_images else: - _json = self._serialize.body(marketplacegalleryimages, "Marketplacegalleryimages") + _json = self._serialize.body(marketplace_gallery_images, "MarketplaceGalleryImages") request = build_create_or_update_request( resource_group_name=resource_group_name, - marketplacegalleryimages_name=marketplacegalleryimages_name, + marketplace_gallery_image_name=marketplace_gallery_image_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -389,8 +390,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 @@ -401,10 +403,10 @@ def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("Marketplacegalleryimages", pipeline_response) + deserialized = self._deserialize("MarketplaceGalleryImages", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("Marketplacegalleryimages", pipeline_response) + deserialized = self._deserialize("MarketplaceGalleryImages", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -412,28 +414,29 @@ def _create_or_update_initial( return deserialized # type: ignore _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplacegalleryimages/{marketplacegalleryimagesName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}" } @overload def begin_create_or_update( self, resource_group_name: str, - marketplacegalleryimages_name: str, - marketplacegalleryimages: _models.Marketplacegalleryimages, + marketplace_gallery_image_name: str, + marketplace_gallery_images: _models.MarketplaceGalleryImages, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Marketplacegalleryimages]: - """Creates or updates a marketplace gallery image. + ) -> LROPoller[_models.MarketplaceGalleryImages]: + """The operation to create or update a marketplace gallery image. Please note some properties can + be set only during marketplace gallery image creation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param marketplacegalleryimages_name: Name of the marketplace gallery image. Required. - :type marketplacegalleryimages_name: str - :param marketplacegalleryimages: Required. - :type marketplacegalleryimages: ~azure.mgmt.azurestackhci.models.Marketplacegalleryimages + :param marketplace_gallery_image_name: Name of the marketplace gallery image. Required. + :type marketplace_gallery_image_name: str + :param marketplace_gallery_images: Required. + :type marketplace_gallery_images: ~azure.mgmt.azurestackhci.models.MarketplaceGalleryImages :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -445,10 +448,10 @@ def begin_create_or_update( :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 Marketplacegalleryimages or the result of + :return: An instance of LROPoller that returns either MarketplaceGalleryImages or the result of cls(response) :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Marketplacegalleryimages] + ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.MarketplaceGalleryImages] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -456,21 +459,22 @@ def begin_create_or_update( def begin_create_or_update( self, resource_group_name: str, - marketplacegalleryimages_name: str, - marketplacegalleryimages: IO, + marketplace_gallery_image_name: str, + marketplace_gallery_images: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Marketplacegalleryimages]: - """Creates or updates a marketplace gallery image. + ) -> LROPoller[_models.MarketplaceGalleryImages]: + """The operation to create or update a marketplace gallery image. Please note some properties can + be set only during marketplace gallery image creation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param marketplacegalleryimages_name: Name of the marketplace gallery image. Required. - :type marketplacegalleryimages_name: str - :param marketplacegalleryimages: Required. - :type marketplacegalleryimages: IO + :param marketplace_gallery_image_name: Name of the marketplace gallery image. Required. + :type marketplace_gallery_image_name: str + :param marketplace_gallery_images: Required. + :type marketplace_gallery_images: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -482,10 +486,10 @@ def begin_create_or_update( :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 Marketplacegalleryimages or the result of + :return: An instance of LROPoller that returns either MarketplaceGalleryImages or the result of cls(response) :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Marketplacegalleryimages] + ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.MarketplaceGalleryImages] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -493,19 +497,22 @@ def begin_create_or_update( def begin_create_or_update( self, resource_group_name: str, - marketplacegalleryimages_name: str, - marketplacegalleryimages: Union[_models.Marketplacegalleryimages, IO], + marketplace_gallery_image_name: str, + marketplace_gallery_images: Union[_models.MarketplaceGalleryImages, IO], **kwargs: Any - ) -> LROPoller[_models.Marketplacegalleryimages]: - """Creates or updates a marketplace gallery image. + ) -> LROPoller[_models.MarketplaceGalleryImages]: + """The operation to create or update a marketplace gallery image. Please note some properties can + be set only during marketplace gallery image creation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param marketplacegalleryimages_name: Name of the marketplace gallery image. Required. - :type marketplacegalleryimages_name: str - :param marketplacegalleryimages: Is either a model type or a IO type. Required. - :type marketplacegalleryimages: ~azure.mgmt.azurestackhci.models.Marketplacegalleryimages or IO + :param marketplace_gallery_image_name: Name of the marketplace gallery image. Required. + :type marketplace_gallery_image_name: str + :param marketplace_gallery_images: Is either a MarketplaceGalleryImages type or a IO type. + Required. + :type marketplace_gallery_images: ~azure.mgmt.azurestackhci.models.MarketplaceGalleryImages or + IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -517,28 +524,26 @@ def begin_create_or_update( :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 Marketplacegalleryimages or the result of + :return: An instance of LROPoller that returns either MarketplaceGalleryImages or the result of cls(response) :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Marketplacegalleryimages] + ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.MarketplaceGalleryImages] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_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.Marketplacegalleryimages] = kwargs.pop("cls", None) + cls: ClsType[_models.MarketplaceGalleryImages] = 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, - marketplacegalleryimages_name=marketplacegalleryimages_name, - marketplacegalleryimages=marketplacegalleryimages, + marketplace_gallery_image_name=marketplace_gallery_image_name, + marketplace_gallery_images=marketplace_gallery_images, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -549,7 +554,7 @@ def begin_create_or_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Marketplacegalleryimages", pipeline_response) + deserialized = self._deserialize("MarketplaceGalleryImages", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized @@ -572,25 +577,12 @@ def get_long_running_output(pipeline_response): 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.AzureStackHCI/marketplacegalleryimages/{marketplacegalleryimagesName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}" } - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, marketplacegalleryimages_name: str, **kwargs: Any + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, marketplace_gallery_image_name: str, **kwargs: Any ) -> None: - """Deletes a marketplace gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param marketplacegalleryimages_name: Name of the marketplace gallery image. Required. - :type marketplacegalleryimages_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, @@ -602,123 +594,119 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, - marketplacegalleryimages_name=marketplacegalleryimages_name, + marketplace_gallery_image_name=marketplace_gallery_image_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], + 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + 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) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplacegalleryimages/{marketplacegalleryimagesName}" + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}" } - @overload - def update( - self, - resource_group_name: str, - marketplacegalleryimages_name: str, - marketplacegalleryimages: _models.MarketplacegalleryimagesPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Marketplacegalleryimages: - """Updates a marketplace gallery image. + @distributed_trace + def begin_delete( + self, resource_group_name: str, marketplace_gallery_image_name: str, **kwargs: Any + ) -> LROPoller[None]: + """The operation to delete a marketplace gallery image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param marketplacegalleryimages_name: Name of the marketplace gallery image. Required. - :type marketplacegalleryimages_name: str - :param marketplacegalleryimages: Required. - :type marketplacegalleryimages: ~azure.mgmt.azurestackhci.models.MarketplacegalleryimagesPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str + :param marketplace_gallery_image_name: Name of the marketplace gallery image. Required. + :type marketplace_gallery_image_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Marketplacegalleryimages or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Marketplacegalleryimages + :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 {}) - @overload - def update( - self, - resource_group_name: str, - marketplacegalleryimages_name: str, - marketplacegalleryimages: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Marketplacegalleryimages: - """Updates a marketplace gallery image. + 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, + marketplace_gallery_image_name=marketplace_gallery_image_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param marketplacegalleryimages_name: Name of the marketplace gallery image. Required. - :type marketplacegalleryimages_name: str - :param marketplacegalleryimages: Required. - :type marketplacegalleryimages: 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: Marketplacegalleryimages or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Marketplacegalleryimages - :raises ~azure.core.exceptions.HttpResponseError: - """ + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) - @distributed_trace - def update( + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}" + } + + def _update_initial( self, resource_group_name: str, - marketplacegalleryimages_name: str, - marketplacegalleryimages: Union[_models.MarketplacegalleryimagesPatch, IO], + marketplace_gallery_image_name: str, + marketplace_gallery_images: Union[_models.MarketplaceGalleryImagesUpdateRequest, IO], **kwargs: Any - ) -> _models.Marketplacegalleryimages: - """Updates a marketplace gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param marketplacegalleryimages_name: Name of the marketplace gallery image. Required. - :type marketplacegalleryimages_name: str - :param marketplacegalleryimages: Is either a model type or a IO type. Required. - :type marketplacegalleryimages: ~azure.mgmt.azurestackhci.models.MarketplacegalleryimagesPatch - 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: Marketplacegalleryimages or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Marketplacegalleryimages - :raises ~azure.core.exceptions.HttpResponseError: - """ + ) -> Optional[_models.MarketplaceGalleryImages]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -730,83 +718,242 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_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.Marketplacegalleryimages] = kwargs.pop("cls", None) + cls: ClsType[Optional[_models.MarketplaceGalleryImages]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(marketplacegalleryimages, (IO, bytes)): - _content = marketplacegalleryimages + if isinstance(marketplace_gallery_images, (IOBase, bytes)): + _content = marketplace_gallery_images else: - _json = self._serialize.body(marketplacegalleryimages, "MarketplacegalleryimagesPatch") + _json = self._serialize.body(marketplace_gallery_images, "MarketplaceGalleryImagesUpdateRequest") request = build_update_request( resource_group_name=resource_group_name, - marketplacegalleryimages_name=marketplacegalleryimages_name, + marketplace_gallery_image_name=marketplace_gallery_image_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], + 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + 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("Marketplacegalleryimages", pipeline_response) + deserialized = self._deserialize("MarketplaceGalleryImages", pipeline_response) - if response.status_code == 201: - deserialized = self._deserialize("Marketplacegalleryimages", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) - return deserialized # type: ignore + return deserialized - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplacegalleryimages/{marketplacegalleryimagesName}" + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + marketplace_gallery_image_name: str, + marketplace_gallery_images: _models.MarketplaceGalleryImagesUpdateRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MarketplaceGalleryImages]: + """The operation to update a marketplace gallery image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param marketplace_gallery_image_name: Name of the marketplace gallery image. Required. + :type marketplace_gallery_image_name: str + :param marketplace_gallery_images: Required. + :type marketplace_gallery_images: + ~azure.mgmt.azurestackhci.models.MarketplaceGalleryImagesUpdateRequest + :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 MarketplaceGalleryImages or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.MarketplaceGalleryImages] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + marketplace_gallery_image_name: str, + marketplace_gallery_images: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MarketplaceGalleryImages]: + """The operation to update a marketplace gallery image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param marketplace_gallery_image_name: Name of the marketplace gallery image. Required. + :type marketplace_gallery_image_name: str + :param marketplace_gallery_images: Required. + :type marketplace_gallery_images: 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 MarketplaceGalleryImages or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.MarketplaceGalleryImages] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + marketplace_gallery_image_name: str, + marketplace_gallery_images: Union[_models.MarketplaceGalleryImagesUpdateRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.MarketplaceGalleryImages]: + """The operation to update a marketplace gallery image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param marketplace_gallery_image_name: Name of the marketplace gallery image. Required. + :type marketplace_gallery_image_name: str + :param marketplace_gallery_images: Is either a MarketplaceGalleryImagesUpdateRequest type or a + IO type. Required. + :type marketplace_gallery_images: + ~azure.mgmt.azurestackhci.models.MarketplaceGalleryImagesUpdateRequest 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 MarketplaceGalleryImages or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.MarketplaceGalleryImages] + :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.MarketplaceGalleryImages] = 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, + marketplace_gallery_image_name=marketplace_gallery_image_name, + marketplace_gallery_images=marketplace_gallery_images, + 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("MarketplaceGalleryImages", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}" } @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.Marketplacegalleryimages"]: - """Lists all marketplacegalleryimages under the resource group. + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.MarketplaceGalleryImages"]: + """Lists all of the marketplace gallery images in the specified resource group. Use the nextLink + property in the response to get the next page of marketplace gallery images. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Marketplacegalleryimages or the result of + :return: An iterator like instance of either MarketplaceGalleryImages or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Marketplacegalleryimages] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.MarketplaceGalleryImages] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.MarketplacegalleryimagesListResult] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MarketplaceGalleryImagesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -819,11 +966,11 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + request = build_list_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -849,7 +996,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize("MarketplacegalleryimagesListResult", pipeline_response) + deserialized = self._deserialize("MarketplaceGalleryImagesListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -858,8 +1005,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 @@ -872,27 +1020,26 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplacegalleryimages" + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages" } @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Marketplacegalleryimages"]: - """Lists all marketplacegalleryimages under the subscription. + def list_all(self, **kwargs: Any) -> Iterable["_models.MarketplaceGalleryImages"]: + """Lists all of the marketplace gallery images in the specified subscription. Use the nextLink + property in the response to get the next page of marketplace gallery images. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Marketplacegalleryimages or the result of + :return: An iterator like instance of either MarketplaceGalleryImages or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Marketplacegalleryimages] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.MarketplaceGalleryImages] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.MarketplacegalleryimagesListResult] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MarketplaceGalleryImagesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -905,10 +1052,10 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Marketplacega def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + request = build_list_all_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], + template_url=self.list_all.metadata["url"], headers=_headers, params=_params, ) @@ -934,7 +1081,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize("MarketplacegalleryimagesListResult", pipeline_response) + deserialized = self._deserialize("MarketplaceGalleryImagesListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -943,8 +1090,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 @@ -957,6 +1105,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/marketplacegalleryimages" + list_all.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages" } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_networkinterfaces_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_network_interfaces_operations.py similarity index 59% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_networkinterfaces_operations.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_network_interfaces_operations.py index 4088a61603710..234ebf7b11538 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_networkinterfaces_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_network_interfaces_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +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]] @@ -43,33 +39,36 @@ _SERIALIZER.client_side_validation = False -def build_retrieve_request( - resource_group_name: str, networkinterfaces_name: str, subscription_id: str, **kwargs: Any +def build_get_request( + resource_group_name: str, network_interface_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces/{networkinterfacesName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "networkinterfacesName": _SERIALIZER.url( - "networkinterfaces_name", networkinterfaces_name, "str", max_length=64, min_length=3 + "networkInterfaceName": _SERIALIZER.url( + "network_interface_name", + network_interface_name, + "str", + max_length=80, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[_a-zA-Z0-9]$", ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -81,33 +80,36 @@ def build_retrieve_request( def build_create_or_update_request( - resource_group_name: str, networkinterfaces_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, network_interface_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) 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.AzureStackHCI/networkinterfaces/{networkinterfacesName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "networkinterfacesName": _SERIALIZER.url( - "networkinterfaces_name", networkinterfaces_name, "str", max_length=64, min_length=3 + "networkInterfaceName": _SERIALIZER.url( + "network_interface_name", + network_interface_name, + "str", + max_length=80, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[_a-zA-Z0-9]$", ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -121,32 +123,35 @@ def build_create_or_update_request( def build_delete_request( - resource_group_name: str, networkinterfaces_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, network_interface_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces/{networkinterfacesName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "networkinterfacesName": _SERIALIZER.url( - "networkinterfaces_name", networkinterfaces_name, "str", max_length=64, min_length=3 + "networkInterfaceName": _SERIALIZER.url( + "network_interface_name", + network_interface_name, + "str", + max_length=80, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[_a-zA-Z0-9]$", ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -158,33 +163,36 @@ def build_delete_request( def build_update_request( - resource_group_name: str, networkinterfaces_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, network_interface_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) 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.AzureStackHCI/networkinterfaces/{networkinterfacesName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "networkinterfacesName": _SERIALIZER.url( - "networkinterfaces_name", networkinterfaces_name, "str", max_length=64, min_length=3 + "networkInterfaceName": _SERIALIZER.url( + "network_interface_name", + network_interface_name, + "str", + max_length=80, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[_a-zA-Z0-9]$", ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -197,19 +205,17 @@ def build_update_request( return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_list_request(resource_group_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), @@ -218,7 +224,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -229,24 +235,22 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_list_all_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/networkinterfaces" + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/networkInterfaces" ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -257,14 +261,14 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -class NetworkinterfacesOperations: +class NetworkInterfacesOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.azurestackhci.AzureStackHCIClient`'s - :attr:`networkinterfaces` attribute. + :attr:`network_interfaces` attribute. """ models = _models @@ -277,19 +281,17 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def retrieve( - self, resource_group_name: str, networkinterfaces_name: str, **kwargs: Any - ) -> _models.Networkinterfaces: - """Gets network interfaces by resource name. + def get(self, resource_group_name: str, network_interface_name: str, **kwargs: Any) -> _models.NetworkInterfaces: + """Gets a network interface. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param networkinterfaces_name: Required. - :type networkinterfaces_name: str + :param network_interface_name: Name of the network interface. Required. + :type network_interface_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Networkinterfaces or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Networkinterfaces + :return: NetworkInterfaces or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.NetworkInterfaces :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -303,25 +305,24 @@ def retrieve( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Networkinterfaces] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkInterfaces] = kwargs.pop("cls", None) - request = build_retrieve_request( + request = build_get_request( resource_group_name=resource_group_name, - networkinterfaces_name=networkinterfaces_name, + network_interface_name=network_interface_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.retrieve.metadata["url"], + 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -331,24 +332,24 @@ def retrieve( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Networkinterfaces", pipeline_response) + deserialized = self._deserialize("NetworkInterfaces", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - retrieve.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces/{networkinterfacesName}" + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}" } def _create_or_update_initial( self, resource_group_name: str, - networkinterfaces_name: str, - networkinterfaces: Union[_models.Networkinterfaces, IO], + network_interface_name: str, + network_interfaces: Union[_models.NetworkInterfaces, IO], **kwargs: Any - ) -> _models.Networkinterfaces: + ) -> _models.NetworkInterfaces: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -360,23 +361,21 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_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.Networkinterfaces] = kwargs.pop("cls", None) + cls: ClsType[_models.NetworkInterfaces] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(networkinterfaces, (IO, bytes)): - _content = networkinterfaces + if isinstance(network_interfaces, (IOBase, bytes)): + _content = network_interfaces else: - _json = self._serialize.body(networkinterfaces, "Networkinterfaces") + _json = self._serialize.body(network_interfaces, "NetworkInterfaces") request = build_create_or_update_request( resource_group_name=resource_group_name, - networkinterfaces_name=networkinterfaces_name, + network_interface_name=network_interface_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -389,8 +388,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 @@ -401,10 +401,10 @@ def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("Networkinterfaces", pipeline_response) + deserialized = self._deserialize("NetworkInterfaces", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("Networkinterfaces", pipeline_response) + deserialized = self._deserialize("NetworkInterfaces", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -412,28 +412,29 @@ def _create_or_update_initial( return deserialized # type: ignore _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces/{networkinterfacesName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}" } @overload def begin_create_or_update( self, resource_group_name: str, - networkinterfaces_name: str, - networkinterfaces: _models.Networkinterfaces, + network_interface_name: str, + network_interfaces: _models.NetworkInterfaces, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Networkinterfaces]: - """create_or_update. + ) -> LROPoller[_models.NetworkInterfaces]: + """The operation to create or update a network interface. Please note some properties can be set + only during network interface creation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param networkinterfaces_name: Required. - :type networkinterfaces_name: str - :param networkinterfaces: Required. - :type networkinterfaces: ~azure.mgmt.azurestackhci.models.Networkinterfaces + :param network_interface_name: Name of the network interface. Required. + :type network_interface_name: str + :param network_interfaces: Required. + :type network_interfaces: ~azure.mgmt.azurestackhci.models.NetworkInterfaces :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -445,9 +446,9 @@ def begin_create_or_update( :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 Networkinterfaces or the result of + :return: An instance of LROPoller that returns either NetworkInterfaces or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Networkinterfaces] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.NetworkInterfaces] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -455,21 +456,22 @@ def begin_create_or_update( def begin_create_or_update( self, resource_group_name: str, - networkinterfaces_name: str, - networkinterfaces: IO, + network_interface_name: str, + network_interfaces: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Networkinterfaces]: - """create_or_update. + ) -> LROPoller[_models.NetworkInterfaces]: + """The operation to create or update a network interface. Please note some properties can be set + only during network interface creation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param networkinterfaces_name: Required. - :type networkinterfaces_name: str - :param networkinterfaces: Required. - :type networkinterfaces: IO + :param network_interface_name: Name of the network interface. Required. + :type network_interface_name: str + :param network_interfaces: Required. + :type network_interfaces: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -481,9 +483,9 @@ def begin_create_or_update( :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 Networkinterfaces or the result of + :return: An instance of LROPoller that returns either NetworkInterfaces or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Networkinterfaces] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.NetworkInterfaces] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -491,19 +493,20 @@ def begin_create_or_update( def begin_create_or_update( self, resource_group_name: str, - networkinterfaces_name: str, - networkinterfaces: Union[_models.Networkinterfaces, IO], + network_interface_name: str, + network_interfaces: Union[_models.NetworkInterfaces, IO], **kwargs: Any - ) -> LROPoller[_models.Networkinterfaces]: - """create_or_update. + ) -> LROPoller[_models.NetworkInterfaces]: + """The operation to create or update a network interface. Please note some properties can be set + only during network interface creation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param networkinterfaces_name: Required. - :type networkinterfaces_name: str - :param networkinterfaces: Is either a model type or a IO type. Required. - :type networkinterfaces: ~azure.mgmt.azurestackhci.models.Networkinterfaces or IO + :param network_interface_name: Name of the network interface. Required. + :type network_interface_name: str + :param network_interfaces: Is either a NetworkInterfaces type or a IO type. Required. + :type network_interfaces: ~azure.mgmt.azurestackhci.models.NetworkInterfaces or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -515,27 +518,25 @@ def begin_create_or_update( :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 Networkinterfaces or the result of + :return: An instance of LROPoller that returns either NetworkInterfaces or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Networkinterfaces] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.NetworkInterfaces] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_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.Networkinterfaces] = kwargs.pop("cls", None) + cls: ClsType[_models.NetworkInterfaces] = 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, - networkinterfaces_name=networkinterfaces_name, - networkinterfaces=networkinterfaces, + network_interface_name=network_interface_name, + network_interfaces=network_interfaces, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -546,7 +547,7 @@ def begin_create_or_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Networkinterfaces", pipeline_response) + deserialized = self._deserialize("NetworkInterfaces", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized @@ -569,25 +570,12 @@ def get_long_running_output(pipeline_response): 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.AzureStackHCI/networkinterfaces/{networkinterfacesName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}" } - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, networkinterfaces_name: str, **kwargs: Any + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_interface_name: str, **kwargs: Any ) -> None: - """delete. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param networkinterfaces_name: Required. - :type networkinterfaces_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, @@ -599,122 +587,117 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, - networkinterfaces_name=networkinterfaces_name, + network_interface_name=network_interface_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], + 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + 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) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces/{networkinterfacesName}" + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}" } - @overload - def update( - self, - resource_group_name: str, - networkinterfaces_name: str, - networkinterfaces: _models.NetworkinterfacesPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Networkinterfaces: - """update. + @distributed_trace + def begin_delete(self, resource_group_name: str, network_interface_name: str, **kwargs: Any) -> LROPoller[None]: + """The operation to delete a network interface. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param networkinterfaces_name: Required. - :type networkinterfaces_name: str - :param networkinterfaces: Required. - :type networkinterfaces: ~azure.mgmt.azurestackhci.models.NetworkinterfacesPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str + :param network_interface_name: Name of the network interface. Required. + :type network_interface_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Networkinterfaces or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Networkinterfaces + :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 {}) - @overload - def update( - self, - resource_group_name: str, - networkinterfaces_name: str, - networkinterfaces: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Networkinterfaces: - """update. + 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, + network_interface_name=network_interface_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param networkinterfaces_name: Required. - :type networkinterfaces_name: str - :param networkinterfaces: Required. - :type networkinterfaces: 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: Networkinterfaces or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Networkinterfaces - :raises ~azure.core.exceptions.HttpResponseError: - """ + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) - @distributed_trace - def update( + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}" + } + + def _update_initial( self, resource_group_name: str, - networkinterfaces_name: str, - networkinterfaces: Union[_models.NetworkinterfacesPatch, IO], + network_interface_name: str, + network_interfaces: Union[_models.NetworkInterfacesUpdateRequest, IO], **kwargs: Any - ) -> _models.Networkinterfaces: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param networkinterfaces_name: Required. - :type networkinterfaces_name: str - :param networkinterfaces: Is either a model type or a IO type. Required. - :type networkinterfaces: ~azure.mgmt.azurestackhci.models.NetworkinterfacesPatch 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: Networkinterfaces or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Networkinterfaces - :raises ~azure.core.exceptions.HttpResponseError: - """ + ) -> Optional[_models.NetworkInterfaces]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -726,80 +709,236 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_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.Networkinterfaces] = kwargs.pop("cls", None) + cls: ClsType[Optional[_models.NetworkInterfaces]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(networkinterfaces, (IO, bytes)): - _content = networkinterfaces + if isinstance(network_interfaces, (IOBase, bytes)): + _content = network_interfaces else: - _json = self._serialize.body(networkinterfaces, "NetworkinterfacesPatch") + _json = self._serialize.body(network_interfaces, "NetworkInterfacesUpdateRequest") request = build_update_request( resource_group_name=resource_group_name, - networkinterfaces_name=networkinterfaces_name, + network_interface_name=network_interface_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], + 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + 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("Networkinterfaces", pipeline_response) + deserialized = self._deserialize("NetworkInterfaces", pipeline_response) - if response.status_code == 201: - deserialized = self._deserialize("Networkinterfaces", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) - return deserialized # type: ignore + return deserialized - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces/{networkinterfacesName}" + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + network_interface_name: str, + network_interfaces: _models.NetworkInterfacesUpdateRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkInterfaces]: + """The operation to update a network interface. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_interface_name: Name of the network interface. Required. + :type network_interface_name: str + :param network_interfaces: Required. + :type network_interfaces: ~azure.mgmt.azurestackhci.models.NetworkInterfacesUpdateRequest + :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 NetworkInterfaces or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.NetworkInterfaces] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + network_interface_name: str, + network_interfaces: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkInterfaces]: + """The operation to update a network interface. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_interface_name: Name of the network interface. Required. + :type network_interface_name: str + :param network_interfaces: Required. + :type network_interfaces: 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 NetworkInterfaces or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.NetworkInterfaces] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + network_interface_name: str, + network_interfaces: Union[_models.NetworkInterfacesUpdateRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.NetworkInterfaces]: + """The operation to update a network interface. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_interface_name: Name of the network interface. Required. + :type network_interface_name: str + :param network_interfaces: Is either a NetworkInterfacesUpdateRequest type or a IO type. + Required. + :type network_interfaces: ~azure.mgmt.azurestackhci.models.NetworkInterfacesUpdateRequest 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 NetworkInterfaces or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.NetworkInterfaces] + :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.NetworkInterfaces] = 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, + network_interface_name=network_interface_name, + network_interfaces=network_interfaces, + 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("NetworkInterfaces", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}" } @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Networkinterfaces"]: - """list_by_resource_group. + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.NetworkInterfaces"]: + """Lists all of the network interfaces in the specified resource group. Use the nextLink property + in the response to get the next page of network interfaces. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Networkinterfaces or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Networkinterfaces] + :return: An iterator like instance of either NetworkInterfaces or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.NetworkInterfaces] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.NetworkinterfacesListResult] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkInterfacesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -812,11 +951,11 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + request = build_list_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -842,7 +981,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize("NetworkinterfacesListResult", pipeline_response) + deserialized = self._deserialize("NetworkInterfacesListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -851,8 +990,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 @@ -865,26 +1005,25 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces" + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces" } @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Networkinterfaces"]: - """list_by_subscription. + def list_all(self, **kwargs: Any) -> Iterable["_models.NetworkInterfaces"]: + """Lists all of the network interfaces in the specified subscription. Use the nextLink property in + the response to get the next page of network interfaces. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Networkinterfaces or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Networkinterfaces] + :return: An iterator like instance of either NetworkInterfaces or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.NetworkInterfaces] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.NetworkinterfacesListResult] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkInterfacesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -897,10 +1036,10 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Networkinterf def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + request = build_list_all_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], + template_url=self.list_all.metadata["url"], headers=_headers, params=_params, ) @@ -926,7 +1065,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize("NetworkinterfacesListResult", pipeline_response) + deserialized = self._deserialize("NetworkInterfacesListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -935,8 +1074,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 @@ -949,6 +1089,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/networkinterfaces" - } + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/networkInterfaces"} diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_operations.py index 2eca031ce230c..1e48cffe98eea 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_operations.py @@ -6,8 +6,8 @@ # 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, Optional, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,6 +17,7 @@ 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 @@ -28,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]] @@ -43,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["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -80,14 +75,20 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> _models.OperationListResult: - """List all available Microsoft.AzureStackHCI provider operations. + def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: + """List all the supported operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationListResult or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.OperationListResult + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Operation] :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.OperationListResult] = kwargs.pop("cls", None) + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -96,39 +97,59 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - - request = build_list_request( - 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("OperationListResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + 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("OperationListResult", 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": "/providers/Microsoft.AzureStackHCI/operations"} diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_storagecontainers_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_storage_containers_operations.py similarity index 59% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_storagecontainers_operations.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_storage_containers_operations.py index 6aa97b6b4cbf0..2da1fc5b3c1a7 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_storagecontainers_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_storage_containers_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +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]] @@ -43,33 +39,36 @@ _SERIALIZER.client_side_validation = False -def build_retrieve_request( - resource_group_name: str, storagecontainers_name: str, subscription_id: str, **kwargs: Any +def build_get_request( + resource_group_name: str, storage_container_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storagecontainers/{storagecontainersName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "storagecontainersName": _SERIALIZER.url( - "storagecontainers_name", storagecontainers_name, "str", max_length=64, min_length=3 + "storageContainerName": _SERIALIZER.url( + "storage_container_name", + storage_container_name, + "str", + max_length=80, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[_a-zA-Z0-9]$", ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -81,33 +80,36 @@ def build_retrieve_request( def build_create_or_update_request( - resource_group_name: str, storagecontainers_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, storage_container_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) 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.AzureStackHCI/storagecontainers/{storagecontainersName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "storagecontainersName": _SERIALIZER.url( - "storagecontainers_name", storagecontainers_name, "str", max_length=64, min_length=3 + "storageContainerName": _SERIALIZER.url( + "storage_container_name", + storage_container_name, + "str", + max_length=80, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[_a-zA-Z0-9]$", ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -121,32 +123,35 @@ def build_create_or_update_request( def build_delete_request( - resource_group_name: str, storagecontainers_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, storage_container_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storagecontainers/{storagecontainersName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "storagecontainersName": _SERIALIZER.url( - "storagecontainers_name", storagecontainers_name, "str", max_length=64, min_length=3 + "storageContainerName": _SERIALIZER.url( + "storage_container_name", + storage_container_name, + "str", + max_length=80, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[_a-zA-Z0-9]$", ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -158,33 +163,36 @@ def build_delete_request( def build_update_request( - resource_group_name: str, storagecontainers_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, storage_container_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) 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.AzureStackHCI/storagecontainers/{storagecontainersName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "storagecontainersName": _SERIALIZER.url( - "storagecontainers_name", storagecontainers_name, "str", max_length=64, min_length=3 + "storageContainerName": _SERIALIZER.url( + "storage_container_name", + storage_container_name, + "str", + max_length=80, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[_a-zA-Z0-9]$", ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -197,19 +205,17 @@ def build_update_request( return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_list_request(resource_group_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storagecontainers", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), @@ -218,7 +224,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -229,24 +235,22 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_list_all_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/storagecontainers" + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/storageContainers" ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -257,14 +261,14 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -class StoragecontainersOperations: +class StorageContainersOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.azurestackhci.AzureStackHCIClient`'s - :attr:`storagecontainers` attribute. + :attr:`storage_containers` attribute. """ models = _models @@ -277,19 +281,17 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def retrieve( - self, resource_group_name: str, storagecontainers_name: str, **kwargs: Any - ) -> _models.Storagecontainers: - """Gets storagecontainers by resource name. + def get(self, resource_group_name: str, storage_container_name: str, **kwargs: Any) -> _models.StorageContainers: + """Gets a storage container. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param storagecontainers_name: Required. - :type storagecontainers_name: str + :param storage_container_name: Name of the storage container. Required. + :type storage_container_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Storagecontainers or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Storagecontainers + :return: StorageContainers or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.StorageContainers :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -303,25 +305,24 @@ def retrieve( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Storagecontainers] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.StorageContainers] = kwargs.pop("cls", None) - request = build_retrieve_request( + request = build_get_request( resource_group_name=resource_group_name, - storagecontainers_name=storagecontainers_name, + storage_container_name=storage_container_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.retrieve.metadata["url"], + 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -331,24 +332,24 @@ def retrieve( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Storagecontainers", pipeline_response) + deserialized = self._deserialize("StorageContainers", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - retrieve.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storagecontainers/{storagecontainersName}" + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}" } def _create_or_update_initial( self, resource_group_name: str, - storagecontainers_name: str, - storagecontainers: Union[_models.Storagecontainers, IO], + storage_container_name: str, + storage_containers: Union[_models.StorageContainers, IO], **kwargs: Any - ) -> _models.Storagecontainers: + ) -> _models.StorageContainers: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -360,23 +361,21 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_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.Storagecontainers] = kwargs.pop("cls", None) + cls: ClsType[_models.StorageContainers] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(storagecontainers, (IO, bytes)): - _content = storagecontainers + if isinstance(storage_containers, (IOBase, bytes)): + _content = storage_containers else: - _json = self._serialize.body(storagecontainers, "Storagecontainers") + _json = self._serialize.body(storage_containers, "StorageContainers") request = build_create_or_update_request( resource_group_name=resource_group_name, - storagecontainers_name=storagecontainers_name, + storage_container_name=storage_container_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -389,8 +388,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 @@ -401,10 +401,10 @@ def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("Storagecontainers", pipeline_response) + deserialized = self._deserialize("StorageContainers", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("Storagecontainers", pipeline_response) + deserialized = self._deserialize("StorageContainers", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -412,28 +412,29 @@ def _create_or_update_initial( return deserialized # type: ignore _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storagecontainers/{storagecontainersName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}" } @overload def begin_create_or_update( self, resource_group_name: str, - storagecontainers_name: str, - storagecontainers: _models.Storagecontainers, + storage_container_name: str, + storage_containers: _models.StorageContainers, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Storagecontainers]: - """create_or_update. + ) -> LROPoller[_models.StorageContainers]: + """The operation to create or update a storage container. Please note some properties can be set + only during storage container creation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param storagecontainers_name: Required. - :type storagecontainers_name: str - :param storagecontainers: Required. - :type storagecontainers: ~azure.mgmt.azurestackhci.models.Storagecontainers + :param storage_container_name: Name of the storage container. Required. + :type storage_container_name: str + :param storage_containers: Required. + :type storage_containers: ~azure.mgmt.azurestackhci.models.StorageContainers :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -445,9 +446,9 @@ def begin_create_or_update( :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 Storagecontainers or the result of + :return: An instance of LROPoller that returns either StorageContainers or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Storagecontainers] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.StorageContainers] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -455,21 +456,22 @@ def begin_create_or_update( def begin_create_or_update( self, resource_group_name: str, - storagecontainers_name: str, - storagecontainers: IO, + storage_container_name: str, + storage_containers: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Storagecontainers]: - """create_or_update. + ) -> LROPoller[_models.StorageContainers]: + """The operation to create or update a storage container. Please note some properties can be set + only during storage container creation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param storagecontainers_name: Required. - :type storagecontainers_name: str - :param storagecontainers: Required. - :type storagecontainers: IO + :param storage_container_name: Name of the storage container. Required. + :type storage_container_name: str + :param storage_containers: Required. + :type storage_containers: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -481,9 +483,9 @@ def begin_create_or_update( :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 Storagecontainers or the result of + :return: An instance of LROPoller that returns either StorageContainers or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Storagecontainers] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.StorageContainers] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -491,19 +493,20 @@ def begin_create_or_update( def begin_create_or_update( self, resource_group_name: str, - storagecontainers_name: str, - storagecontainers: Union[_models.Storagecontainers, IO], + storage_container_name: str, + storage_containers: Union[_models.StorageContainers, IO], **kwargs: Any - ) -> LROPoller[_models.Storagecontainers]: - """create_or_update. + ) -> LROPoller[_models.StorageContainers]: + """The operation to create or update a storage container. Please note some properties can be set + only during storage container creation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param storagecontainers_name: Required. - :type storagecontainers_name: str - :param storagecontainers: Is either a model type or a IO type. Required. - :type storagecontainers: ~azure.mgmt.azurestackhci.models.Storagecontainers or IO + :param storage_container_name: Name of the storage container. Required. + :type storage_container_name: str + :param storage_containers: Is either a StorageContainers type or a IO type. Required. + :type storage_containers: ~azure.mgmt.azurestackhci.models.StorageContainers or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -515,27 +518,25 @@ def begin_create_or_update( :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 Storagecontainers or the result of + :return: An instance of LROPoller that returns either StorageContainers or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Storagecontainers] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.StorageContainers] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_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.Storagecontainers] = kwargs.pop("cls", None) + cls: ClsType[_models.StorageContainers] = 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, - storagecontainers_name=storagecontainers_name, - storagecontainers=storagecontainers, + storage_container_name=storage_container_name, + storage_containers=storage_containers, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -546,7 +547,7 @@ def begin_create_or_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Storagecontainers", pipeline_response) + deserialized = self._deserialize("StorageContainers", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized @@ -569,25 +570,12 @@ def get_long_running_output(pipeline_response): 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.AzureStackHCI/storagecontainers/{storagecontainersName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}" } - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, storagecontainers_name: str, **kwargs: Any + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, storage_container_name: str, **kwargs: Any ) -> None: - """delete. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storagecontainers_name: Required. - :type storagecontainers_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, @@ -599,122 +587,117 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, - storagecontainers_name=storagecontainers_name, + storage_container_name=storage_container_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], + 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + 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) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storagecontainers/{storagecontainersName}" + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}" } - @overload - def update( - self, - resource_group_name: str, - storagecontainers_name: str, - storagecontainers: _models.StoragecontainersPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Storagecontainers: - """update. + @distributed_trace + def begin_delete(self, resource_group_name: str, storage_container_name: str, **kwargs: Any) -> LROPoller[None]: + """The operation to delete a storage container. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param storagecontainers_name: Required. - :type storagecontainers_name: str - :param storagecontainers: Required. - :type storagecontainers: ~azure.mgmt.azurestackhci.models.StoragecontainersPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str + :param storage_container_name: Name of the storage container. Required. + :type storage_container_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Storagecontainers or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Storagecontainers + :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 {}) - @overload - def update( - self, - resource_group_name: str, - storagecontainers_name: str, - storagecontainers: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Storagecontainers: - """update. + 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, + storage_container_name=storage_container_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storagecontainers_name: Required. - :type storagecontainers_name: str - :param storagecontainers: Required. - :type storagecontainers: 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: Storagecontainers or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Storagecontainers - :raises ~azure.core.exceptions.HttpResponseError: - """ + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) - @distributed_trace - def update( + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}" + } + + def _update_initial( self, resource_group_name: str, - storagecontainers_name: str, - storagecontainers: Union[_models.StoragecontainersPatch, IO], + storage_container_name: str, + storage_containers: Union[_models.StorageContainersUpdateRequest, IO], **kwargs: Any - ) -> _models.Storagecontainers: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storagecontainers_name: Required. - :type storagecontainers_name: str - :param storagecontainers: Is either a model type or a IO type. Required. - :type storagecontainers: ~azure.mgmt.azurestackhci.models.StoragecontainersPatch 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: Storagecontainers or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Storagecontainers - :raises ~azure.core.exceptions.HttpResponseError: - """ + ) -> Optional[_models.StorageContainers]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -726,80 +709,236 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_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.Storagecontainers] = kwargs.pop("cls", None) + cls: ClsType[Optional[_models.StorageContainers]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(storagecontainers, (IO, bytes)): - _content = storagecontainers + if isinstance(storage_containers, (IOBase, bytes)): + _content = storage_containers else: - _json = self._serialize.body(storagecontainers, "StoragecontainersPatch") + _json = self._serialize.body(storage_containers, "StorageContainersUpdateRequest") request = build_update_request( resource_group_name=resource_group_name, - storagecontainers_name=storagecontainers_name, + storage_container_name=storage_container_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], + 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + 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("Storagecontainers", pipeline_response) + deserialized = self._deserialize("StorageContainers", pipeline_response) - if response.status_code == 201: - deserialized = self._deserialize("Storagecontainers", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) - return deserialized # type: ignore + return deserialized - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storagecontainers/{storagecontainersName}" + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + storage_container_name: str, + storage_containers: _models.StorageContainersUpdateRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.StorageContainers]: + """The operation to update a storage container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_container_name: Name of the storage container. Required. + :type storage_container_name: str + :param storage_containers: Required. + :type storage_containers: ~azure.mgmt.azurestackhci.models.StorageContainersUpdateRequest + :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 StorageContainers or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.StorageContainers] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + storage_container_name: str, + storage_containers: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.StorageContainers]: + """The operation to update a storage container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_container_name: Name of the storage container. Required. + :type storage_container_name: str + :param storage_containers: Required. + :type storage_containers: 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 StorageContainers or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.StorageContainers] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + storage_container_name: str, + storage_containers: Union[_models.StorageContainersUpdateRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.StorageContainers]: + """The operation to update a storage container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_container_name: Name of the storage container. Required. + :type storage_container_name: str + :param storage_containers: Is either a StorageContainersUpdateRequest type or a IO type. + Required. + :type storage_containers: ~azure.mgmt.azurestackhci.models.StorageContainersUpdateRequest 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 StorageContainers or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.StorageContainers] + :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.StorageContainers] = 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, + storage_container_name=storage_container_name, + storage_containers=storage_containers, + 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("StorageContainers", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}" } @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Storagecontainers"]: - """list_by_resource_group. + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.StorageContainers"]: + """Lists all of the storage containers in the specified resource group. Use the nextLink property + in the response to get the next page of storage containers. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Storagecontainers or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Storagecontainers] + :return: An iterator like instance of either StorageContainers or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.StorageContainers] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.StoragecontainersListResult] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.StorageContainersListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -812,11 +951,11 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + request = build_list_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -842,7 +981,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize("StoragecontainersListResult", pipeline_response) + deserialized = self._deserialize("StorageContainersListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -851,8 +990,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 @@ -865,26 +1005,25 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storagecontainers" + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers" } @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Storagecontainers"]: - """list_by_subscription. + def list_all(self, **kwargs: Any) -> Iterable["_models.StorageContainers"]: + """Lists all of the storage containers in the specified subscription. Use the nextLink property in + the response to get the next page of storage containers. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Storagecontainers or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Storagecontainers] + :return: An iterator like instance of either StorageContainers or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.StorageContainers] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.StoragecontainersListResult] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.StorageContainersListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -897,10 +1036,10 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Storagecontai def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + request = build_list_all_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], + template_url=self.list_all.metadata["url"], headers=_headers, params=_params, ) @@ -926,7 +1065,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize("StoragecontainersListResult", pipeline_response) + deserialized = self._deserialize("StorageContainersListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -935,8 +1074,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 @@ -949,6 +1089,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/storagecontainers" - } + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/storageContainers"} diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtualharddisks_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtual_hard_disks_operations.py similarity index 59% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtualharddisks_operations.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtual_hard_disks_operations.py index a4edb39c30502..7ac4246559ddf 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtualharddisks_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtual_hard_disks_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +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]] @@ -43,33 +39,36 @@ _SERIALIZER.client_side_validation = False -def build_retrieve_request( - resource_group_name: str, virtualharddisks_name: str, subscription_id: str, **kwargs: Any +def build_get_request( + resource_group_name: str, virtual_hard_disk_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "virtualharddisksName": _SERIALIZER.url( - "virtualharddisks_name", virtualharddisks_name, "str", max_length=64, min_length=3 + "virtualHardDiskName": _SERIALIZER.url( + "virtual_hard_disk_name", + virtual_hard_disk_name, + "str", + max_length=80, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,62}[a-zA-Z0-9]$", ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -81,33 +80,36 @@ def build_retrieve_request( def build_create_or_update_request( - resource_group_name: str, virtualharddisks_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, virtual_hard_disk_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) 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.AzureStackHCI/virtualharddisks/{virtualharddisksName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "virtualharddisksName": _SERIALIZER.url( - "virtualharddisks_name", virtualharddisks_name, "str", max_length=64, min_length=3 + "virtualHardDiskName": _SERIALIZER.url( + "virtual_hard_disk_name", + virtual_hard_disk_name, + "str", + max_length=80, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,62}[a-zA-Z0-9]$", ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -121,32 +123,35 @@ def build_create_or_update_request( def build_delete_request( - resource_group_name: str, virtualharddisks_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, virtual_hard_disk_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "virtualharddisksName": _SERIALIZER.url( - "virtualharddisks_name", virtualharddisks_name, "str", max_length=64, min_length=3 + "virtualHardDiskName": _SERIALIZER.url( + "virtual_hard_disk_name", + virtual_hard_disk_name, + "str", + max_length=80, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,62}[a-zA-Z0-9]$", ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -158,33 +163,36 @@ def build_delete_request( def build_update_request( - resource_group_name: str, virtualharddisks_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, virtual_hard_disk_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) 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.AzureStackHCI/virtualharddisks/{virtualharddisksName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "virtualharddisksName": _SERIALIZER.url( - "virtualharddisks_name", virtualharddisks_name, "str", max_length=64, min_length=3 + "virtualHardDiskName": _SERIALIZER.url( + "virtual_hard_disk_name", + virtual_hard_disk_name, + "str", + max_length=80, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,62}[a-zA-Z0-9]$", ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -197,19 +205,17 @@ def build_update_request( return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_list_request(resource_group_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), @@ -218,7 +224,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -229,24 +235,22 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_list_all_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualharddisks" + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualHardDisks" ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -257,14 +261,14 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -class VirtualharddisksOperations: +class VirtualHardDisksOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.azurestackhci.AzureStackHCIClient`'s - :attr:`virtualharddisks` attribute. + :attr:`virtual_hard_disks` attribute. """ models = _models @@ -277,17 +281,17 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def retrieve(self, resource_group_name: str, virtualharddisks_name: str, **kwargs: Any) -> _models.Virtualharddisks: - """Gets virtualharddisks by resource name. + def get(self, resource_group_name: str, virtual_hard_disk_name: str, **kwargs: Any) -> _models.VirtualHardDisks: + """Gets a virtual hard disk. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtualharddisks_name: Required. - :type virtualharddisks_name: str + :param virtual_hard_disk_name: Name of the virtual hard disk. Required. + :type virtual_hard_disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Virtualharddisks or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualharddisks + :return: VirtualHardDisks or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.VirtualHardDisks :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -301,25 +305,24 @@ def retrieve(self, resource_group_name: str, virtualharddisks_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Virtualharddisks] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualHardDisks] = kwargs.pop("cls", None) - request = build_retrieve_request( + request = build_get_request( resource_group_name=resource_group_name, - virtualharddisks_name=virtualharddisks_name, + virtual_hard_disk_name=virtual_hard_disk_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.retrieve.metadata["url"], + 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -329,24 +332,24 @@ def retrieve(self, resource_group_name: str, virtualharddisks_name: str, **kwarg error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Virtualharddisks", pipeline_response) + deserialized = self._deserialize("VirtualHardDisks", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - retrieve.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}" + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}" } def _create_or_update_initial( self, resource_group_name: str, - virtualharddisks_name: str, - virtualharddisks: Union[_models.Virtualharddisks, IO], + virtual_hard_disk_name: str, + virtual_hard_disks: Union[_models.VirtualHardDisks, IO], **kwargs: Any - ) -> _models.Virtualharddisks: + ) -> _models.VirtualHardDisks: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -358,23 +361,21 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_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.Virtualharddisks] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualHardDisks] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(virtualharddisks, (IO, bytes)): - _content = virtualharddisks + if isinstance(virtual_hard_disks, (IOBase, bytes)): + _content = virtual_hard_disks else: - _json = self._serialize.body(virtualharddisks, "Virtualharddisks") + _json = self._serialize.body(virtual_hard_disks, "VirtualHardDisks") request = build_create_or_update_request( resource_group_name=resource_group_name, - virtualharddisks_name=virtualharddisks_name, + virtual_hard_disk_name=virtual_hard_disk_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -387,8 +388,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 @@ -399,10 +401,10 @@ def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("Virtualharddisks", pipeline_response) + deserialized = self._deserialize("VirtualHardDisks", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("Virtualharddisks", pipeline_response) + deserialized = self._deserialize("VirtualHardDisks", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -410,28 +412,29 @@ def _create_or_update_initial( return deserialized # type: ignore _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}" } @overload def begin_create_or_update( self, resource_group_name: str, - virtualharddisks_name: str, - virtualharddisks: _models.Virtualharddisks, + virtual_hard_disk_name: str, + virtual_hard_disks: _models.VirtualHardDisks, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Virtualharddisks]: - """create_or_update. + ) -> LROPoller[_models.VirtualHardDisks]: + """The operation to create or update a virtual hard disk. Please note some properties can be set + only during virtual hard disk creation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtualharddisks_name: Required. - :type virtualharddisks_name: str - :param virtualharddisks: Required. - :type virtualharddisks: ~azure.mgmt.azurestackhci.models.Virtualharddisks + :param virtual_hard_disk_name: Name of the virtual hard disk. Required. + :type virtual_hard_disk_name: str + :param virtual_hard_disks: Required. + :type virtual_hard_disks: ~azure.mgmt.azurestackhci.models.VirtualHardDisks :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -443,9 +446,9 @@ def begin_create_or_update( :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 Virtualharddisks or the result of + :return: An instance of LROPoller that returns either VirtualHardDisks or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Virtualharddisks] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.VirtualHardDisks] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -453,21 +456,22 @@ def begin_create_or_update( def begin_create_or_update( self, resource_group_name: str, - virtualharddisks_name: str, - virtualharddisks: IO, + virtual_hard_disk_name: str, + virtual_hard_disks: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Virtualharddisks]: - """create_or_update. + ) -> LROPoller[_models.VirtualHardDisks]: + """The operation to create or update a virtual hard disk. Please note some properties can be set + only during virtual hard disk creation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtualharddisks_name: Required. - :type virtualharddisks_name: str - :param virtualharddisks: Required. - :type virtualharddisks: IO + :param virtual_hard_disk_name: Name of the virtual hard disk. Required. + :type virtual_hard_disk_name: str + :param virtual_hard_disks: Required. + :type virtual_hard_disks: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -479,9 +483,9 @@ def begin_create_or_update( :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 Virtualharddisks or the result of + :return: An instance of LROPoller that returns either VirtualHardDisks or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Virtualharddisks] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.VirtualHardDisks] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -489,19 +493,20 @@ def begin_create_or_update( def begin_create_or_update( self, resource_group_name: str, - virtualharddisks_name: str, - virtualharddisks: Union[_models.Virtualharddisks, IO], + virtual_hard_disk_name: str, + virtual_hard_disks: Union[_models.VirtualHardDisks, IO], **kwargs: Any - ) -> LROPoller[_models.Virtualharddisks]: - """create_or_update. + ) -> LROPoller[_models.VirtualHardDisks]: + """The operation to create or update a virtual hard disk. Please note some properties can be set + only during virtual hard disk creation. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtualharddisks_name: Required. - :type virtualharddisks_name: str - :param virtualharddisks: Is either a model type or a IO type. Required. - :type virtualharddisks: ~azure.mgmt.azurestackhci.models.Virtualharddisks or IO + :param virtual_hard_disk_name: Name of the virtual hard disk. Required. + :type virtual_hard_disk_name: str + :param virtual_hard_disks: Is either a VirtualHardDisks type or a IO type. Required. + :type virtual_hard_disks: ~azure.mgmt.azurestackhci.models.VirtualHardDisks or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -513,27 +518,25 @@ def begin_create_or_update( :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 Virtualharddisks or the result of + :return: An instance of LROPoller that returns either VirtualHardDisks or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Virtualharddisks] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.VirtualHardDisks] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_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.Virtualharddisks] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualHardDisks] = 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, - virtualharddisks_name=virtualharddisks_name, - virtualharddisks=virtualharddisks, + virtual_hard_disk_name=virtual_hard_disk_name, + virtual_hard_disks=virtual_hard_disks, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -544,7 +547,7 @@ def begin_create_or_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Virtualharddisks", pipeline_response) + deserialized = self._deserialize("VirtualHardDisks", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized @@ -567,25 +570,12 @@ def get_long_running_output(pipeline_response): 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.AzureStackHCI/virtualharddisks/{virtualharddisksName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}" } - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtualharddisks_name: str, **kwargs: Any + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_hard_disk_name: str, **kwargs: Any ) -> None: - """delete. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualharddisks_name: Required. - :type virtualharddisks_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, @@ -597,122 +587,117 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, - virtualharddisks_name=virtualharddisks_name, + virtual_hard_disk_name=virtual_hard_disk_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], + 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + 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) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}" + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}" } - @overload - def update( - self, - resource_group_name: str, - virtualharddisks_name: str, - virtualharddisks: _models.VirtualharddisksPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Virtualharddisks: - """update. + @distributed_trace + def begin_delete(self, resource_group_name: str, virtual_hard_disk_name: str, **kwargs: Any) -> LROPoller[None]: + """The operation to delete a virtual hard disk. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtualharddisks_name: Required. - :type virtualharddisks_name: str - :param virtualharddisks: Required. - :type virtualharddisks: ~azure.mgmt.azurestackhci.models.VirtualharddisksPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str + :param virtual_hard_disk_name: Name of the virtual hard disk. Required. + :type virtual_hard_disk_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Virtualharddisks or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualharddisks + :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 {}) - @overload - def update( - self, - resource_group_name: str, - virtualharddisks_name: str, - virtualharddisks: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Virtualharddisks: - """update. + 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_hard_disk_name=virtual_hard_disk_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualharddisks_name: Required. - :type virtualharddisks_name: str - :param virtualharddisks: Required. - :type virtualharddisks: 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: Virtualharddisks or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualharddisks - :raises ~azure.core.exceptions.HttpResponseError: - """ + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) - @distributed_trace - def update( + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}" + } + + def _update_initial( self, resource_group_name: str, - virtualharddisks_name: str, - virtualharddisks: Union[_models.VirtualharddisksPatch, IO], + virtual_hard_disk_name: str, + virtual_hard_disks: Union[_models.VirtualHardDisksUpdateRequest, IO], **kwargs: Any - ) -> _models.Virtualharddisks: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualharddisks_name: Required. - :type virtualharddisks_name: str - :param virtualharddisks: Is either a model type or a IO type. Required. - :type virtualharddisks: ~azure.mgmt.azurestackhci.models.VirtualharddisksPatch 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: Virtualharddisks or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualharddisks - :raises ~azure.core.exceptions.HttpResponseError: - """ + ) -> Optional[_models.VirtualHardDisks]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -724,80 +709,236 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_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.Virtualharddisks] = kwargs.pop("cls", None) + cls: ClsType[Optional[_models.VirtualHardDisks]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(virtualharddisks, (IO, bytes)): - _content = virtualharddisks + if isinstance(virtual_hard_disks, (IOBase, bytes)): + _content = virtual_hard_disks else: - _json = self._serialize.body(virtualharddisks, "VirtualharddisksPatch") + _json = self._serialize.body(virtual_hard_disks, "VirtualHardDisksUpdateRequest") request = build_update_request( resource_group_name=resource_group_name, - virtualharddisks_name=virtualharddisks_name, + virtual_hard_disk_name=virtual_hard_disk_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], + 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + 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("Virtualharddisks", pipeline_response) + deserialized = self._deserialize("VirtualHardDisks", pipeline_response) - if response.status_code == 201: - deserialized = self._deserialize("Virtualharddisks", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) - return deserialized # type: ignore + return deserialized - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}" + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + virtual_hard_disk_name: str, + virtual_hard_disks: _models.VirtualHardDisksUpdateRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualHardDisks]: + """The operation to update a virtual hard disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_hard_disk_name: Name of the virtual hard disk. Required. + :type virtual_hard_disk_name: str + :param virtual_hard_disks: Required. + :type virtual_hard_disks: ~azure.mgmt.azurestackhci.models.VirtualHardDisksUpdateRequest + :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 VirtualHardDisks or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.VirtualHardDisks] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + virtual_hard_disk_name: str, + virtual_hard_disks: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualHardDisks]: + """The operation to update a virtual hard disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_hard_disk_name: Name of the virtual hard disk. Required. + :type virtual_hard_disk_name: str + :param virtual_hard_disks: Required. + :type virtual_hard_disks: 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 VirtualHardDisks or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.VirtualHardDisks] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + virtual_hard_disk_name: str, + virtual_hard_disks: Union[_models.VirtualHardDisksUpdateRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.VirtualHardDisks]: + """The operation to update a virtual hard disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_hard_disk_name: Name of the virtual hard disk. Required. + :type virtual_hard_disk_name: str + :param virtual_hard_disks: Is either a VirtualHardDisksUpdateRequest type or a IO type. + Required. + :type virtual_hard_disks: ~azure.mgmt.azurestackhci.models.VirtualHardDisksUpdateRequest 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 VirtualHardDisks or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.VirtualHardDisks] + :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.VirtualHardDisks] = 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_hard_disk_name=virtual_hard_disk_name, + virtual_hard_disks=virtual_hard_disks, + 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("VirtualHardDisks", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}" } @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Virtualharddisks"]: - """list_by_resource_group. + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.VirtualHardDisks"]: + """Lists all of the virtual hard disks in the specified resource group. Use the nextLink property + in the response to get the next page of virtual hard disks. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Virtualharddisks or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Virtualharddisks] + :return: An iterator like instance of either VirtualHardDisks or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.VirtualHardDisks] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualharddisksListResult] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualHardDisksListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -810,11 +951,11 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + request = build_list_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -840,7 +981,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualharddisksListResult", pipeline_response) + deserialized = self._deserialize("VirtualHardDisksListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -849,8 +990,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 @@ -863,26 +1005,25 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks" + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks" } @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Virtualharddisks"]: - """list_by_subscription. + def list_all(self, **kwargs: Any) -> Iterable["_models.VirtualHardDisks"]: + """Lists all of the virtual hard disks in the specified subscription. Use the nextLink property in + the response to get the next page of virtual hard disks. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Virtualharddisks or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Virtualharddisks] + :return: An iterator like instance of either VirtualHardDisks or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.VirtualHardDisks] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualharddisksListResult] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualHardDisksListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -895,10 +1036,10 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Virtualharddi def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + request = build_list_all_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], + template_url=self.list_all.metadata["url"], headers=_headers, params=_params, ) @@ -924,7 +1065,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualharddisksListResult", pipeline_response) + deserialized = self._deserialize("VirtualHardDisksListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -933,8 +1074,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 @@ -947,6 +1089,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualharddisks" - } + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualHardDisks"} diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtualmachines_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtual_machine_instances_operations.py similarity index 53% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtualmachines_operations.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtual_machine_instances_operations.py index b975d12e7ffc3..6fccf5ca090db 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtualmachines_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtual_machine_instances_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +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]] @@ -43,33 +39,22 @@ _SERIALIZER.client_side_validation = False -def build_retrieve_request( - resource_group_name: str, virtualmachines_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_get_request(resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}", - ) # pylint: disable=line-too-long + "template_url", "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "virtualmachinesName": _SERIALIZER.url( - "virtualmachines_name", virtualmachines_name, "str", max_length=64, min_length=3 - ), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -80,34 +65,23 @@ def build_retrieve_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request( - resource_group_name: str, virtualmachines_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_create_or_update_request(resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) 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.AzureStackHCI/virtualmachines/{virtualmachinesName}", - ) # pylint: disable=line-too-long + "template_url", "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "virtualmachinesName": _SERIALIZER.url( - "virtualmachines_name", virtualmachines_name, "str", max_length=64, min_length=3 - ), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -120,33 +94,22 @@ def build_create_or_update_request( return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request( - resource_group_name: str, virtualmachines_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_delete_request(resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}", - ) # pylint: disable=line-too-long + "template_url", "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "virtualmachinesName": _SERIALIZER.url( - "virtualmachines_name", virtualmachines_name, "str", max_length=64, min_length=3 - ), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -157,34 +120,23 @@ def build_delete_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_request( - resource_group_name: str, virtualmachines_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_update_request(resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) 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.AzureStackHCI/virtualmachines/{virtualmachinesName}", - ) # pylint: disable=line-too-long + "template_url", "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "virtualmachinesName": _SERIALIZER.url( - "virtualmachines_name", virtualmachines_name, "str", max_length=64, min_length=3 - ), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -197,33 +149,22 @@ def build_update_request( return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_start_request( - resource_group_name: str, virtualmachines_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_start_request(resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/start", + "template_url", "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/start" ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "virtualmachinesName": _SERIALIZER.url( - "virtualmachines_name", virtualmachines_name, "str", max_length=64, min_length=3 - ), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -234,33 +175,22 @@ def build_start_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_stop_request( - resource_group_name: str, virtualmachines_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_stop_request(resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/stop", + "template_url", "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/stop" ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "virtualmachinesName": _SERIALIZER.url( - "virtualmachines_name", virtualmachines_name, "str", max_length=64, min_length=3 - ), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -271,33 +201,22 @@ def build_stop_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_restart_request( - resource_group_name: str, virtualmachines_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_restart_request(resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/restart", + "template_url", "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/restart" ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "virtualmachinesName": _SERIALIZER.url( - "virtualmachines_name", virtualmachines_name, "str", max_length=64, min_length=3 - ), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -308,28 +227,20 @@ def build_restart_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_list_request(resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines", - ) # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -340,42 +251,14 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualmachines" - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _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 VirtualmachinesOperations: +class VirtualMachineInstancesOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.azurestackhci.AzureStackHCIClient`'s - :attr:`virtualmachines` attribute. + :attr:`virtual_machine_instances` attribute. """ models = _models @@ -388,17 +271,15 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def retrieve(self, resource_group_name: str, virtualmachines_name: str, **kwargs: Any) -> _models.Virtualmachines: - """Gets virtual machines by resource name. + def get(self, resource_uri: str, **kwargs: Any) -> _models.VirtualMachineInstance: + """Gets a virtual machine instance. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Virtualmachines or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualmachines + :return: VirtualMachineInstance or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.VirtualMachineInstance :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -412,25 +293,22 @@ def retrieve(self, resource_group_name: str, virtualmachines_name: str, **kwargs _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Virtualmachines] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualMachineInstance] = kwargs.pop("cls", None) - request = build_retrieve_request( - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, - subscription_id=self._config.subscription_id, + request = build_get_request( + resource_uri=resource_uri, api_version=api_version, - template_url=self.retrieve.metadata["url"], + 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -440,24 +318,18 @@ def retrieve(self, resource_group_name: str, virtualmachines_name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Virtualmachines", pipeline_response) + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - retrieve.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}" - } + get.metadata = {"url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"} def _create_or_update_initial( - self, - resource_group_name: str, - virtualmachines_name: str, - virtualmachines: Union[_models.Virtualmachines, IO], - **kwargs: Any - ) -> _models.Virtualmachines: + self, resource_uri: str, virtual_machine_instance: Union[_models.VirtualMachineInstance, IO], **kwargs: Any + ) -> _models.VirtualMachineInstance: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -469,24 +341,20 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_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.Virtualmachines] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineInstance] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(virtualmachines, (IO, bytes)): - _content = virtualmachines + if isinstance(virtual_machine_instance, (IOBase, bytes)): + _content = virtual_machine_instance else: - _json = self._serialize.body(virtualmachines, "Virtualmachines") + _json = self._serialize.body(virtual_machine_instance, "VirtualMachineInstance") request = build_create_or_update_request( - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, content_type=content_type, json=_json, @@ -498,8 +366,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 @@ -510,10 +379,10 @@ def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("Virtualmachines", pipeline_response) + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("Virtualmachines", pipeline_response) + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -521,28 +390,26 @@ def _create_or_update_initial( return deserialized # type: ignore _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}" + "url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default" } @overload def begin_create_or_update( self, - resource_group_name: str, - virtualmachines_name: str, - virtualmachines: _models.Virtualmachines, + resource_uri: str, + virtual_machine_instance: _models.VirtualMachineInstance, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Virtualmachines]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str - :param virtualmachines: Required. - :type virtualmachines: ~azure.mgmt.azurestackhci.models.Virtualmachines + ) -> LROPoller[_models.VirtualMachineInstance]: + """The operation to create or update a virtual machine instance. Please note some properties can + be set only during virtual machine instance creation. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param virtual_machine_instance: Required. + :type virtual_machine_instance: ~azure.mgmt.azurestackhci.models.VirtualMachineInstance :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -554,31 +421,24 @@ def begin_create_or_update( :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 Virtualmachines or the result of + :return: An instance of LROPoller that returns either VirtualMachineInstance or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Virtualmachines] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.VirtualMachineInstance] :raises ~azure.core.exceptions.HttpResponseError: """ @overload def begin_create_or_update( - self, - resource_group_name: str, - virtualmachines_name: str, - virtualmachines: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Virtualmachines]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str - :param virtualmachines: Required. - :type virtualmachines: IO + self, resource_uri: str, virtual_machine_instance: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.VirtualMachineInstance]: + """The operation to create or update a virtual machine instance. Please note some properties can + be set only during virtual machine instance creation. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param virtual_machine_instance: Required. + :type virtual_machine_instance: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -590,29 +450,25 @@ def begin_create_or_update( :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 Virtualmachines or the result of + :return: An instance of LROPoller that returns either VirtualMachineInstance or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Virtualmachines] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.VirtualMachineInstance] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace def begin_create_or_update( - self, - resource_group_name: str, - virtualmachines_name: str, - virtualmachines: Union[_models.Virtualmachines, IO], - **kwargs: Any - ) -> LROPoller[_models.Virtualmachines]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. + self, resource_uri: str, virtual_machine_instance: Union[_models.VirtualMachineInstance, IO], **kwargs: Any + ) -> LROPoller[_models.VirtualMachineInstance]: + """The operation to create or update a virtual machine instance. Please note some properties can + be set only during virtual machine instance creation. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param virtual_machine_instance: Is either a VirtualMachineInstance type or a IO type. Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str - :param virtualmachines: Is either a model type or a IO type. Required. - :type virtualmachines: ~azure.mgmt.azurestackhci.models.Virtualmachines or IO + :type virtual_machine_instance: ~azure.mgmt.azurestackhci.models.VirtualMachineInstance or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -624,27 +480,24 @@ def begin_create_or_update( :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 Virtualmachines or the result of + :return: An instance of LROPoller that returns either VirtualMachineInstance or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Virtualmachines] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.VirtualMachineInstance] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_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.Virtualmachines] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineInstance] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, - virtualmachines=virtualmachines, + resource_uri=resource_uri, + virtual_machine_instance=virtual_machine_instance, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -655,7 +508,7 @@ def begin_create_or_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Virtualmachines", pipeline_response) + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized @@ -678,25 +531,12 @@ def get_long_running_output(pipeline_response): 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.AzureStackHCI/virtualmachines/{virtualmachinesName}" + "url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default" } - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtualmachines_name: str, **kwargs: Any + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_uri: str, **kwargs: Any ) -> None: - """delete. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_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, @@ -708,122 +548,109 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, - template_url=self.delete.metadata["url"], + 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}" + _delete_initial.metadata = { + "url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default" } - @overload - def update( - self, - resource_group_name: str, - virtualmachines_name: str, - virtualmachines: _models.VirtualmachinesPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Virtualmachines: - """update. + @distributed_trace + def begin_delete(self, resource_uri: str, **kwargs: Any) -> LROPoller[None]: + """The operation to delete a virtual machine instance. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str - :param virtualmachines: Required. - :type virtualmachines: ~azure.mgmt.azurestackhci.models.VirtualmachinesPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Virtualmachines or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualmachines + :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 {}) - @overload - def update( - self, - resource_group_name: str, - virtualmachines_name: str, - virtualmachines: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Virtualmachines: - """update. + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_uri=resource_uri, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str - :param virtualmachines: Required. - :type virtualmachines: 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: Virtualmachines or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualmachines - :raises ~azure.core.exceptions.HttpResponseError: - """ + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) - @distributed_trace - def update( + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = {"url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"} + + def _update_initial( self, - resource_group_name: str, - virtualmachines_name: str, - virtualmachines: Union[_models.VirtualmachinesPatch, IO], + resource_uri: str, + virtual_machine_instance: Union[_models.VirtualMachineInstanceUpdateRequest, IO], **kwargs: Any - ) -> _models.Virtualmachines: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str - :param virtualmachines: Is either a model type or a IO type. Required. - :type virtualmachines: ~azure.mgmt.azurestackhci.models.VirtualmachinesPatch 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: Virtualmachines or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualmachines - :raises ~azure.core.exceptions.HttpResponseError: - """ + ) -> Optional[_models.VirtualMachineInstance]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -835,64 +662,202 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_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.Virtualmachines] = kwargs.pop("cls", None) + cls: ClsType[Optional[_models.VirtualMachineInstance]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(virtualmachines, (IO, bytes)): - _content = virtualmachines + if isinstance(virtual_machine_instance, (IOBase, bytes)): + _content = virtual_machine_instance else: - _json = self._serialize.body(virtualmachines, "VirtualmachinesPatch") + _json = self._serialize.body(virtual_machine_instance, "VirtualMachineInstanceUpdateRequest") request = build_update_request( - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], + 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + 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("Virtualmachines", pipeline_response) + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) - if response.status_code == 201: - deserialized = self._deserialize("Virtualmachines", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) - return deserialized # type: ignore + return deserialized - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}" + _update_initial.metadata = { + "url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default" } - def _start_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtualmachines_name: str, **kwargs: Any - ) -> None: + @overload + def begin_update( + self, + resource_uri: str, + virtual_machine_instance: _models.VirtualMachineInstanceUpdateRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualMachineInstance]: + """The operation to update a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param virtual_machine_instance: Required. + :type virtual_machine_instance: + ~azure.mgmt.azurestackhci.models.VirtualMachineInstanceUpdateRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either VirtualMachineInstance or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, resource_uri: str, virtual_machine_instance: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.VirtualMachineInstance]: + """The operation to update a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param virtual_machine_instance: Required. + :type virtual_machine_instance: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either VirtualMachineInstance or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_uri: str, + virtual_machine_instance: Union[_models.VirtualMachineInstanceUpdateRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.VirtualMachineInstance]: + """The operation to update a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param virtual_machine_instance: Is either a VirtualMachineInstanceUpdateRequest type or a IO + type. Required. + :type virtual_machine_instance: + ~azure.mgmt.azurestackhci.models.VirtualMachineInstanceUpdateRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either VirtualMachineInstance or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachineInstance] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_uri=resource_uri, + virtual_machine_instance=virtual_machine_instance, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = {"url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"} + + def _start_initial(self, resource_uri: str, **kwargs: Any) -> Optional[_models.VirtualMachineInstance]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -904,15 +869,11 @@ def _start_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.VirtualMachineInstance]] = kwargs.pop("cls", None) request = build_start_request( - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, template_url=self._start_initial.metadata["url"], headers=_headers, @@ -921,8 +882,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 @@ -932,22 +894,30 @@ def _start_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, response_headers) + + return deserialized _start_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/start" + "url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/start" } @distributed_trace - def begin_start(self, resource_group_name: str, virtualmachines_name: str, **kwargs: Any) -> LROPoller[None]: - """start. + def begin_start(self, resource_uri: str, **kwargs: Any) -> LROPoller[_models.VirtualMachineInstance]: + """The operation to start a virtual machine instance. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -956,24 +926,22 @@ def begin_start(self, resource_group_name: str, virtualmachines_name: str, **kwa :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] + :return: An instance of LROPoller that returns either VirtualMachineInstance or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.VirtualMachineInstance] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualMachineInstance] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._start_initial( # type: ignore - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, + raw_result = self._start_initial( + resource_uri=resource_uri, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -982,13 +950,15 @@ def begin_start(self, resource_group_name: str, virtualmachines_name: str, **kwa ) kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) if cls: - return cls(pipeline_response, None, {}) + 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) + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) @@ -1004,12 +974,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_start.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/start" + "url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/start" } - def _stop_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtualmachines_name: str, **kwargs: Any - ) -> None: + def _stop_initial(self, resource_uri: str, **kwargs: Any) -> Optional[_models.VirtualMachineInstance]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1021,15 +989,11 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.VirtualMachineInstance]] = kwargs.pop("cls", None) request = build_stop_request( - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, template_url=self._stop_initial.metadata["url"], headers=_headers, @@ -1038,8 +1002,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 @@ -1049,22 +1014,30 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, response_headers) + + return deserialized _stop_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/stop" + "url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/stop" } @distributed_trace - def begin_stop(self, resource_group_name: str, virtualmachines_name: str, **kwargs: Any) -> LROPoller[None]: - """stop. + def begin_stop(self, resource_uri: str, **kwargs: Any) -> LROPoller[_models.VirtualMachineInstance]: + """The operation to stop a virtual machine instance. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1073,24 +1046,22 @@ def begin_stop(self, resource_group_name: str, virtualmachines_name: str, **kwar :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] + :return: An instance of LROPoller that returns either VirtualMachineInstance or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.VirtualMachineInstance] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualMachineInstance] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._stop_initial( # type: ignore - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, + raw_result = self._stop_initial( + resource_uri=resource_uri, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -1099,13 +1070,15 @@ def begin_stop(self, resource_group_name: str, virtualmachines_name: str, **kwar ) kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) if cls: - return cls(pipeline_response, None, {}) + 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) + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) @@ -1121,12 +1094,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_stop.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/stop" + "url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/stop" } - def _restart_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtualmachines_name: str, **kwargs: Any - ) -> None: + def _restart_initial(self, resource_uri: str, **kwargs: Any) -> Optional[_models.VirtualMachineInstance]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1138,15 +1109,11 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.VirtualMachineInstance]] = kwargs.pop("cls", None) request = build_restart_request( - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, template_url=self._restart_initial.metadata["url"], headers=_headers, @@ -1155,8 +1122,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 @@ -1166,22 +1134,30 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, response_headers) + + return deserialized _restart_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/restart" + "url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/restart" } @distributed_trace - def begin_restart(self, resource_group_name: str, virtualmachines_name: str, **kwargs: Any) -> LROPoller[None]: - """restart. + def begin_restart(self, resource_uri: str, **kwargs: Any) -> LROPoller[_models.VirtualMachineInstance]: + """The operation to restart a virtual machine instance. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1190,24 +1166,22 @@ def begin_restart(self, resource_group_name: str, virtualmachines_name: str, **k :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] + :return: An instance of LROPoller that returns either VirtualMachineInstance or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.VirtualMachineInstance] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualMachineInstance] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restart_initial( # type: ignore - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, + raw_result = self._restart_initial( + resource_uri=resource_uri, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -1216,13 +1190,15 @@ def begin_restart(self, resource_group_name: str, virtualmachines_name: str, **k ) kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) if cls: - return cls(pipeline_response, None, {}) + 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) + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) @@ -1238,113 +1214,27 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_restart.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/restart" + "url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/restart" } @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Virtualmachines"]: - """list_by_resource_group. + def list(self, resource_uri: str, **kwargs: Any) -> Iterable["_models.VirtualMachineInstance"]: + """Lists all of the virtual machine instances within the specified parent resource. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Virtualmachines or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Virtualmachines] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualmachinesListResult] = 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_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.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("VirtualmachinesListResult", 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines" - } - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Virtualmachines"]: - """list_by_subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Virtualmachines or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Virtualmachines] + :return: An iterator like instance of either VirtualMachineInstance or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.VirtualMachineInstance] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualmachinesListResult] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualMachineInstanceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1357,10 +1247,10 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Virtualmachin def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, + request = build_list_request( + resource_uri=resource_uri, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -1386,7 +1276,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualmachinesListResult", pipeline_response) + deserialized = self._deserialize("VirtualMachineInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -1395,8 +1285,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 @@ -1409,6 +1300,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualmachines" - } + list.metadata = {"url": "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances"} diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtualnetworks_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtualnetworks_operations.py deleted file mode 100644 index 24905b034e7ed..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtualnetworks_operations.py +++ /dev/null @@ -1,952 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- -import sys -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 - -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]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_retrieve_request( - resource_group_name: str, virtualnetworks_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks/{virtualnetworksName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "virtualnetworksName": _SERIALIZER.url( - "virtualnetworks_name", virtualnetworks_name, "str", max_length=64, min_length=3 - ), - } - - _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_create_or_update_request( - resource_group_name: str, virtualnetworks_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks/{virtualnetworksName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "virtualnetworksName": _SERIALIZER.url( - "virtualnetworks_name", virtualnetworks_name, "str", max_length=64, min_length=3 - ), - } - - _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_delete_request( - resource_group_name: str, virtualnetworks_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks/{virtualnetworksName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "virtualnetworksName": _SERIALIZER.url( - "virtualnetworks_name", virtualnetworks_name, "str", max_length=64, min_length=3 - ), - } - - _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_update_request( - resource_group_name: str, virtualnetworks_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks/{virtualnetworksName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "virtualnetworksName": _SERIALIZER.url( - "virtualnetworks_name", virtualnetworks_name, "str", max_length=64, min_length=3 - ), - } - - _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_list_by_resource_group_request(resource_group_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _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_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualnetworks" - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _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 VirtualnetworksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.azurestackhci.AzureStackHCIClient`'s - :attr:`virtualnetworks` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def retrieve(self, resource_group_name: str, virtualnetworks_name: str, **kwargs: Any) -> _models.Virtualnetworks: - """retrieve. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualnetworks_name: Required. - :type virtualnetworks_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Virtualnetworks or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualnetworks - :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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Virtualnetworks] = kwargs.pop("cls", None) - - request = build_retrieve_request( - resource_group_name=resource_group_name, - virtualnetworks_name=virtualnetworks_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.retrieve.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("Virtualnetworks", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - retrieve.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks/{virtualnetworksName}" - } - - def _create_or_update_initial( - self, - resource_group_name: str, - virtualnetworks_name: str, - virtualnetworks: Union[_models.Virtualnetworks, IO], - **kwargs: Any - ) -> _models.Virtualnetworks: - 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: Literal["2021-09-01-preview"] = 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.Virtualnetworks] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(virtualnetworks, (IO, bytes)): - _content = virtualnetworks - else: - _json = self._serialize.body(virtualnetworks, "Virtualnetworks") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - virtualnetworks_name=virtualnetworks_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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("Virtualnetworks", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Virtualnetworks", 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.AzureStackHCI/virtualnetworks/{virtualnetworksName}" - } - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - virtualnetworks_name: str, - virtualnetworks: _models.Virtualnetworks, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Virtualnetworks]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualnetworks_name: Required. - :type virtualnetworks_name: str - :param virtualnetworks: Required. - :type virtualnetworks: ~azure.mgmt.azurestackhci.models.Virtualnetworks - :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 Virtualnetworks or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Virtualnetworks] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - virtualnetworks_name: str, - virtualnetworks: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Virtualnetworks]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualnetworks_name: Required. - :type virtualnetworks_name: str - :param virtualnetworks: Required. - :type virtualnetworks: 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 Virtualnetworks or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Virtualnetworks] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - virtualnetworks_name: str, - virtualnetworks: Union[_models.Virtualnetworks, IO], - **kwargs: Any - ) -> LROPoller[_models.Virtualnetworks]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualnetworks_name: Required. - :type virtualnetworks_name: str - :param virtualnetworks: Is either a model type or a IO type. Required. - :type virtualnetworks: ~azure.mgmt.azurestackhci.models.Virtualnetworks 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 Virtualnetworks or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Virtualnetworks] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = 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.Virtualnetworks] = 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, - virtualnetworks_name=virtualnetworks_name, - virtualnetworks=virtualnetworks, - 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("Virtualnetworks", 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.AzureStackHCI/virtualnetworks/{virtualnetworksName}" - } - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtualnetworks_name: str, **kwargs: Any - ) -> None: - """delete. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualnetworks_name: Required. - :type virtualnetworks_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: Literal["2021-09-01-preview"] = 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, - virtualnetworks_name=virtualnetworks_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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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.AzureStackHCI/virtualnetworks/{virtualnetworksName}" - } - - @overload - def update( - self, - resource_group_name: str, - virtualnetworks_name: str, - virtualnetworks: _models.VirtualnetworksPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Virtualnetworks: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualnetworks_name: Required. - :type virtualnetworks_name: str - :param virtualnetworks: Required. - :type virtualnetworks: ~azure.mgmt.azurestackhci.models.VirtualnetworksPatch - :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: Virtualnetworks or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualnetworks - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - virtualnetworks_name: str, - virtualnetworks: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Virtualnetworks: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualnetworks_name: Required. - :type virtualnetworks_name: str - :param virtualnetworks: Required. - :type virtualnetworks: 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: Virtualnetworks or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualnetworks - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - virtualnetworks_name: str, - virtualnetworks: Union[_models.VirtualnetworksPatch, IO], - **kwargs: Any - ) -> _models.Virtualnetworks: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualnetworks_name: Required. - :type virtualnetworks_name: str - :param virtualnetworks: Is either a model type or a IO type. Required. - :type virtualnetworks: ~azure.mgmt.azurestackhci.models.VirtualnetworksPatch 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: Virtualnetworks or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualnetworks - :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: Literal["2021-09-01-preview"] = 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.Virtualnetworks] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(virtualnetworks, (IO, bytes)): - _content = virtualnetworks - else: - _json = self._serialize.body(virtualnetworks, "VirtualnetworksPatch") - - request = build_update_request( - resource_group_name=resource_group_name, - virtualnetworks_name=virtualnetworks_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("Virtualnetworks", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Virtualnetworks", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks/{virtualnetworksName}" - } - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Virtualnetworks"]: - """list_by_resource_group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Virtualnetworks or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Virtualnetworks] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualnetworksListResult] = 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_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.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("VirtualnetworksListResult", 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks" - } - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Virtualnetworks"]: - """list_by_subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Virtualnetworks or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Virtualnetworks] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualnetworksListResult] = 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_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.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("VirtualnetworksListResult", 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualnetworks" - } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/create_cluster.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/create_cluster.py deleted file mode 100644 index 516731fc9eae2..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/create_cluster.py +++ /dev/null @@ -1,49 +0,0 @@ -# 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.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python create_cluster.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 = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.clusters.create( - resource_group_name="test-rg", - cluster_name="myCluster", - cluster={ - "location": "East US", - "properties": { - "aadClientId": "24a6e53d-04e5-44d2-b7cc-1b732a847dfc", - "aadTenantId": "7e589cc1-a8b6-4dff-91bd-5ec0fa18db94", - "cloudManagementEndpoint": "https://98294836-31be-4668-aeae-698667faf99b.waconazure.com", - }, - }, - ) - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/CreateCluster.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/create_guest_agent.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/create_guest_agent.py index cdb414e001cd3..ee291e7cf051b 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/create_guest_agent.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/create_guest_agent.py @@ -26,17 +26,15 @@ def main(): client = AzureStackHCIClient( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="SUBSCRIPTION_ID", ) response = client.guest_agent.begin_create( - resource_group_name="testrg", - virtual_machine_name="ContosoVm", - name="default", + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", ).result() print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/CreateGuestAgent.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/CreateGuestAgent.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/create_hybrid_identity_metadata.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/create_hybrid_identity_metadata.py deleted file mode 100644 index ce27f7a95e20c..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/create_hybrid_identity_metadata.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# 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 = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.hybrid_identity_metadata.create( - resource_group_name="testrg", - virtual_machine_name="ContosoVm", - metadata_name="default", - ) - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/CreateHybridIdentityMetadata.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_gallery_image.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_gallery_image.py index 80111f3d11ed3..b93ae19b44824 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_gallery_image.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_gallery_image.py @@ -29,13 +29,12 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.galleryimages.delete( + client.gallery_images.begin_delete( resource_group_name="test-rg", - galleryimages_name="test-gallery-image", - ) - print(response) + gallery_image_name="test-gallery-image", + ).result() -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/DeleteGalleryImage.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/DeleteGalleryImage.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_guest_agent.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_guest_agent.py index d6898d7c21fc5..5dde61d1f0a9c 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_guest_agent.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_guest_agent.py @@ -26,17 +26,14 @@ def main(): client = AzureStackHCIClient( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.guest_agent.begin_delete( - resource_group_name="testrg", - virtual_machine_name="ContosoVm", - name="default", + client.guest_agent.begin_delete( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", ).result() - print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/DeleteGuestAgent.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/DeleteGuestAgent.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_hybrid_identity_metadata.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_hybrid_identity_metadata.py deleted file mode 100644 index c079556522585..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_hybrid_identity_metadata.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# 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 = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.hybrid_identity_metadata.delete( - resource_group_name="testrg", - virtual_machine_name="ContosoVm", - metadata_name="default", - ) - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/DeleteHybridIdentityMetadata.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_cluster.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_logical_network.py similarity index 86% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_cluster.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_logical_network.py index 633ef85f66e15..088b331cd4df1 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_cluster.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_logical_network.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python delete_cluster.py + python delete_logical_network.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, @@ -29,13 +29,12 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.clusters.delete( + client.logical_networks.begin_delete( resource_group_name="test-rg", - cluster_name="myCluster", - ) - print(response) + logical_network_name="test-lnet", + ).result() -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/DeleteCluster.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/DeleteLogicalNetwork.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_marketplace_gallery_image.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_marketplace_gallery_image.py index 7e37ddce539a0..36861364d8623 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_marketplace_gallery_image.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_marketplace_gallery_image.py @@ -29,13 +29,12 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.marketplacegalleryimages.delete( + client.marketplace_gallery_images.begin_delete( resource_group_name="test-rg", - marketplacegalleryimages_name="test-marketplace-gallery-image", - ) - print(response) + marketplace_gallery_image_name="test-marketplace-gallery-image", + ).result() -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/DeleteMarketplaceGalleryImage.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/DeleteMarketplaceGalleryImage.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_network_interface.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_network_interface.py index 0a8fcf885ff30..4b78f4b43dd1d 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_network_interface.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_network_interface.py @@ -29,13 +29,12 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.networkinterfaces.delete( + client.network_interfaces.begin_delete( resource_group_name="test-rg", - networkinterfaces_name="test-nic", - ) - print(response) + network_interface_name="test-nic", + ).result() -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/DeleteNetworkInterface.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/DeleteNetworkInterface.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_storage_container.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_storage_container.py index 76e9b4ab7b84f..04a882d2a2e0f 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_storage_container.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_storage_container.py @@ -29,13 +29,12 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.storagecontainers.delete( + client.storage_containers.begin_delete( resource_group_name="test-rg", - storagecontainers_name="Default_Container", - ) - print(response) + storage_container_name="Default_Container", + ).result() -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/DeleteStorageContainer.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/DeleteStorageContainer.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_virtual_hard_disk.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_virtual_hard_disk.py index 9db228ce59e9f..aa3aa140e851e 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_virtual_hard_disk.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_virtual_hard_disk.py @@ -29,13 +29,12 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.virtualharddisks.delete( + client.virtual_hard_disks.begin_delete( resource_group_name="test-rg", - virtualharddisks_name="test-vhd", - ) - print(response) + virtual_hard_disk_name="test-vhd", + ).result() -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/DeleteVirtualHardDisk.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/DeleteVirtualHardDisk.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_virtual_machine.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_virtual_machine.py deleted file mode 100644 index 58c1aeead4ab7..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_virtual_machine.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python delete_virtual_machine.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 = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.virtualmachines.delete( - resource_group_name="test-rg", - virtualmachines_name="test-vm", - ) - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/DeleteVirtualMachine.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_machine_extension.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_virtual_machine_instance.py similarity index 77% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_machine_extension.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_virtual_machine_instance.py index 8fad23cac42d2..f0312072562a5 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_machine_extension.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_virtual_machine_instance.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python delete_machine_extension.py + python delete_virtual_machine_instance.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,17 +26,14 @@ def main(): client = AzureStackHCIClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="SUBSCRIPTION_ID", ) - response = client.machine_extensions.begin_delete( - resource_group_name="myResourceGroup", - name="myMachine", - extension_name="MMA", + client.virtual_machine_instances.begin_delete( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", ).result() - print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/DeleteMachineExtension.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/DeleteVirtualMachineInstance.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_arc_setting.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_arc_setting.py deleted file mode 100644 index 32efb5f49e293..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_arc_setting.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python get_arc_setting.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 = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.arc_settings.get( - resource_group_name="test-rg", - cluster_name="myCluster", - arc_setting_name="default", - ) - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/GetArcSetting.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_extension.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_extension.py deleted file mode 100644 index 78c3d534ade55..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_extension.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# 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 = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.extensions.get( - resource_group_name="test-rg", - cluster_name="myCluster", - arc_setting_name="default", - extension_name="MicrosoftMonitoringAgent", - ) - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/GetExtension.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_gallery_image.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_gallery_image.py index 12cf0a18fbb13..94d56527725b9 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_gallery_image.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_gallery_image.py @@ -29,13 +29,13 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.galleryimages.retrieve( + response = client.gallery_images.get( resource_group_name="test-rg", - galleryimages_name="test-gallery-image", + gallery_image_name="test-gallery-image", ) print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/GetGalleryImage.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/GetGalleryImage.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_guest_agent.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_guest_agent.py index c34b5edbebfd5..26f030ef7c02b 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_guest_agent.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_guest_agent.py @@ -26,17 +26,15 @@ def main(): client = AzureStackHCIClient( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="SUBSCRIPTION_ID", ) response = client.guest_agent.get( - resource_group_name="testrg", - virtual_machine_name="ContosoVm", - name="default", + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", ) print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/GetGuestAgent.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/GetGuestAgent.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_hybrid_identity_metadata.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_hybrid_identity_metadata.py index 7e54484d1287c..6e3176e5e513f 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_hybrid_identity_metadata.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_hybrid_identity_metadata.py @@ -26,17 +26,15 @@ def main(): client = AzureStackHCIClient( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="SUBSCRIPTION_ID", ) response = client.hybrid_identity_metadata.get( - resource_group_name="testrg", - virtual_machine_name="ContosoVm", - metadata_name="default", + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", ) print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/GetHybridIdentityMetadata.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/GetHybridIdentityMetadata.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_cluster.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_logical_network.py similarity index 87% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_cluster.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_logical_network.py index 0813a55786e95..006bc224da506 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_cluster.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_logical_network.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python get_cluster.py + python get_logical_network.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, @@ -29,13 +29,13 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.clusters.get( + response = client.logical_networks.get( resource_group_name="test-rg", - cluster_name="myCluster", + logical_network_name="test-lnet", ) print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/GetCluster.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/GetLogicalNetwork.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_machine_extension.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_machine_extension.py deleted file mode 100644 index b19c84c63ad5a..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_machine_extension.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python get_machine_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 = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", - ) - - response = client.machine_extensions.get( - resource_group_name="myResourceGroup", - name="myMachine", - extension_name="CustomScriptExtension", - ) - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/GetMachineExtension.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_marketplace_gallery_image.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_marketplace_gallery_image.py index 44cd39991fb2a..641884dbeb584 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_marketplace_gallery_image.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_marketplace_gallery_image.py @@ -29,13 +29,13 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.marketplacegalleryimages.get( + response = client.marketplace_gallery_images.get( resource_group_name="test-rg", - marketplacegalleryimages_name="test-marketplace-gallery-image", + marketplace_gallery_image_name="test-marketplace-gallery-image", ) print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/GetMarketplaceGalleryImage.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/GetMarketplaceGalleryImage.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_network_interface.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_network_interface.py index 5fc34f35ef44a..5016c8a78c295 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_network_interface.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_network_interface.py @@ -29,13 +29,13 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.networkinterfaces.retrieve( + response = client.network_interfaces.get( resource_group_name="test-rg", - networkinterfaces_name="test-nic", + network_interface_name="test-nic", ) print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/GetNetworkInterface.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/GetNetworkInterface.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_storage_container.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_storage_container.py index 0c2d4cf3f8d47..09d9ddda961fb 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_storage_container.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_storage_container.py @@ -29,13 +29,13 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.storagecontainers.retrieve( + response = client.storage_containers.get( resource_group_name="test-rg", - storagecontainers_name="Default_Container", + storage_container_name="Default_Container", ) print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/GetStorageContainer.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/GetStorageContainer.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_virtual_hard_disk.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_virtual_hard_disk.py index 8372e05c3e79a..a779be3ae6176 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_virtual_hard_disk.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_virtual_hard_disk.py @@ -29,13 +29,13 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.virtualharddisks.retrieve( + response = client.virtual_hard_disks.get( resource_group_name="test-rg", - virtualharddisks_name="test-vhd", + virtual_hard_disk_name="test-vhd", ) print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/GetVirtualHardDisk.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/GetVirtualHardDisk.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_virtual_machine.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_virtual_machine.py deleted file mode 100644 index 70fe637e41cfe..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_virtual_machine.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python get_virtual_machine.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 = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.virtualmachines.retrieve( - resource_group_name="test-rg", - virtualmachines_name="test-vm", - ) - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/GetVirtualMachine.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_virtual_network.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_virtual_machine_instance.py similarity index 77% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_virtual_network.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_virtual_machine_instance.py index dc65b21e479dd..d79fdb1baae39 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_virtual_network.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_virtual_machine_instance.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python delete_virtual_network.py + python get_virtual_machine_instance.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,16 +26,15 @@ def main(): client = AzureStackHCIClient( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.virtualnetworks.delete( - resource_group_name="test-rg", - virtualnetworks_name="test-vnet", + response = client.virtual_machine_instances.get( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", ) print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/DeleteVirtualNetwork.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/GetVirtualMachineInstance.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_virtual_network.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_virtual_network.py deleted file mode 100644 index 3b02068c3d458..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_virtual_network.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python get_virtual_network.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 = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.virtualnetworks.retrieve( - resource_group_name="test-rg", - virtualnetworks_name="test-vnet", - ) - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/GetVirtualNetwork.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_machine_extension.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/guest_agent_list.py similarity index 79% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_machine_extension.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/guest_agent_list.py index c5ad1793a5d38..e68912b18d73c 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_machine_extension.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/guest_agent_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python list_machine_extension.py + python guest_agent_list.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, @@ -26,17 +26,16 @@ def main(): client = AzureStackHCIClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="SUBSCRIPTION_ID", ) - response = client.machine_extensions.list_by_virtual_machines( - resource_group_name="myResourceGroup", - name="myMachine", + response = client.guest_agents.list( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", ) for item in response: print(item) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListMachineExtension.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/GuestAgent_List.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/guest_agent_list_by_virtual_machines.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/hybrid_identity_metadata_list.py similarity index 78% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/guest_agent_list_by_virtual_machines.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/hybrid_identity_metadata_list.py index 7899e3781c76d..53de5feed7dd0 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/guest_agent_list_by_virtual_machines.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/hybrid_identity_metadata_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python guest_agent_list_by_virtual_machines.py + python hybrid_identity_metadata_list.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, @@ -26,17 +26,16 @@ def main(): client = AzureStackHCIClient( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.guest_agents.list_by_virtual_machines( - resource_group_name="testrg", - virtual_machine_name="ContosoVm", + response = client.hybrid_identity_metadata.list( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", ) for item in response: print(item) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/GuestAgent_ListByVirtualMachines.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/HybridIdentityMetadata_List.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/hybrid_identity_metadata_list_by_virtual_machines.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/hybrid_identity_metadata_list_by_virtual_machines.py deleted file mode 100644 index bddf85a0e8428..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/hybrid_identity_metadata_list_by_virtual_machines.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python hybrid_identity_metadata_list_by_virtual_machines.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 = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.hybrid_identity_metadata.list_by_virtual_machines( - resource_group_name="testrg", - virtual_machine_name="ContosoVm", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/HybridIdentityMetadata_ListByVirtualMachines.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_extensions_by_arc_setting.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_extensions_by_arc_setting.py deleted file mode 100644 index 413941b11bb29..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_extensions_by_arc_setting.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python list_extensions_by_arc_setting.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 = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.extensions.list_by_arc_setting( - resource_group_name="test-rg", - cluster_name="myCluster", - arc_setting_name="default", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListExtensionsByArcSetting.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_gallery_image_by_resource_group.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_gallery_image_by_resource_group.py index ca44f9e79f626..e5eae9d22b22a 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_gallery_image_by_resource_group.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_gallery_image_by_resource_group.py @@ -29,13 +29,13 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.galleryimages.list_by_resource_group( + response = client.gallery_images.list( resource_group_name="test-rg", ) for item in response: print(item) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListGalleryImageByResourceGroup.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/ListGalleryImageByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_gallery_image_by_subscription.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_gallery_image_by_subscription.py index 14b66c3d97d23..8e343a542ecfb 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_gallery_image_by_subscription.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_gallery_image_by_subscription.py @@ -29,11 +29,11 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.galleryimages.list_by_subscription() + response = client.gallery_images.list_all() for item in response: print(item) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListGalleryImageBySubscription.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/ListGalleryImageBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_clusters_by_resource_group.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_logical_network_by_resource_group.py similarity index 87% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_clusters_by_resource_group.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_logical_network_by_resource_group.py index e3370a99f21bd..1c776a123d336 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_clusters_by_resource_group.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_logical_network_by_resource_group.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python list_clusters_by_resource_group.py + python list_logical_network_by_resource_group.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, @@ -29,13 +29,13 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.clusters.list_by_resource_group( + response = client.logical_networks.list( resource_group_name="test-rg", ) for item in response: print(item) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListClustersByResourceGroup.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/ListLogicalNetworkByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_clusters_by_subscription.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_logical_network_by_subscription.py similarity index 87% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_clusters_by_subscription.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_logical_network_by_subscription.py index a5d08ce8f22a8..78553475888dc 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_clusters_by_subscription.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_logical_network_by_subscription.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python list_clusters_by_subscription.py + python list_logical_network_by_subscription.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, @@ -29,11 +29,11 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.clusters.list_by_subscription() + response = client.logical_networks.list_all() for item in response: print(item) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListClustersBySubscription.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/ListLogicalNetworkBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_marketplace_gallery_image_by_resource_group.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_marketplace_gallery_image_by_resource_group.py index 44b055f20edc8..f9fbb9ed2985f 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_marketplace_gallery_image_by_resource_group.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_marketplace_gallery_image_by_resource_group.py @@ -29,13 +29,13 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.marketplacegalleryimages.list_by_resource_group( + response = client.marketplace_gallery_images.list( resource_group_name="test-rg", ) for item in response: print(item) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListMarketplaceGalleryImageByResourceGroup.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/ListMarketplaceGalleryImageByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_marketplace_gallery_image_by_subscription.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_marketplace_gallery_image_by_subscription.py index 92e3f66f89d4f..c79c8b7ef4885 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_marketplace_gallery_image_by_subscription.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_marketplace_gallery_image_by_subscription.py @@ -29,11 +29,11 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.marketplacegalleryimages.list_by_subscription() + response = client.marketplace_gallery_images.list_all() for item in response: print(item) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListMarketplaceGalleryImageBySubscription.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/ListMarketplaceGalleryImageBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_network_interface_by_resource_group.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_network_interface_by_resource_group.py index 331cb1e912e44..73f5e3739ff9d 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_network_interface_by_resource_group.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_network_interface_by_resource_group.py @@ -29,13 +29,13 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.networkinterfaces.list_by_resource_group( + response = client.network_interfaces.list( resource_group_name="test-rg", ) for item in response: print(item) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListNetworkInterfaceByResourceGroup.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/ListNetworkInterfaceByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_network_interface_by_subscription.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_network_interface_by_subscription.py index e69a28a7196ab..c979b349d2651 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_network_interface_by_subscription.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_network_interface_by_subscription.py @@ -29,11 +29,11 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.networkinterfaces.list_by_subscription() + response = client.network_interfaces.list_all() for item in response: print(item) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListNetworkInterfaceBySubscription.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/ListNetworkInterfaceBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_operation_by_cluster.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_operations.py similarity index 85% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_operation_by_cluster.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_operations.py index 93643deff7bcb..d303999ab6f8e 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_operation_by_cluster.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_operations.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python list_operation_by_cluster.py + python list_operations.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, @@ -26,13 +26,14 @@ def main(): client = AzureStackHCIClient( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="SUBSCRIPTION_ID", ) response = client.operations.list() - print(response) + for item in response: + print(item) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListOperationByCluster.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/ListOperations.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_storage_container_by_resource_group.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_storage_container_by_resource_group.py index e9d2c854157f7..59263593749ce 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_storage_container_by_resource_group.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_storage_container_by_resource_group.py @@ -29,13 +29,13 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.storagecontainers.list_by_resource_group( + response = client.storage_containers.list( resource_group_name="test-rg", ) for item in response: print(item) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListStorageContainerByResourceGroup.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/ListStorageContainerByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_storage_container_by_subscription.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_storage_container_by_subscription.py index a6f7685bdd555..f1b8051f41721 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_storage_container_by_subscription.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_storage_container_by_subscription.py @@ -29,11 +29,11 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.storagecontainers.list_by_subscription() + response = client.storage_containers.list_all() for item in response: print(item) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListStorageContainerBySubscription.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/ListStorageContainerBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_hard_disk_by_resource_group.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_hard_disk_by_resource_group.py index 0d516615f088b..1da00f27fe950 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_hard_disk_by_resource_group.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_hard_disk_by_resource_group.py @@ -29,13 +29,13 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.virtualharddisks.list_by_resource_group( + response = client.virtual_hard_disks.list( resource_group_name="test-rg", ) for item in response: print(item) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListVirtualHardDiskByResourceGroup.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/ListVirtualHardDiskByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_hard_disk_by_subscription.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_hard_disk_by_subscription.py index 872e5a8bad561..92c660e5617c4 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_hard_disk_by_subscription.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_hard_disk_by_subscription.py @@ -29,11 +29,11 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.virtualharddisks.list_by_subscription() + response = client.virtual_hard_disks.list_all() for item in response: print(item) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListVirtualHardDiskBySubscription.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/ListVirtualHardDiskBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_machine_by_resource_group.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_machine_by_resource_group.py deleted file mode 100644 index 0eb8e500dfb14..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_machine_by_resource_group.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python list_virtual_machine_by_resource_group.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 = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.virtualmachines.list_by_resource_group( - resource_group_name="test-rg", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListVirtualMachineByResourceGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_machine_by_subscription.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_machine_by_subscription.py deleted file mode 100644 index f716cef397f13..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_machine_by_subscription.py +++ /dev/null @@ -1,39 +0,0 @@ -# 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.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python list_virtual_machine_by_subscription.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 = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.virtualmachines.list_by_subscription() - for item in response: - print(item) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListVirtualMachineBySubscription.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_arc_settings_by_cluster.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_machine_instances.py similarity index 78% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_arc_settings_by_cluster.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_machine_instances.py index 3fb3b73179959..5b8a888a6e22e 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_arc_settings_by_cluster.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_machine_instances.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python list_arc_settings_by_cluster.py + python list_virtual_machine_instances.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,17 +26,16 @@ def main(): client = AzureStackHCIClient( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.arc_settings.list_by_cluster( - resource_group_name="test-rg", - cluster_name="myCluster", + response = client.virtual_machine_instances.list( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", ) for item in response: print(item) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListArcSettingsByCluster.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/ListVirtualMachineInstances.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_network_by_resource_group.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_network_by_resource_group.py deleted file mode 100644 index d4cd8fb1b03af..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_network_by_resource_group.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python list_virtual_network_by_resource_group.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 = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.virtualnetworks.list_by_resource_group( - resource_group_name="test-rg", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListVirtualNetworkByResourceGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_network_by_subscription.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_network_by_subscription.py deleted file mode 100644 index 1dfdd8fb5c57f..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_network_by_subscription.py +++ /dev/null @@ -1,39 +0,0 @@ -# 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.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python list_virtual_network_by_subscription.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 = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.virtualnetworks.list_by_subscription() - for item in response: - print(item) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListVirtualNetworkBySubscription.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_extension.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_extension.py deleted file mode 100644 index bfff134a861b2..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_extension.py +++ /dev/null @@ -1,54 +0,0 @@ -# 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.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# 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 = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.extensions.begin_create( - resource_group_name="test-rg", - cluster_name="myCluster", - arc_setting_name="default", - extension_name="MicrosoftMonitoringAgent", - extension={ - "properties": { - "extensionParameters": { - "protectedSettings": {"workspaceKey": "xx"}, - "publisher": "Microsoft.Compute", - "settings": {"workspaceId": "xx"}, - "type": "MicrosoftMonitoringAgent", - "typeHandlerVersion": "1.10", - } - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/PutExtension.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_gallery_image.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_gallery_image.py index 64a41416b1b3d..8528b380b9da3 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_gallery_image.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_gallery_image.py @@ -29,21 +29,25 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.galleryimages.begin_create_or_update( + response = client.gallery_images.begin_create_or_update( resource_group_name="test-rg", - galleryimages_name="test-gallery-image", - galleryimages={ + gallery_image_name="test-gallery-image", + gallery_images={ "extendedLocation": { "name": "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location", "type": "CustomLocation", }, "location": "West US2", - "properties": {"containerName": "Default_Container", "imagePath": "C:\\test.vhdx"}, + "properties": { + "containerId": "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container", + "imagePath": "C:\\test.vhdx", + "osType": "Linux", + }, }, ).result() print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/PutGalleryImage.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/PutGalleryImage.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_network.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_logical_network.py similarity index 78% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_network.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_logical_network.py index 3cc3f7193cb8d..382ac3bce6f02 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_network.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_logical_network.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python put_virtual_network.py + python put_logical_network.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, @@ -29,21 +29,20 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.virtualnetworks.begin_create_or_update( + response = client.logical_networks.begin_create_or_update( resource_group_name="test-rg", - virtualnetworks_name="test-vnet", - virtualnetworks={ + logical_network_name="test-lnet", + logical_networks={ "extendedLocation": { - "name": "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location", + "name": "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location", "type": "CustomLocation", }, "location": "West US2", - "properties": {"networkType": "Transparent"}, }, ).result() print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/PutVirtualNetwork.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/PutLogicalNetwork.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_machine_extension.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_machine_extension.py deleted file mode 100644 index 585c0dfe58fd7..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_machine_extension.py +++ /dev/null @@ -1,51 +0,0 @@ -# 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.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python put_machine_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 = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", - ) - - response = client.machine_extensions.begin_create_or_update( - resource_group_name="myResourceGroup", - 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/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/PutMachineExtension.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_marketplace_gallery_image.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_marketplace_gallery_image.py index 0f4deb469f58d..2a1eff54570f5 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_marketplace_gallery_image.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_marketplace_gallery_image.py @@ -29,10 +29,10 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.marketplacegalleryimages.begin_create_or_update( + response = client.marketplace_gallery_images.begin_create_or_update( resource_group_name="test-rg", - marketplacegalleryimages_name="test-marketplace-gallery-image", - marketplacegalleryimages={ + marketplace_gallery_image_name="test-marketplace-gallery-image", + marketplace_gallery_images={ "extendedLocation": { "name": "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location", "type": "CustomLocation", @@ -40,7 +40,7 @@ def main(): "location": "West US2", "properties": { "cloudInitDataSource": "Azure", - "containerName": "Default_Container", + "containerId": "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container", "hyperVGeneration": "V1", "identifier": {"offer": "myOfferName", "publisher": "myPublisherName", "sku": "mySkuName"}, "osType": "Windows", @@ -51,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/PutMarketplaceGalleryImage.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/PutMarketplaceGalleryImage.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_network_interface.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_network_interface.py index 660b420c40329..bfe34e120245b 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_network_interface.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_network_interface.py @@ -29,23 +29,23 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.networkinterfaces.begin_create_or_update( + response = client.network_interfaces.begin_create_or_update( resource_group_name="test-rg", - networkinterfaces_name="test-nic", - networkinterfaces={ + network_interface_name="test-nic", + network_interfaces={ "extendedLocation": { "name": "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location", "type": "CustomLocation", }, "location": "West US2", "properties": { - "ipConfigurations": [{"name": "ipconfig-sample", "properties": {"subnet": {"id": "test-vnet"}}}] + "ipConfigurations": [{"name": "ipconfig-sample", "properties": {"subnet": {"id": "test-lnet"}}}] }, }, ).result() print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/PutNetworkInterface.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/PutNetworkInterface.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_storage_container.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_storage_container.py index 98e1be084af22..190fea5df6bfb 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_storage_container.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_storage_container.py @@ -29,10 +29,10 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.storagecontainers.begin_create_or_update( + response = client.storage_containers.begin_create_or_update( resource_group_name="test-rg", - storagecontainers_name="Default_Container", - storagecontainers={ + storage_container_name="Default_Container", + storage_containers={ "extendedLocation": { "name": "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location", "type": "CustomLocation", @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/PutStorageContainer.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/PutStorageContainer.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_hard_disk.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_hard_disk.py index 361980ed369a9..6f8452dc66a80 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_hard_disk.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_hard_disk.py @@ -29,21 +29,21 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.virtualharddisks.begin_create_or_update( + response = client.virtual_hard_disks.begin_create_or_update( resource_group_name="test-rg", - virtualharddisks_name="test-vhd", - virtualharddisks={ + virtual_hard_disk_name="test-vhd", + virtual_hard_disks={ "extendedLocation": { "name": "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location", "type": "CustomLocation", }, "location": "West US2", - "properties": {"diskSizeBytes": 32}, + "properties": {"diskSizeGB": 32}, }, ).result() print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/PutVirtualHardDisk.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/PutVirtualHardDisk.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_machine_with_marketplace_gallery_image.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_machine_instance_with_gallery_image.py similarity index 71% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_machine_with_marketplace_gallery_image.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_machine_instance_with_gallery_image.py index 2de1161921bab..c73c1376c1735 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_machine_with_marketplace_gallery_image.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_machine_instance_with_gallery_image.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python put_virtual_machine_with_marketplace_gallery_image.py + python put_virtual_machine_instance_with_gallery_image.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, @@ -26,18 +26,16 @@ def main(): client = AzureStackHCIClient( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.virtualmachines.begin_create_or_update( - resource_group_name="test-rg", - virtualmachines_name="test-vm", - virtualmachines={ + response = client.virtual_machine_instances.begin_create_or_update( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", + virtual_machine_instance={ "extendedLocation": { "name": "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location", "type": "CustomLocation", }, - "location": "West US2", "properties": { "hardwareProfile": {"vmSize": "Default"}, "networkProfile": {"networkInterfaces": [{"id": "test-nic"}]}, @@ -45,9 +43,9 @@ def main(): "securityProfile": {"enableTPM": True, "uefiSettings": {"secureBootEnabled": True}}, "storageProfile": { "imageReference": { - "name": "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/marketplacegalleryimages/test-marketplace-gallery-image" + "id": "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image" }, - "vmConfigContainerName": "Default_Container", + "vmConfigStoragePathId": "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container", }, }, }, @@ -55,6 +53,6 @@ def main(): print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/PutVirtualMachineWithMarketplaceGalleryImage.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/PutVirtualMachineInstanceWithGalleryImage.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_machine_with_gallery_image.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_machine_instance_with_marketplace_gallery_image.py similarity index 70% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_machine_with_gallery_image.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_machine_instance_with_marketplace_gallery_image.py index d5d1bc038f8b5..9ecbb7f670504 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_machine_with_gallery_image.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_machine_instance_with_marketplace_gallery_image.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python put_virtual_machine_with_gallery_image.py + python put_virtual_machine_instance_with_marketplace_gallery_image.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, @@ -26,18 +26,16 @@ def main(): client = AzureStackHCIClient( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.virtualmachines.begin_create_or_update( - resource_group_name="test-rg", - virtualmachines_name="test-vm", - virtualmachines={ + response = client.virtual_machine_instances.begin_create_or_update( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", + virtual_machine_instance={ "extendedLocation": { "name": "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location", "type": "CustomLocation", }, - "location": "West US2", "properties": { "hardwareProfile": {"vmSize": "Default"}, "networkProfile": {"networkInterfaces": [{"id": "test-nic"}]}, @@ -45,9 +43,9 @@ def main(): "securityProfile": {"enableTPM": True, "uefiSettings": {"secureBootEnabled": True}}, "storageProfile": { "imageReference": { - "name": "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryimages/test-gallery-image" + "id": "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/test-marketplace-gallery-image" }, - "vmConfigContainerName": "Default_Container", + "vmConfigStoragePathId": "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container", }, }, }, @@ -55,6 +53,6 @@ def main(): print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/PutVirtualMachineWithGalleryImage.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/PutVirtualMachineInstanceWithMarketplaceGalleryImage.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_machine_with_os_disk.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_machine_instance_with_os_disk.py similarity index 75% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_machine_with_os_disk.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_machine_instance_with_os_disk.py index 4957f962e92f8..a8ca2c30a7bc2 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_machine_with_os_disk.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_machine_instance_with_os_disk.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python put_virtual_machine_with_os_disk.py + python put_virtual_machine_instance_with_os_disk.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, @@ -26,27 +26,25 @@ def main(): client = AzureStackHCIClient( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.virtualmachines.begin_create_or_update( - resource_group_name="test-rg", - virtualmachines_name="test-vm", - virtualmachines={ + response = client.virtual_machine_instances.begin_create_or_update( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", + virtual_machine_instance={ "extendedLocation": { "name": "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location", "type": "CustomLocation", }, - "location": "West US2", "properties": { "hardwareProfile": {"vmSize": "Default"}, "networkProfile": {"networkInterfaces": [{"id": "test-nic"}]}, "securityProfile": {"enableTPM": True, "uefiSettings": {"secureBootEnabled": True}}, "storageProfile": { "osDisk": { - "id": "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/virtualharddisks/test-vhd" + "id": "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/virtualHardDisks/test-vhd" }, - "vmConfigContainerName": "Default_Container", + "vmConfigStoragePathId": "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container", }, }, }, @@ -54,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/PutVirtualMachineWithOsDisk.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/PutVirtualMachineInstanceWithOsDisk.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_machine_instance_with_vm_config_agent.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_machine_instance_with_vm_config_agent.py new file mode 100644 index 0000000000000..6cb7622402330 --- /dev/null +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_machine_instance_with_vm_config_agent.py @@ -0,0 +1,63 @@ +# 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.azurestackhci import AzureStackHCIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azurestackhci +# USAGE + python put_virtual_machine_instance_with_vm_config_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 = AzureStackHCIClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.virtual_machine_instances.begin_create_or_update( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", + virtual_machine_instance={ + "extendedLocation": { + "name": "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location", + "type": "CustomLocation", + }, + "properties": { + "hardwareProfile": {"vmSize": "Default"}, + "networkProfile": {"networkInterfaces": [{"id": "test-nic"}]}, + "osProfile": { + "adminPassword": "password", + "adminUsername": "localadmin", + "computerName": "luamaster", + "windowsConfiguration": {"provisionVMConfigAgent": True}, + }, + "securityProfile": {"enableTPM": True, "uefiSettings": {"secureBootEnabled": True}}, + "storageProfile": { + "imageReference": { + "id": "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image" + }, + "vmConfigStoragePathId": "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container", + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/PutVirtualMachineInstanceWithVMConfigAgent.json +if __name__ == "__main__": + main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/restart_virtual_machine_instance.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/restart_virtual_machine_instance.py new file mode 100644 index 0000000000000..69a7f8cfb2e04 --- /dev/null +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/restart_virtual_machine_instance.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.azurestackhci import AzureStackHCIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azurestackhci +# USAGE + python restart_virtual_machine_instance.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureStackHCIClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.virtual_machine_instances.begin_restart( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default", + ).result() + print(response) + + +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/RestartVirtualMachineInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/start_virtual_machine.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/start_virtual_machine.py deleted file mode 100644 index 34a5cd745999c..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/start_virtual_machine.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python start_virtual_machine.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 = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.virtualmachines.begin_start( - resource_group_name="test-rg", - virtualmachines_name="test-vm", - ).result() - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/StartVirtualMachine.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/restart_virtual_machine.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/start_virtual_machine_instance.py similarity index 74% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/restart_virtual_machine.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/start_virtual_machine_instance.py index 8c9cd5f4543e1..d13a4ef5a31a2 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/restart_virtual_machine.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/start_virtual_machine_instance.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python restart_virtual_machine.py + python start_virtual_machine_instance.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,16 +26,15 @@ def main(): client = AzureStackHCIClient( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.virtualmachines.begin_restart( - resource_group_name="test-rg", - virtualmachines_name="test-vm", + response = client.virtual_machine_instances.begin_start( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default", ).result() print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/RestartVirtualMachine.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/StartVirtualMachineInstance.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/stop_virtual_machine.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/stop_virtual_machine.py deleted file mode 100644 index 5bb132fe0df3f..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/stop_virtual_machine.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python stop_virtual_machine.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 = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.virtualmachines.begin_stop( - resource_group_name="test-rg", - virtualmachines_name="test-vm", - ).result() - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/StopVirtualMachine.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_arc_setting.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/stop_virtual_machine_instance.py similarity index 74% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_arc_setting.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/stop_virtual_machine_instance.py index 05c12b00a8158..3a76b459490f3 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_arc_setting.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/stop_virtual_machine_instance.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python delete_arc_setting.py + python stop_virtual_machine_instance.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,17 +26,15 @@ def main(): client = AzureStackHCIClient( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.arc_settings.begin_delete( - resource_group_name="test-rg", - cluster_name="myCluster", - arc_setting_name="default", + response = client.virtual_machine_instances.begin_stop( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default", ).result() print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/DeleteArcSetting.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/StopVirtualMachineInstance.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_cluster.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_cluster.py deleted file mode 100644 index 957cd6e86b9e4..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_cluster.py +++ /dev/null @@ -1,48 +0,0 @@ -# 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.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python update_cluster.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 = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.clusters.update( - resource_group_name="test-rg", - cluster_name="myCluster", - cluster={ - "properties": { - "cloudManagementEndpoint": "https://98294836-31be-4668-aeae-698667faf99b.waconazure.com", - "desiredProperties": {"diagnosticLevel": "Required", "windowsServerSubscription": "Enabled"}, - }, - "tags": {"tag1": "value1", "tag2": "value2"}, - }, - ) - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/UpdateCluster.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_gallery_image.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_gallery_image.py index 4039891a5e76b..30eae143e96da 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_gallery_image.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_gallery_image.py @@ -29,14 +29,14 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.galleryimages.update( + response = client.gallery_images.begin_update( resource_group_name="test-rg", - galleryimages_name="test-gallery-image", - galleryimages={"tags": {"additionalProperties": "sample"}}, - ) + gallery_image_name="test-gallery-image", + gallery_images={"tags": {"additionalProperties": "sample"}}, + ).result() print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/UpdateGalleryImage.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/UpdateGalleryImage.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_extension.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_logical_network.py similarity index 83% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_extension.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_logical_network.py index beda1e1f1caac..9e79828dd2a86 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_extension.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_logical_network.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python delete_extension.py + python update_logical_network.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, @@ -29,15 +29,14 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.extensions.begin_delete( + response = client.logical_networks.begin_update( resource_group_name="test-rg", - cluster_name="myCluster", - arc_setting_name="default", - extension_name="MicrosoftMonitoringAgent", + logical_network_name="test-lnet", + logical_networks={"tags": {"additionalProperties": "sample"}}, ).result() print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/DeleteExtension.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/UpdateLogicalNetwork.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_machine_extension.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_machine_extension.py deleted file mode 100644 index c82bcc1d6f34a..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_machine_extension.py +++ /dev/null @@ -1,50 +0,0 @@ -# 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.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python update_machine_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 = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", - ) - - response = client.machine_extensions.begin_update( - resource_group_name="myResourceGroup", - 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/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/UpdateMachineExtension.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_marketplace_gallery_image.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_marketplace_gallery_image.py index 6268806c80250..3cf085bb65c8d 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_marketplace_gallery_image.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_marketplace_gallery_image.py @@ -29,14 +29,14 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.marketplacegalleryimages.update( + response = client.marketplace_gallery_images.begin_update( resource_group_name="test-rg", - marketplacegalleryimages_name="test-marketplce-gallery-image", - marketplacegalleryimages={"tags": {"additionalProperties": "sample"}}, - ) + marketplace_gallery_image_name="test-marketplce-gallery-image", + marketplace_gallery_images={"tags": {"additionalProperties": "sample"}}, + ).result() print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/UpdateMarketplaceGalleryImage.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/UpdateMarketplaceGalleryImage.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_network_interface.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_network_interface.py index 2a612da3da3c8..ec90a7d65c835 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_network_interface.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_network_interface.py @@ -29,14 +29,14 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.networkinterfaces.update( + response = client.network_interfaces.begin_update( resource_group_name="test-rg", - networkinterfaces_name="test-nic", - networkinterfaces={"tags": {"additionalProperties": "sample"}}, - ) + network_interface_name="test-nic", + network_interfaces={"tags": {"additionalProperties": "sample"}}, + ).result() print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/UpdateNetworkInterface.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/UpdateNetworkInterface.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_storage_container.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_storage_container.py index 4280b5eb143a6..ed96bee337841 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_storage_container.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_storage_container.py @@ -29,14 +29,14 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.storagecontainers.update( + response = client.storage_containers.begin_update( resource_group_name="test-rg", - storagecontainers_name="Default_Container", - storagecontainers={"tags": {"additionalProperties": "sample"}}, - ) + storage_container_name="Default_Container", + storage_containers={"tags": {"additionalProperties": "sample"}}, + ).result() print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/UpdateStorageContainer.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/UpdateStorageContainer.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_virtual_hard_disk.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_virtual_hard_disk.py index 204c8e16605d3..1083cd0e5a80a 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_virtual_hard_disk.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_virtual_hard_disk.py @@ -29,14 +29,14 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.virtualharddisks.update( + response = client.virtual_hard_disks.begin_update( resource_group_name="test-rg", - virtualharddisks_name="test-vhd", - virtualharddisks={"tags": {"additionalProperties": "sample"}}, - ) + virtual_hard_disk_name="test-vhd", + virtual_hard_disks={"tags": {"additionalProperties": "sample"}}, + ).result() print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/UpdateVirtualHardDisk.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/UpdateVirtualHardDisk.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_virtual_machine.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_virtual_machine.py deleted file mode 100644 index 96ddd6cefafea..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_virtual_machine.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python update_virtual_machine.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 = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.virtualmachines.update( - resource_group_name="test-rg", - virtualmachines_name="test-vm", - virtualmachines={"tags": {"additionalProperties": "sample"}}, - ) - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/UpdateVirtualMachine.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/patch_extension.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_virtual_machine_instance.py similarity index 65% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/patch_extension.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_virtual_machine_instance.py index 1bbffe3050d17..48a3572ce9c50 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/patch_extension.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_virtual_machine_instance.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python patch_extension.py + python update_virtual_machine_instance.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,21 +26,19 @@ def main(): client = AzureStackHCIClient( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.extensions.begin_update( - resource_group_name="test-rg", - cluster_name="myCluster", - arc_setting_name="default", - extension_name="MicrosoftMonitoringAgent", - extension={ + response = client.virtual_machine_instances.begin_update( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", + virtual_machine_instance={ "properties": { - "extensionParameters": { - "publisher": "Microsoft.Compute", - "settings": {"workspaceId": "xx"}, - "type": "MicrosoftMonitoringAgent", - "typeHandlerVersion": "1.10", + "storageProfile": { + "dataDisks": [ + { + "id": "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.AzureStackHCI/virtualHardDisks/test-vhd" + } + ] } } }, @@ -48,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/PatchExtension.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-09-01/examples/UpdateVirtualMachineInstance.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_virtual_network.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_virtual_network.py deleted file mode 100644 index d26b563f3cd91..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_virtual_network.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python update_virtual_network.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 = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.virtualnetworks.update( - resource_group_name="test-rg", - virtualnetworks_name="test-vnet", - virtualnetworks={"tags": {"additionalProperties": "sample"}}, - ) - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/UpdateVirtualNetwork.json -if __name__ == "__main__": - main()