diff --git a/sdk/compute/azure-mgmt-avs/README.md b/sdk/compute/azure-mgmt-avs/README.md index 3f89dfba118e..964cd257b281 100644 --- a/sdk/compute/azure-mgmt-avs/README.md +++ b/sdk/compute/azure-mgmt-avs/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Avs Management Client Library. -This package has been tested with Python 3.7+. +This package has been tested with Python 3.8+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.7+ is required to use this package. +- Python 3.8+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package @@ -59,6 +59,3 @@ Code samples for this package can be found at: If you encounter any bugs or have suggestions, please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) section of the project. - - -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-avs%2FREADME.png) diff --git a/sdk/compute/azure-mgmt-avs/_meta.json b/sdk/compute/azure-mgmt-avs/_meta.json index fe15a4e85850..3785536f9ec1 100644 --- a/sdk/compute/azure-mgmt-avs/_meta.json +++ b/sdk/compute/azure-mgmt-avs/_meta.json @@ -1,11 +1,11 @@ { - "commit": "a5e7ff51c8af3781e7f6dd3b82a3fc922e2f6f93", + "commit": "266c24fa09de08bc4cc9cc6ab542f177e46d08aa", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.7", + "autorest": "3.10.2", "use": [ - "@autorest/python@6.7.1", - "@autorest/modelerfour@4.26.2" + "@autorest/python@6.13.19", + "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/vmware/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/vmware/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.13.19 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/vmware/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_avs_client.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_avs_client.py index fcbdbea68916..ab5a24a5c1eb 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_avs_client.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_avs_client.py @@ -9,8 +9,10 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy from . import models as _models from ._configuration import AVSClientConfiguration @@ -23,6 +25,7 @@ DatastoresOperations, GlobalReachConnectionsOperations, HcxEnterpriseSitesOperations, + IscsiPathsOperations, LocationsOperations, Operations, PlacementPoliciesOperations, @@ -48,39 +51,41 @@ class AVSClient: # pylint: disable=client-accepts-api-version-keyword,too-many- :vartype locations: azure.mgmt.avs.operations.LocationsOperations :ivar private_clouds: PrivateCloudsOperations operations :vartype private_clouds: azure.mgmt.avs.operations.PrivateCloudsOperations - :ivar clusters: ClustersOperations operations - :vartype clusters: azure.mgmt.avs.operations.ClustersOperations - :ivar datastores: DatastoresOperations operations - :vartype datastores: azure.mgmt.avs.operations.DatastoresOperations - :ivar hcx_enterprise_sites: HcxEnterpriseSitesOperations operations - :vartype hcx_enterprise_sites: azure.mgmt.avs.operations.HcxEnterpriseSitesOperations + :ivar addons: AddonsOperations operations + :vartype addons: azure.mgmt.avs.operations.AddonsOperations :ivar authorizations: AuthorizationsOperations operations :vartype authorizations: azure.mgmt.avs.operations.AuthorizationsOperations - :ivar global_reach_connections: GlobalReachConnectionsOperations operations - :vartype global_reach_connections: azure.mgmt.avs.operations.GlobalReachConnectionsOperations - :ivar workload_networks: WorkloadNetworksOperations operations - :vartype workload_networks: azure.mgmt.avs.operations.WorkloadNetworksOperations :ivar cloud_links: CloudLinksOperations operations :vartype cloud_links: azure.mgmt.avs.operations.CloudLinksOperations - :ivar addons: AddonsOperations operations - :vartype addons: azure.mgmt.avs.operations.AddonsOperations - :ivar virtual_machines: VirtualMachinesOperations operations - :vartype virtual_machines: azure.mgmt.avs.operations.VirtualMachinesOperations + :ivar clusters: ClustersOperations operations + :vartype clusters: azure.mgmt.avs.operations.ClustersOperations + :ivar datastores: DatastoresOperations operations + :vartype datastores: azure.mgmt.avs.operations.DatastoresOperations :ivar placement_policies: PlacementPoliciesOperations operations :vartype placement_policies: azure.mgmt.avs.operations.PlacementPoliciesOperations + :ivar virtual_machines: VirtualMachinesOperations operations + :vartype virtual_machines: azure.mgmt.avs.operations.VirtualMachinesOperations + :ivar global_reach_connections: GlobalReachConnectionsOperations operations + :vartype global_reach_connections: azure.mgmt.avs.operations.GlobalReachConnectionsOperations + :ivar hcx_enterprise_sites: HcxEnterpriseSitesOperations operations + :vartype hcx_enterprise_sites: azure.mgmt.avs.operations.HcxEnterpriseSitesOperations + :ivar iscsi_paths: IscsiPathsOperations operations + :vartype iscsi_paths: azure.mgmt.avs.operations.IscsiPathsOperations + :ivar script_executions: ScriptExecutionsOperations operations + :vartype script_executions: azure.mgmt.avs.operations.ScriptExecutionsOperations :ivar script_packages: ScriptPackagesOperations operations :vartype script_packages: azure.mgmt.avs.operations.ScriptPackagesOperations :ivar script_cmdlets: ScriptCmdletsOperations operations :vartype script_cmdlets: azure.mgmt.avs.operations.ScriptCmdletsOperations - :ivar script_executions: ScriptExecutionsOperations operations - :vartype script_executions: azure.mgmt.avs.operations.ScriptExecutionsOperations + :ivar workload_networks: WorkloadNetworksOperations operations + :vartype workload_networks: azure.mgmt.avs.operations.WorkloadNetworksOperations :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. + :param subscription_id: The ID of the target subscription. The value must be an UUID. 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 "2023-03-01". Note that overriding this + :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 @@ -95,7 +100,25 @@ def __init__( **kwargs: Any ) -> None: self._config = AVSClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -104,33 +127,34 @@ def __init__( self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_clouds = PrivateCloudsOperations(self._client, self._config, self._serialize, self._deserialize) + self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize) + self.authorizations = AuthorizationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.cloud_links = CloudLinksOperations(self._client, self._config, self._serialize, self._deserialize) self.clusters = ClustersOperations(self._client, self._config, self._serialize, self._deserialize) self.datastores = DatastoresOperations(self._client, self._config, self._serialize, self._deserialize) - self.hcx_enterprise_sites = HcxEnterpriseSitesOperations( + self.placement_policies = PlacementPoliciesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.authorizations = AuthorizationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.global_reach_connections = GlobalReachConnectionsOperations( + self.virtual_machines = VirtualMachinesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.workload_networks = WorkloadNetworksOperations( + self.global_reach_connections = GlobalReachConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.cloud_links = CloudLinksOperations(self._client, self._config, self._serialize, self._deserialize) - self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize) - self.virtual_machines = VirtualMachinesOperations( + self.hcx_enterprise_sites = HcxEnterpriseSitesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.placement_policies = PlacementPoliciesOperations( + self.iscsi_paths = IscsiPathsOperations(self._client, self._config, self._serialize, self._deserialize) + self.script_executions = ScriptExecutionsOperations( self._client, self._config, self._serialize, self._deserialize ) self.script_packages = ScriptPackagesOperations(self._client, self._config, self._serialize, self._deserialize) self.script_cmdlets = ScriptCmdletsOperations(self._client, self._config, self._serialize, self._deserialize) - self.script_executions = ScriptExecutionsOperations( + self.workload_networks = WorkloadNetworksOperations( self._client, self._config, self._serialize, self._deserialize ) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -150,7 +174,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore def close(self) -> None: self._client.close() diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_configuration.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_configuration.py index f952ef584913..532223d9225b 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_configuration.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_configuration.py @@ -8,7 +8,6 @@ from typing import Any, TYPE_CHECKING -from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy @@ -19,7 +18,7 @@ from azure.core.credentials import TokenCredential -class AVSClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class AVSClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for AVSClient. Note that all parameters used to create this instance are saved as instance @@ -27,16 +26,15 @@ class AVSClientConfiguration(Configuration): # pylint: disable=too-many-instanc :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. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-03-01". Note that overriding this + :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(AVSClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-03-01") + api_version: str = kwargs.pop("api_version", "2023-09-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -48,6 +46,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-avs/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -56,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None: self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = ARMChallengeAuthenticationPolicy( diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_serialization.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_serialization.py index 4bae2292227b..f0c6180722c8 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_serialization.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_serialization.py @@ -63,8 +63,8 @@ import isodate # type: ignore -from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback -from azure.core.serialization import NULL as AzureCoreNull +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") @@ -124,7 +124,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: pass return ET.fromstring(data_as_str) # nosec - except ET.ParseError: + except ET.ParseError as err: # It might be because the server has an issue, and returned JSON with # content-type XML.... # So let's try a JSON load, and if it's still broken @@ -143,7 +143,7 @@ def _json_attemp(data): # The function hack is because Py2.7 messes up with exception # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") - raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("XML is invalid") from err raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -170,13 +170,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], return None -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str - unicode_str = str - _LOGGER = logging.getLogger(__name__) try: @@ -295,7 +288,7 @@ class Model(object): _validation: Dict[str, Dict[str, Any]] = {} def __init__(self, **kwargs: Any) -> None: - self.additional_properties: Dict[str, Any] = {} + self.additional_properties: Optional[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__) @@ -340,7 +333,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: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to azure from this model. + """Return the JSON that would be sent to server from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -351,7 +344,7 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore def as_dict( self, @@ -390,7 +383,7 @@ def my_key_transformer(key, attr_desc, value): :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore @classmethod def _infer_class_models(cls): @@ -415,7 +408,7 @@ def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = N :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( @@ -445,7 +438,7 @@ def from_dict( if key_extractors is None else key_extractors ) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def _flatten_subtype(cls, key, objects): @@ -545,7 +538,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -561,7 +554,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -649,7 +642,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = unicode_str(new_attr) + local_node.text = str(new_attr) serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore @@ -668,7 +661,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err else: return serialized @@ -710,7 +703,7 @@ def body(self, data, data_type, **kwargs): ] data = deserializer._deserialize(data_type, data) except DeserializationError as err: - raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + raise SerializationError("Unable to build a model: " + str(err)) from err return self._serialize(data, data_type, **kwargs) @@ -730,6 +723,7 @@ def url(self, name, data, data_type, **kwargs): if kwargs.get("skip_quote") is True: output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") except SerializationError: @@ -744,7 +738,7 @@ def query(self, name, data, data_type, **kwargs): :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 + :rtype: str, list :raises: TypeError if serialization fails. :raises: ValueError if data is None """ @@ -753,7 +747,7 @@ def query(self, name, data, data_type, **kwargs): if data_type.startswith("["): internal_data_type = data_type[1:-1] do_quote = not kwargs.get("skip_quote", False) - return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)) + return 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) @@ -804,7 +798,7 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: - if data is AzureCoreNull: + if data is CoreNull: return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -824,7 +818,7 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." - raise_with_traceback(SerializationError, msg.format(data, data_type), err) + raise SerializationError(msg.format(data, data_type)) from err else: return self._serialize(data, **kwargs) @@ -993,7 +987,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) if obj_type is _long_type: return self.serialize_long(attr) - if obj_type is unicode_str: + if obj_type is str: return self.serialize_unicode(attr) if obj_type is datetime.datetime: return self.serialize_iso(attr) @@ -1170,10 +1164,10 @@ def serialize_iso(attr, **kwargs): return date + microseconds + "Z" except (ValueError, OverflowError) as err: msg = "Unable to serialize datetime object." - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err except AttributeError as err: msg = "ISO-8601 object must be valid Datetime object." - raise_with_traceback(TypeError, msg, err) + raise TypeError(msg) from err @staticmethod def serialize_unix(attr, **kwargs): @@ -1209,7 +1203,6 @@ def rest_key_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1230,7 +1223,6 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1371,7 +1363,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: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1391,7 +1383,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = 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 @@ -1444,12 +1436,12 @@ def _deserialize(self, target_obj, data): response, class_name = self._classify_target(target_obj, data) - if isinstance(response, basestring): + if isinstance(response, str): return self.deserialize_data(data, response) elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) - if data is None: + if data is None or data is CoreNull: return data try: attributes = response._attribute_map # type: ignore @@ -1481,7 +1473,7 @@ def _deserialize(self, target_obj, data): d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: additional_properties = self._build_additional_properties(attributes, data) return self._instantiate_model(response, d_attrs, additional_properties) @@ -1515,14 +1507,14 @@ def _classify_target(self, target, data): if target is None: return None, None - if isinstance(target, basestring): + if isinstance(target, str): try: target = self.dependencies[target] except KeyError: return target, target try: - target = target._classify(data, self.dependencies) + target = target._classify(data, self.dependencies) # type: ignore except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1578,7 +1570,7 @@ def _unpack_content(raw_data, content_type=None): if hasattr(raw_data, "_content_consumed"): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data @@ -1652,7 +1644,7 @@ def deserialize_data(self, data, data_type): except (ValueError, TypeError, AttributeError) as err: msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return self._deserialize(obj_type, data) @@ -1700,7 +1692,7 @@ def deserialize_object(self, attr, **kwargs): if isinstance(attr, ET.Element): # Do no recurse on XML, just return the tree as-is return attr - if isinstance(attr, basestring): + if isinstance(attr, str): return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: @@ -1757,7 +1749,7 @@ def deserialize_basic(self, attr, data_type): if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, basestring): + elif isinstance(attr, str): if attr.lower() in ["true", "1"]: return True elif attr.lower() in ["false", "0"]: @@ -1808,7 +1800,6 @@ def deserialize_enum(data, enum_obj): data = data.value if isinstance(data, int): # Workaround. We might consider remove it in the future. - # https://github.com/Azure/azure-rest-api-specs/issues/141 try: return list(enum_obj.__members__.values())[data] except IndexError: @@ -1862,10 +1853,10 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) # type: ignore + return decimal.Decimal(str(attr)) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err @staticmethod def deserialize_long(attr): @@ -1893,7 +1884,7 @@ def deserialize_duration(attr): duration = isodate.parse_duration(attr) except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return duration @@ -1910,7 +1901,7 @@ def deserialize_date(attr): if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=None, defaultday=None) + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) @staticmethod def deserialize_time(attr): @@ -1945,7 +1936,7 @@ def deserialize_rfc(attr): date_obj = date_obj.astimezone(tz=TZ_UTC) except ValueError as err: msg = "Cannot deserialize to rfc datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1982,7 +1973,7 @@ def deserialize_iso(attr): raise OverflowError("Hit max or min date") except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1998,9 +1989,10 @@ def deserialize_unix(attr): if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore try: + attr = int(attr) date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: msg = "Cannot deserialize to unix datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_version.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_version.py index 142a0420b39b..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_version.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/_avs_client.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/_avs_client.py index a1a6593adde5..f51738b14036 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/_avs_client.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/_avs_client.py @@ -9,8 +9,10 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy from .. import models as _models from .._serialization import Deserializer, Serializer @@ -23,6 +25,7 @@ DatastoresOperations, GlobalReachConnectionsOperations, HcxEnterpriseSitesOperations, + IscsiPathsOperations, LocationsOperations, Operations, PlacementPoliciesOperations, @@ -48,40 +51,42 @@ class AVSClient: # pylint: disable=client-accepts-api-version-keyword,too-many- :vartype locations: azure.mgmt.avs.aio.operations.LocationsOperations :ivar private_clouds: PrivateCloudsOperations operations :vartype private_clouds: azure.mgmt.avs.aio.operations.PrivateCloudsOperations + :ivar addons: AddonsOperations operations + :vartype addons: azure.mgmt.avs.aio.operations.AddonsOperations + :ivar authorizations: AuthorizationsOperations operations + :vartype authorizations: azure.mgmt.avs.aio.operations.AuthorizationsOperations + :ivar cloud_links: CloudLinksOperations operations + :vartype cloud_links: azure.mgmt.avs.aio.operations.CloudLinksOperations :ivar clusters: ClustersOperations operations :vartype clusters: azure.mgmt.avs.aio.operations.ClustersOperations :ivar datastores: DatastoresOperations operations :vartype datastores: azure.mgmt.avs.aio.operations.DatastoresOperations - :ivar hcx_enterprise_sites: HcxEnterpriseSitesOperations operations - :vartype hcx_enterprise_sites: azure.mgmt.avs.aio.operations.HcxEnterpriseSitesOperations - :ivar authorizations: AuthorizationsOperations operations - :vartype authorizations: azure.mgmt.avs.aio.operations.AuthorizationsOperations + :ivar placement_policies: PlacementPoliciesOperations operations + :vartype placement_policies: azure.mgmt.avs.aio.operations.PlacementPoliciesOperations + :ivar virtual_machines: VirtualMachinesOperations operations + :vartype virtual_machines: azure.mgmt.avs.aio.operations.VirtualMachinesOperations :ivar global_reach_connections: GlobalReachConnectionsOperations operations :vartype global_reach_connections: azure.mgmt.avs.aio.operations.GlobalReachConnectionsOperations - :ivar workload_networks: WorkloadNetworksOperations operations - :vartype workload_networks: azure.mgmt.avs.aio.operations.WorkloadNetworksOperations - :ivar cloud_links: CloudLinksOperations operations - :vartype cloud_links: azure.mgmt.avs.aio.operations.CloudLinksOperations - :ivar addons: AddonsOperations operations - :vartype addons: azure.mgmt.avs.aio.operations.AddonsOperations - :ivar virtual_machines: VirtualMachinesOperations operations - :vartype virtual_machines: azure.mgmt.avs.aio.operations.VirtualMachinesOperations - :ivar placement_policies: PlacementPoliciesOperations operations - :vartype placement_policies: azure.mgmt.avs.aio.operations.PlacementPoliciesOperations + :ivar hcx_enterprise_sites: HcxEnterpriseSitesOperations operations + :vartype hcx_enterprise_sites: azure.mgmt.avs.aio.operations.HcxEnterpriseSitesOperations + :ivar iscsi_paths: IscsiPathsOperations operations + :vartype iscsi_paths: azure.mgmt.avs.aio.operations.IscsiPathsOperations + :ivar script_executions: ScriptExecutionsOperations operations + :vartype script_executions: azure.mgmt.avs.aio.operations.ScriptExecutionsOperations :ivar script_packages: ScriptPackagesOperations operations :vartype script_packages: azure.mgmt.avs.aio.operations.ScriptPackagesOperations :ivar script_cmdlets: ScriptCmdletsOperations operations :vartype script_cmdlets: azure.mgmt.avs.aio.operations.ScriptCmdletsOperations - :ivar script_executions: ScriptExecutionsOperations operations - :vartype script_executions: azure.mgmt.avs.aio.operations.ScriptExecutionsOperations + :ivar workload_networks: WorkloadNetworksOperations operations + :vartype workload_networks: azure.mgmt.avs.aio.operations.WorkloadNetworksOperations :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. + :param subscription_id: The ID of the target subscription. The value must be an UUID. 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 "2023-03-01". Note that overriding this + :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 @@ -96,7 +101,25 @@ def __init__( **kwargs: Any ) -> None: self._config = AVSClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -105,33 +128,36 @@ def __init__( self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_clouds = PrivateCloudsOperations(self._client, self._config, self._serialize, self._deserialize) + self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize) + self.authorizations = AuthorizationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.cloud_links = CloudLinksOperations(self._client, self._config, self._serialize, self._deserialize) self.clusters = ClustersOperations(self._client, self._config, self._serialize, self._deserialize) self.datastores = DatastoresOperations(self._client, self._config, self._serialize, self._deserialize) - self.hcx_enterprise_sites = HcxEnterpriseSitesOperations( + self.placement_policies = PlacementPoliciesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.authorizations = AuthorizationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.global_reach_connections = GlobalReachConnectionsOperations( + self.virtual_machines = VirtualMachinesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.workload_networks = WorkloadNetworksOperations( + self.global_reach_connections = GlobalReachConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.cloud_links = CloudLinksOperations(self._client, self._config, self._serialize, self._deserialize) - self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize) - self.virtual_machines = VirtualMachinesOperations( + self.hcx_enterprise_sites = HcxEnterpriseSitesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.placement_policies = PlacementPoliciesOperations( + self.iscsi_paths = IscsiPathsOperations(self._client, self._config, self._serialize, self._deserialize) + self.script_executions = ScriptExecutionsOperations( self._client, self._config, self._serialize, self._deserialize ) self.script_packages = ScriptPackagesOperations(self._client, self._config, self._serialize, self._deserialize) self.script_cmdlets = ScriptCmdletsOperations(self._client, self._config, self._serialize, self._deserialize) - self.script_executions = ScriptExecutionsOperations( + self.workload_networks = WorkloadNetworksOperations( self._client, self._config, self._serialize, self._deserialize ) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -151,7 +177,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: await self._client.close() diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/_configuration.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/_configuration.py index 465a98be5c5c..6bf1c2ec3ebe 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/_configuration.py @@ -8,7 +8,6 @@ from typing import Any, TYPE_CHECKING -from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy @@ -19,7 +18,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class AVSClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class AVSClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for AVSClient. Note that all parameters used to create this instance are saved as instance @@ -27,16 +26,15 @@ class AVSClientConfiguration(Configuration): # pylint: disable=too-many-instanc :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. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-03-01". Note that overriding this + :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(AVSClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-03-01") + api_version: str = kwargs.pop("api_version", "2023-09-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -48,6 +46,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-avs/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -56,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None: self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/__init__.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/__init__.py index 7aa1e85f55b7..e6a84c5d03a3 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/__init__.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/__init__.py @@ -9,19 +9,20 @@ from ._operations import Operations from ._locations_operations import LocationsOperations from ._private_clouds_operations import PrivateCloudsOperations -from ._clusters_operations import ClustersOperations -from ._datastores_operations import DatastoresOperations -from ._hcx_enterprise_sites_operations import HcxEnterpriseSitesOperations +from ._addons_operations import AddonsOperations from ._authorizations_operations import AuthorizationsOperations -from ._global_reach_connections_operations import GlobalReachConnectionsOperations -from ._workload_networks_operations import WorkloadNetworksOperations from ._cloud_links_operations import CloudLinksOperations -from ._addons_operations import AddonsOperations -from ._virtual_machines_operations import VirtualMachinesOperations +from ._clusters_operations import ClustersOperations +from ._datastores_operations import DatastoresOperations from ._placement_policies_operations import PlacementPoliciesOperations +from ._virtual_machines_operations import VirtualMachinesOperations +from ._global_reach_connections_operations import GlobalReachConnectionsOperations +from ._hcx_enterprise_sites_operations import HcxEnterpriseSitesOperations +from ._iscsi_paths_operations import IscsiPathsOperations +from ._script_executions_operations import ScriptExecutionsOperations from ._script_packages_operations import ScriptPackagesOperations from ._script_cmdlets_operations import ScriptCmdletsOperations -from ._script_executions_operations import ScriptExecutionsOperations +from ._workload_networks_operations import WorkloadNetworksOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -31,19 +32,20 @@ "Operations", "LocationsOperations", "PrivateCloudsOperations", - "ClustersOperations", - "DatastoresOperations", - "HcxEnterpriseSitesOperations", + "AddonsOperations", "AuthorizationsOperations", - "GlobalReachConnectionsOperations", - "WorkloadNetworksOperations", "CloudLinksOperations", - "AddonsOperations", - "VirtualMachinesOperations", + "ClustersOperations", + "DatastoresOperations", "PlacementPoliciesOperations", + "VirtualMachinesOperations", + "GlobalReachConnectionsOperations", + "HcxEnterpriseSitesOperations", + "IscsiPathsOperations", + "ScriptExecutionsOperations", "ScriptPackagesOperations", "ScriptCmdletsOperations", - "ScriptExecutionsOperations", + "WorkloadNetworksOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_addons_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_addons_operations.py index 556c4a345a31..ccee7c4e1f31 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_addons_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_addons_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -38,6 +39,10 @@ build_list_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,16 +68,13 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace def list(self, resource_group_name: str, private_cloud_name: str, **kwargs: Any) -> AsyncIterable["_models.Addon"]: - """List addons in a private cloud. - - List addons in a private cloud. + """List Addon resources by PrivateCloud. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Addon or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.Addon] :raises ~azure.core.exceptions.HttpResponseError: @@ -83,7 +85,7 @@ def list(self, resource_group_name: str, private_cloud_name: str, **kwargs: Any) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AddonList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -94,17 +96,16 @@ def list(self, resource_group_name: str, private_cloud_name: str, **kwargs: Any) def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -116,13 +117,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("AddonList", pipeline_response) @@ -132,11 +133,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -149,31 +150,24 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons" - } - @distributed_trace_async async def get( self, resource_group_name: str, private_cloud_name: str, addon_name: str, **kwargs: Any ) -> _models.Addon: - """Get an addon by name in a private cloud. - - Get an addon by name in a private cloud. + """Get a Addon. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param addon_name: Name of the addon for the private cloud. Required. + :param addon_name: Name of the addon. Required. :type addon_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Addon or the result of cls(response) :rtype: ~azure.mgmt.avs.models.Addon :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -187,22 +181,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Addon] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, addon_name=addon_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -215,23 +208,19 @@ async def get( deserialized = self._deserialize("Addon", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, private_cloud_name: str, addon_name: str, - addon: Union[_models.Addon, IO], + addon: Union[_models.Addon, IO[bytes]], **kwargs: Any ) -> _models.Addon: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -254,7 +243,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(addon, "Addon") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, addon_name=addon_name, @@ -263,16 +252,15 @@ async def _create_or_update_initial( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -282,21 +270,20 @@ async def _create_or_update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("Addon", pipeline_response) if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = self._deserialize("Addon", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}" - } - @overload async def begin_create_or_update( self, @@ -308,30 +295,20 @@ async def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.Addon]: - """Create or update a addon in a private cloud. - - Create or update a addon in a private cloud. + """Create a Addon. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param addon_name: Name of the addon for the private cloud. Required. + :param addon_name: Name of the addon. Required. :type addon_name: str - :param addon: A addon in the private cloud. Required. + :param addon: Resource create parameters. Required. :type addon: ~azure.mgmt.avs.models.Addon :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 Addon or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Addon] :raises ~azure.core.exceptions.HttpResponseError: @@ -343,35 +320,25 @@ async def begin_create_or_update( resource_group_name: str, private_cloud_name: str, addon_name: str, - addon: IO, + addon: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.Addon]: - """Create or update a addon in a private cloud. - - Create or update a addon in a private cloud. + """Create a Addon. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param addon_name: Name of the addon for the private cloud. Required. + :param addon_name: Name of the addon. Required. :type addon_name: str - :param addon: A addon in the private cloud. Required. - :type addon: IO + :param addon: Resource create parameters. Required. + :type addon: IO[bytes] :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 Addon or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Addon] :raises ~azure.core.exceptions.HttpResponseError: @@ -383,33 +350,20 @@ async def begin_create_or_update( resource_group_name: str, private_cloud_name: str, addon_name: str, - addon: Union[_models.Addon, IO], + addon: Union[_models.Addon, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Addon]: - """Create or update a addon in a private cloud. - - Create or update a addon in a private cloud. + """Create a Addon. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param addon_name: Name of the addon for the private cloud. Required. + :param addon_name: Name of the addon. Required. :type addon_name: str - :param addon: A addon in the private cloud. Is either a Addon type or a IO type. Required. - :type addon: ~azure.mgmt.avs.models.Addon 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. + :param addon: Resource create parameters. Is either a Addon type or a IO[bytes] type. Required. + :type addon: ~azure.mgmt.avs.models.Addon or IO[bytes] :return: An instance of AsyncLROPoller that returns either Addon or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Addon] :raises ~azure.core.exceptions.HttpResponseError: @@ -441,32 +395,33 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Addon", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.Addon].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.AVS/privateClouds/{privateCloudName}/addons/{addonName}" - } + return AsyncLROPoller[_models.Addon]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, private_cloud_name: str, addon_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -480,22 +435,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, addon_name=addon_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -505,36 +459,27 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, None, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async async def begin_delete( self, resource_group_name: str, private_cloud_name: str, addon_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Delete a addon in a private cloud. - - Delete a addon in a private cloud. + """Delete a Addon. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param addon_name: Name of the addon for the private cloud. Required. + :param addon_name: Name of the addon. Required. :type addon_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: @@ -562,23 +507,21 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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.AVS/privateClouds/{privateCloudName}/addons/{addonName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_authorizations_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_authorizations_operations.py index 6c49f83e664f..a1f51a0b4c8f 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_authorizations_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_authorizations_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -38,6 +39,10 @@ build_list_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,16 +70,13 @@ def __init__(self, *args, **kwargs) -> None: def list( self, resource_group_name: str, private_cloud_name: str, **kwargs: Any ) -> AsyncIterable["_models.ExpressRouteAuthorization"]: - """List ExpressRoute Circuit Authorizations in a private cloud. - - List ExpressRoute Circuit Authorizations in a private cloud. + """List ExpressRouteAuthorization resources by PrivateCloud. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExpressRouteAuthorization or the result of cls(response) :rtype: @@ -87,7 +89,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ExpressRouteAuthorizationList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,17 +100,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -120,13 +121,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("ExpressRouteAuthorizationList", pipeline_response) @@ -136,11 +137,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -153,32 +154,24 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations" - } - @distributed_trace_async async def get( self, resource_group_name: str, private_cloud_name: str, authorization_name: str, **kwargs: Any ) -> _models.ExpressRouteAuthorization: - """Get an ExpressRoute Circuit Authorization by name in a private cloud. - - Get an ExpressRoute Circuit Authorization by name in a private cloud. + """Get a ExpressRouteAuthorization. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param authorization_name: Name of the ExpressRoute Circuit Authorization in the private cloud. - Required. + :param authorization_name: Name of the ExpressRoute Circuit Authorization. Required. :type authorization_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ExpressRouteAuthorization or the result of cls(response) :rtype: ~azure.mgmt.avs.models.ExpressRouteAuthorization :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -192,22 +185,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ExpressRouteAuthorization] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, authorization_name=authorization_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -220,23 +212,19 @@ async def get( deserialized = self._deserialize("ExpressRouteAuthorization", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, private_cloud_name: str, authorization_name: str, - authorization: Union[_models.ExpressRouteAuthorization, IO], + authorization: Union[_models.ExpressRouteAuthorization, IO[bytes]], **kwargs: Any ) -> _models.ExpressRouteAuthorization: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -259,7 +247,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(authorization, "ExpressRouteAuthorization") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, authorization_name=authorization_name, @@ -268,16 +256,15 @@ async def _create_or_update_initial( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -287,21 +274,20 @@ async def _create_or_update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ExpressRouteAuthorization", pipeline_response) if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = self._deserialize("ExpressRouteAuthorization", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}" - } - @overload async def begin_create_or_update( self, @@ -313,31 +299,20 @@ async def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ExpressRouteAuthorization]: - """Create or update an ExpressRoute Circuit Authorization in a private cloud. - - Create or update an ExpressRoute Circuit Authorization in a private cloud. + """Create a ExpressRouteAuthorization. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param authorization_name: Name of the ExpressRoute Circuit Authorization in the private cloud. - Required. + :param authorization_name: Name of the ExpressRoute Circuit Authorization. Required. :type authorization_name: str - :param authorization: An ExpressRoute Circuit Authorization. Required. + :param authorization: Resource create parameters. Required. :type authorization: ~azure.mgmt.avs.models.ExpressRouteAuthorization :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 ExpressRouteAuthorization or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.ExpressRouteAuthorization] @@ -350,36 +325,25 @@ async def begin_create_or_update( resource_group_name: str, private_cloud_name: str, authorization_name: str, - authorization: IO, + authorization: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ExpressRouteAuthorization]: - """Create or update an ExpressRoute Circuit Authorization in a private cloud. - - Create or update an ExpressRoute Circuit Authorization in a private cloud. + """Create a ExpressRouteAuthorization. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param authorization_name: Name of the ExpressRoute Circuit Authorization in the private cloud. - Required. + :param authorization_name: Name of the ExpressRoute Circuit Authorization. Required. :type authorization_name: str - :param authorization: An ExpressRoute Circuit Authorization. Required. - :type authorization: IO + :param authorization: Resource create parameters. Required. + :type authorization: IO[bytes] :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 ExpressRouteAuthorization or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.ExpressRouteAuthorization] @@ -392,35 +356,21 @@ async def begin_create_or_update( resource_group_name: str, private_cloud_name: str, authorization_name: str, - authorization: Union[_models.ExpressRouteAuthorization, IO], + authorization: Union[_models.ExpressRouteAuthorization, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.ExpressRouteAuthorization]: - """Create or update an ExpressRoute Circuit Authorization in a private cloud. - - Create or update an ExpressRoute Circuit Authorization in a private cloud. + """Create a ExpressRouteAuthorization. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param authorization_name: Name of the ExpressRoute Circuit Authorization in the private cloud. - Required. + :param authorization_name: Name of the ExpressRoute Circuit Authorization. Required. :type authorization_name: str - :param authorization: An ExpressRoute Circuit Authorization. Is either a - ExpressRouteAuthorization type or a IO type. Required. - :type authorization: ~azure.mgmt.avs.models.ExpressRouteAuthorization 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. + :param authorization: Resource create parameters. Is either a ExpressRouteAuthorization type or + a IO[bytes] type. Required. + :type authorization: ~azure.mgmt.avs.models.ExpressRouteAuthorization or IO[bytes] :return: An instance of AsyncLROPoller that returns either ExpressRouteAuthorization or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.ExpressRouteAuthorization] @@ -453,32 +403,33 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ExpressRouteAuthorization", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ExpressRouteAuthorization].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.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}" - } + return AsyncLROPoller[_models.ExpressRouteAuthorization]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, private_cloud_name: str, authorization_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -492,22 +443,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, authorization_name=authorization_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -517,37 +467,27 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, None, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async async def begin_delete( self, resource_group_name: str, private_cloud_name: str, authorization_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Delete an ExpressRoute Circuit Authorization in a private cloud. - - Delete an ExpressRoute Circuit Authorization in a private cloud. + """Delete a ExpressRouteAuthorization. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param authorization_name: Name of the ExpressRoute Circuit Authorization in the private cloud. - Required. + :param authorization_name: Name of the ExpressRoute Circuit Authorization. Required. :type authorization_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: @@ -575,23 +515,21 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_cloud_links_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_cloud_links_operations.py index ae37f5323999..119588895cf6 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_cloud_links_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_cloud_links_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -38,6 +39,10 @@ build_list_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,16 +70,13 @@ def __init__(self, *args, **kwargs) -> None: def list( self, resource_group_name: str, private_cloud_name: str, **kwargs: Any ) -> AsyncIterable["_models.CloudLink"]: - """List cloud link in a private cloud. - - List cloud link in a private cloud. + """List CloudLink resources by PrivateCloud. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either CloudLink or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.CloudLink] :raises ~azure.core.exceptions.HttpResponseError: @@ -85,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CloudLinkList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -96,17 +98,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -118,13 +119,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("CloudLinkList", pipeline_response) @@ -134,11 +135,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,31 +152,24 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks" - } - @distributed_trace_async async def get( self, resource_group_name: str, private_cloud_name: str, cloud_link_name: str, **kwargs: Any ) -> _models.CloudLink: - """Get an cloud link by name in a private cloud. - - Get an cloud link by name in a private cloud. + """Get a CloudLink. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cloud_link_name: Name of the cloud link resource. Required. + :param cloud_link_name: Name of the cloud link. Required. :type cloud_link_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CloudLink or the result of cls(response) :rtype: ~azure.mgmt.avs.models.CloudLink :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -189,22 +183,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CloudLink] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cloud_link_name=cloud_link_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -217,23 +210,19 @@ async def get( deserialized = self._deserialize("CloudLink", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, private_cloud_name: str, cloud_link_name: str, - cloud_link: Union[_models.CloudLink, IO], + cloud_link: Union[_models.CloudLink, IO[bytes]], **kwargs: Any ) -> _models.CloudLink: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -256,7 +245,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(cloud_link, "CloudLink") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cloud_link_name=cloud_link_name, @@ -265,16 +254,15 @@ async def _create_or_update_initial( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -284,21 +272,20 @@ async def _create_or_update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("CloudLink", pipeline_response) if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = self._deserialize("CloudLink", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}" - } - @overload async def begin_create_or_update( self, @@ -310,30 +297,20 @@ async def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.CloudLink]: - """Create or update a cloud link in a private cloud. - - Create or update a cloud link in a private cloud. + """Create a CloudLink. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cloud_link_name: Name of the cloud link resource. Required. + :param cloud_link_name: Name of the cloud link. Required. :type cloud_link_name: str - :param cloud_link: A cloud link in the private cloud. Required. + :param cloud_link: Resource create parameters. Required. :type cloud_link: ~azure.mgmt.avs.models.CloudLink :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 CloudLink or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.CloudLink] @@ -346,35 +323,25 @@ async def begin_create_or_update( resource_group_name: str, private_cloud_name: str, cloud_link_name: str, - cloud_link: IO, + cloud_link: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.CloudLink]: - """Create or update a cloud link in a private cloud. - - Create or update a cloud link in a private cloud. + """Create a CloudLink. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cloud_link_name: Name of the cloud link resource. Required. + :param cloud_link_name: Name of the cloud link. Required. :type cloud_link_name: str - :param cloud_link: A cloud link in the private cloud. Required. - :type cloud_link: IO + :param cloud_link: Resource create parameters. Required. + :type cloud_link: IO[bytes] :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 CloudLink or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.CloudLink] @@ -387,34 +354,21 @@ async def begin_create_or_update( resource_group_name: str, private_cloud_name: str, cloud_link_name: str, - cloud_link: Union[_models.CloudLink, IO], + cloud_link: Union[_models.CloudLink, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.CloudLink]: - """Create or update a cloud link in a private cloud. - - Create or update a cloud link in a private cloud. + """Create a CloudLink. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cloud_link_name: Name of the cloud link resource. Required. + :param cloud_link_name: Name of the cloud link. Required. :type cloud_link_name: str - :param cloud_link: A cloud link in the private cloud. Is either a CloudLink type or a IO type. + :param cloud_link: Resource create parameters. Is either a CloudLink type or a IO[bytes] type. Required. - :type cloud_link: ~azure.mgmt.avs.models.CloudLink 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. + :type cloud_link: ~azure.mgmt.avs.models.CloudLink or IO[bytes] :return: An instance of AsyncLROPoller that returns either CloudLink or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.CloudLink] @@ -447,32 +401,33 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("CloudLink", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.CloudLink].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.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}" - } + return AsyncLROPoller[_models.CloudLink]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, private_cloud_name: str, cloud_link_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -486,22 +441,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cloud_link_name=cloud_link_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -511,36 +465,27 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, None, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async async def begin_delete( self, resource_group_name: str, private_cloud_name: str, cloud_link_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Delete a cloud link in a private cloud. - - Delete a cloud link in a private cloud. + """Delete a CloudLink. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cloud_link_name: Name of the cloud link resource. Required. + :param cloud_link_name: Name of the cloud link. Required. :type cloud_link_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: @@ -568,23 +513,21 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_clusters_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_clusters_operations.py index 28cdd40a4fac..e81074f025ab 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_clusters_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_clusters_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -40,6 +41,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -67,16 +72,13 @@ def __init__(self, *args, **kwargs) -> None: def list( self, resource_group_name: str, private_cloud_name: str, **kwargs: Any ) -> AsyncIterable["_models.Cluster"]: - """List clusters in a private cloud. - - List clusters in a private cloud. + """List Cluster resources by PrivateCloud. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_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.avs.models.Cluster] :raises ~azure.core.exceptions.HttpResponseError: @@ -87,7 +89,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClusterList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,17 +100,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -120,13 +121,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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) @@ -136,11 +137,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -153,31 +154,24 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters" - } - @distributed_trace_async async def get( self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any ) -> _models.Cluster: - """Get a cluster by name in a private cloud. - - Get a cluster by name in a private cloud. + """Get a Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: 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.avs.models.Cluster :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -191,22 +185,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Cluster] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -219,23 +212,19 @@ async def get( deserialized = self._deserialize("Cluster", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, private_cloud_name: str, cluster_name: str, - cluster: Union[_models.Cluster, IO], + cluster: Union[_models.Cluster, IO[bytes]], **kwargs: Any ) -> _models.Cluster: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -258,7 +247,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(cluster, "Cluster") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cluster_name=cluster_name, @@ -267,16 +256,15 @@ async def _create_or_update_initial( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -286,21 +274,20 @@ async def _create_or_update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("Cluster", pipeline_response) if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = self._deserialize("Cluster", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}" - } - @overload async def begin_create_or_update( self, @@ -312,30 +299,20 @@ async def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.Cluster]: - """Create or update a cluster in a private cloud. - - Create or update a cluster in a private cloud. + """Create a Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param cluster: A cluster in the private cloud. Required. + :param cluster: Resource create parameters. Required. :type cluster: ~azure.mgmt.avs.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 - :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 Cluster or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Cluster] @@ -348,35 +325,25 @@ async def begin_create_or_update( resource_group_name: str, private_cloud_name: str, cluster_name: str, - cluster: IO, + cluster: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.Cluster]: - """Create or update a cluster in a private cloud. - - Create or update a cluster in a private cloud. + """Create a Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param cluster: A cluster in the private cloud. Required. - :type cluster: IO + :param cluster: Resource create parameters. Required. + :type cluster: IO[bytes] :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 Cluster or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Cluster] @@ -389,34 +356,21 @@ async def begin_create_or_update( resource_group_name: str, private_cloud_name: str, cluster_name: str, - cluster: Union[_models.Cluster, IO], + cluster: Union[_models.Cluster, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Cluster]: - """Create or update a cluster in a private cloud. - - Create or update a cluster in a private cloud. + """Create a Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param cluster: A cluster in the private cloud. Is either a Cluster type or a IO type. + :param cluster: Resource create parameters. Is either a Cluster type or a IO[bytes] type. Required. - :type cluster: ~azure.mgmt.avs.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 - :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. + :type cluster: ~azure.mgmt.avs.models.Cluster or IO[bytes] :return: An instance of AsyncLROPoller that returns either Cluster or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Cluster] @@ -449,37 +403,38 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Cluster", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.Cluster].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.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}" - } + return AsyncLROPoller[_models.Cluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _update_initial( self, resource_group_name: str, private_cloud_name: str, cluster_name: str, - cluster_update: Union[_models.ClusterUpdate, IO], + cluster_update: Union[_models.ClusterUpdate, IO[bytes]], **kwargs: Any ) -> _models.Cluster: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -502,7 +457,7 @@ async def _update_initial( else: _json = self._serialize.body(cluster_update, "ClusterUpdate") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cluster_name=cluster_name, @@ -511,16 +466,15 @@ async def _update_initial( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -530,21 +484,21 @@ async def _update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("Cluster", pipeline_response) if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = self._deserialize("Cluster", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}" - } - @overload async def begin_update( self, @@ -556,30 +510,20 @@ async def begin_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.Cluster]: - """Update a cluster in a private cloud. - - Update a cluster in a private cloud. + """Update a Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str :param cluster_update: The cluster properties to be updated. Required. :type cluster_update: ~azure.mgmt.avs.models.ClusterUpdate :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 Cluster or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Cluster] @@ -592,35 +536,25 @@ async def begin_update( resource_group_name: str, private_cloud_name: str, cluster_name: str, - cluster_update: IO, + cluster_update: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.Cluster]: - """Update a cluster in a private cloud. - - Update a cluster in a private cloud. + """Update a Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str :param cluster_update: The cluster properties to be updated. Required. - :type cluster_update: IO + :type cluster_update: IO[bytes] :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 Cluster or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Cluster] @@ -633,34 +567,21 @@ async def begin_update( resource_group_name: str, private_cloud_name: str, cluster_name: str, - cluster_update: Union[_models.ClusterUpdate, IO], + cluster_update: Union[_models.ClusterUpdate, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Cluster]: - """Update a cluster in a private cloud. - - Update a cluster in a private cloud. + """Update a Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str :param cluster_update: The cluster properties to be updated. Is either a ClusterUpdate type or - a IO type. Required. - :type cluster_update: ~azure.mgmt.avs.models.ClusterUpdate 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. + a IO[bytes] type. Required. + :type cluster_update: ~azure.mgmt.avs.models.ClusterUpdate or IO[bytes] :return: An instance of AsyncLROPoller that returns either Cluster or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Cluster] @@ -693,32 +614,32 @@ async def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Cluster", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.Cluster].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.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}" - } + return AsyncLROPoller[_models.Cluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -732,22 +653,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cluster_name=cluster_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -757,36 +677,27 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, None, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async async def begin_delete( self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Delete a cluster in a private cloud. - - Delete a cluster in a private cloud. + """Delete a Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_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: @@ -814,26 +725,24 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def list_zones( @@ -841,21 +750,18 @@ async def list_zones( ) -> _models.ClusterZoneList: """List hosts by zone in a cluster. - List hosts by zone in a cluster. - :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: 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: ClusterZoneList or the result of cls(response) :rtype: ~azure.mgmt.avs.models.ClusterZoneList :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -869,22 +775,21 @@ async def list_zones( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClusterZoneList] = kwargs.pop("cls", None) - request = build_list_zones_request( + _request = build_list_zones_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_zones.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -897,10 +802,6 @@ async def list_zones( deserialized = self._deserialize("ClusterZoneList", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_zones.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/listZones" - } + return deserialized # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_datastores_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_datastores_operations.py index 1390fac19a75..884a5a65f7f9 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_datastores_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_datastores_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -38,6 +39,10 @@ build_list_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,18 +70,15 @@ def __init__(self, *args, **kwargs) -> None: def list( self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any ) -> AsyncIterable["_models.Datastore"]: - """List datastores in a private cloud cluster. - - List datastores in a private cloud cluster. + """List Datastore resources by Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: 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 Datastore or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.Datastore] :raises ~azure.core.exceptions.HttpResponseError: @@ -87,7 +89,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DatastoreList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,18 +100,17 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cluster_name=cluster_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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -121,13 +122,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("DatastoreList", pipeline_response) @@ -137,11 +138,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -154,33 +155,26 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores" - } - @distributed_trace_async async def get( self, resource_group_name: str, private_cloud_name: str, cluster_name: str, datastore_name: str, **kwargs: Any ) -> _models.Datastore: - """Get a datastore in a private cloud cluster. - - Get a datastore in a private cloud cluster. + """Get a Datastore. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param datastore_name: Name of the datastore in the private cloud cluster. Required. + :param datastore_name: Name of the datastore. Required. :type datastore_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Datastore or the result of cls(response) :rtype: ~azure.mgmt.avs.models.Datastore :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -194,23 +188,22 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Datastore] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cluster_name=cluster_name, datastore_name=datastore_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -223,13 +216,9 @@ async def get( deserialized = self._deserialize("Datastore", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, @@ -237,10 +226,10 @@ async def _create_or_update_initial( private_cloud_name: str, cluster_name: str, datastore_name: str, - datastore: Union[_models.Datastore, IO], + datastore: Union[_models.Datastore, IO[bytes]], **kwargs: Any ) -> _models.Datastore: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -263,7 +252,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(datastore, "Datastore") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cluster_name=cluster_name, @@ -273,16 +262,15 @@ async def _create_or_update_initial( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -292,21 +280,20 @@ async def _create_or_update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("Datastore", pipeline_response) if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = self._deserialize("Datastore", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}" - } - @overload async def begin_create_or_update( self, @@ -319,32 +306,22 @@ async def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.Datastore]: - """Create or update a datastore in a private cloud cluster. - - Create or update a datastore in a private cloud cluster. + """Create a Datastore. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param datastore_name: Name of the datastore in the private cloud cluster. Required. + :param datastore_name: Name of the datastore. Required. :type datastore_name: str - :param datastore: A datastore in a private cloud cluster. Required. + :param datastore: Resource create parameters. Required. :type datastore: ~azure.mgmt.avs.models.Datastore :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 Datastore or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Datastore] @@ -358,37 +335,27 @@ async def begin_create_or_update( private_cloud_name: str, cluster_name: str, datastore_name: str, - datastore: IO, + datastore: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.Datastore]: - """Create or update a datastore in a private cloud cluster. - - Create or update a datastore in a private cloud cluster. + """Create a Datastore. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param datastore_name: Name of the datastore in the private cloud cluster. Required. + :param datastore_name: Name of the datastore. Required. :type datastore_name: str - :param datastore: A datastore in a private cloud cluster. Required. - :type datastore: IO + :param datastore: Resource create parameters. Required. + :type datastore: IO[bytes] :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 Datastore or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Datastore] @@ -402,36 +369,23 @@ async def begin_create_or_update( private_cloud_name: str, cluster_name: str, datastore_name: str, - datastore: Union[_models.Datastore, IO], + datastore: Union[_models.Datastore, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Datastore]: - """Create or update a datastore in a private cloud cluster. - - Create or update a datastore in a private cloud cluster. + """Create a Datastore. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param datastore_name: Name of the datastore in the private cloud cluster. Required. + :param datastore_name: Name of the datastore. Required. :type datastore_name: str - :param datastore: A datastore in a private cloud cluster. Is either a Datastore type or a IO - type. Required. - :type datastore: ~azure.mgmt.avs.models.Datastore 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. + :param datastore: Resource create parameters. Is either a Datastore type or a IO[bytes] type. + Required. + :type datastore: ~azure.mgmt.avs.models.Datastore or IO[bytes] :return: An instance of AsyncLROPoller that returns either Datastore or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Datastore] @@ -465,32 +419,33 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Datastore", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.Datastore].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.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}" - } + return AsyncLROPoller[_models.Datastore]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, private_cloud_name: str, cluster_name: str, datastore_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -504,23 +459,22 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cluster_name=cluster_name, datastore_name=datastore_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -530,38 +484,29 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, None, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async async def begin_delete( self, resource_group_name: str, private_cloud_name: str, cluster_name: str, datastore_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Delete a datastore in a private cloud cluster. - - Delete a datastore in a private cloud cluster. + """Delete a Datastore. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param datastore_name: Name of the datastore in the private cloud cluster. Required. + :param datastore_name: Name of the datastore. Required. :type datastore_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: @@ -590,23 +535,21 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_global_reach_connections_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_global_reach_connections_operations.py index 67f28bdf28ba..8561f5e72a30 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_global_reach_connections_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_global_reach_connections_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -38,6 +39,10 @@ build_list_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,16 +70,13 @@ def __init__(self, *args, **kwargs) -> None: def list( self, resource_group_name: str, private_cloud_name: str, **kwargs: Any ) -> AsyncIterable["_models.GlobalReachConnection"]: - """List global reach connections in a private cloud. - - List global reach connections in a private cloud. + """List GlobalReachConnection resources by PrivateCloud. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GlobalReachConnection or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.GlobalReachConnection] @@ -86,7 +88,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GlobalReachConnectionList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -97,17 +99,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -119,13 +120,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("GlobalReachConnectionList", pipeline_response) @@ -135,11 +136,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -152,32 +153,24 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections" - } - @distributed_trace_async async def get( self, resource_group_name: str, private_cloud_name: str, global_reach_connection_name: str, **kwargs: Any ) -> _models.GlobalReachConnection: - """Get a global reach connection by name in a private cloud. - - Get a global reach connection by name in a private cloud. + """Get a GlobalReachConnection. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param global_reach_connection_name: Name of the global reach connection in the private cloud. - Required. + :param global_reach_connection_name: Name of the global reach connection. Required. :type global_reach_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GlobalReachConnection or the result of cls(response) :rtype: ~azure.mgmt.avs.models.GlobalReachConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -191,22 +184,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GlobalReachConnection] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, global_reach_connection_name=global_reach_connection_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -219,23 +211,19 @@ async def get( deserialized = self._deserialize("GlobalReachConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, private_cloud_name: str, global_reach_connection_name: str, - global_reach_connection: Union[_models.GlobalReachConnection, IO], + global_reach_connection: Union[_models.GlobalReachConnection, IO[bytes]], **kwargs: Any ) -> _models.GlobalReachConnection: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -258,7 +246,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(global_reach_connection, "GlobalReachConnection") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, global_reach_connection_name=global_reach_connection_name, @@ -267,16 +255,15 @@ async def _create_or_update_initial( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -286,21 +273,20 @@ async def _create_or_update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("GlobalReachConnection", pipeline_response) if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = self._deserialize("GlobalReachConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}" - } - @overload async def begin_create_or_update( self, @@ -312,31 +298,20 @@ async def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GlobalReachConnection]: - """Create or update a global reach connection in a private cloud. - - Create or update a global reach connection in a private cloud. + """Create a GlobalReachConnection. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param global_reach_connection_name: Name of the global reach connection in the private cloud. - Required. + :param global_reach_connection_name: Name of the global reach connection. Required. :type global_reach_connection_name: str - :param global_reach_connection: A global reach connection in the private cloud. Required. + :param global_reach_connection: Resource create parameters. Required. :type global_reach_connection: ~azure.mgmt.avs.models.GlobalReachConnection :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 GlobalReachConnection or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.GlobalReachConnection] @@ -349,36 +324,25 @@ async def begin_create_or_update( resource_group_name: str, private_cloud_name: str, global_reach_connection_name: str, - global_reach_connection: IO, + global_reach_connection: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GlobalReachConnection]: - """Create or update a global reach connection in a private cloud. - - Create or update a global reach connection in a private cloud. + """Create a GlobalReachConnection. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param global_reach_connection_name: Name of the global reach connection in the private cloud. - Required. + :param global_reach_connection_name: Name of the global reach connection. Required. :type global_reach_connection_name: str - :param global_reach_connection: A global reach connection in the private cloud. Required. - :type global_reach_connection: IO + :param global_reach_connection: Resource create parameters. Required. + :type global_reach_connection: IO[bytes] :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 GlobalReachConnection or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.GlobalReachConnection] @@ -391,35 +355,21 @@ async def begin_create_or_update( resource_group_name: str, private_cloud_name: str, global_reach_connection_name: str, - global_reach_connection: Union[_models.GlobalReachConnection, IO], + global_reach_connection: Union[_models.GlobalReachConnection, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GlobalReachConnection]: - """Create or update a global reach connection in a private cloud. - - Create or update a global reach connection in a private cloud. + """Create a GlobalReachConnection. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param global_reach_connection_name: Name of the global reach connection in the private cloud. - Required. + :param global_reach_connection_name: Name of the global reach connection. Required. :type global_reach_connection_name: str - :param global_reach_connection: A global reach connection in the private cloud. Is either a - GlobalReachConnection type or a IO type. Required. - :type global_reach_connection: ~azure.mgmt.avs.models.GlobalReachConnection 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. + :param global_reach_connection: Resource create parameters. Is either a GlobalReachConnection + type or a IO[bytes] type. Required. + :type global_reach_connection: ~azure.mgmt.avs.models.GlobalReachConnection or IO[bytes] :return: An instance of AsyncLROPoller that returns either GlobalReachConnection or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.GlobalReachConnection] @@ -452,32 +402,33 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("GlobalReachConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.GlobalReachConnection].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.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}" - } + return AsyncLROPoller[_models.GlobalReachConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, private_cloud_name: str, global_reach_connection_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -491,22 +442,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, global_reach_connection_name=global_reach_connection_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -516,37 +466,27 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, None, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async async def begin_delete( self, resource_group_name: str, private_cloud_name: str, global_reach_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Delete a global reach connection in a private cloud. - - Delete a global reach connection in a private cloud. + """Delete a GlobalReachConnection. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param global_reach_connection_name: Name of the global reach connection in the private cloud. - Required. + :param global_reach_connection_name: Name of the global reach connection. Required. :type global_reach_connection_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: @@ -574,23 +514,21 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_hcx_enterprise_sites_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_hcx_enterprise_sites_operations.py index bc50ec7a61ee..32ba127ae2d2 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_hcx_enterprise_sites_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_hcx_enterprise_sites_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -36,6 +37,10 @@ build_list_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,16 +68,13 @@ def __init__(self, *args, **kwargs) -> None: def list( self, resource_group_name: str, private_cloud_name: str, **kwargs: Any ) -> AsyncIterable["_models.HcxEnterpriseSite"]: - """List HCX on-premises key in a private cloud. - - List HCX on-premises key in a private cloud. + """List HcxEnterpriseSite resources by PrivateCloud. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either HcxEnterpriseSite or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.HcxEnterpriseSite] :raises ~azure.core.exceptions.HttpResponseError: @@ -83,7 +85,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HcxEnterpriseSiteList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -94,17 +96,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -116,13 +117,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("HcxEnterpriseSiteList", pipeline_response) @@ -132,11 +133,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -149,32 +150,24 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites" - } - @distributed_trace_async async def get( self, resource_group_name: str, private_cloud_name: str, hcx_enterprise_site_name: str, **kwargs: Any ) -> _models.HcxEnterpriseSite: - """Get an HCX on-premises key by name in a private cloud. - - Get an HCX on-premises key by name in a private cloud. + """Get a HcxEnterpriseSite. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param hcx_enterprise_site_name: Name of the HCX Enterprise Site in the private cloud. - Required. + :param hcx_enterprise_site_name: Name of the HCX Enterprise Site. Required. :type hcx_enterprise_site_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: HcxEnterpriseSite or the result of cls(response) :rtype: ~azure.mgmt.avs.models.HcxEnterpriseSite :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -188,22 +181,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HcxEnterpriseSite] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, hcx_enterprise_site_name=hcx_enterprise_site_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -216,13 +208,9 @@ async def get( deserialized = self._deserialize("HcxEnterpriseSite", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -235,24 +223,20 @@ async def create_or_update( content_type: str = "application/json", **kwargs: Any ) -> _models.HcxEnterpriseSite: - """Create or update an activation key for on-premises HCX site. - - Create or update an activation key for on-premises HCX site. + """Create a HcxEnterpriseSite. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param hcx_enterprise_site_name: Name of the HCX Enterprise Site in the private cloud. - Required. + :param hcx_enterprise_site_name: Name of the HCX Enterprise Site. Required. :type hcx_enterprise_site_name: str - :param hcx_enterprise_site: The HCX Enterprise Site. Required. + :param hcx_enterprise_site: Resource create parameters. Required. :type hcx_enterprise_site: ~azure.mgmt.avs.models.HcxEnterpriseSite :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: HcxEnterpriseSite or the result of cls(response) :rtype: ~azure.mgmt.avs.models.HcxEnterpriseSite :raises ~azure.core.exceptions.HttpResponseError: @@ -264,29 +248,25 @@ async def create_or_update( resource_group_name: str, private_cloud_name: str, hcx_enterprise_site_name: str, - hcx_enterprise_site: IO, + hcx_enterprise_site: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.HcxEnterpriseSite: - """Create or update an activation key for on-premises HCX site. - - Create or update an activation key for on-premises HCX site. + """Create a HcxEnterpriseSite. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param hcx_enterprise_site_name: Name of the HCX Enterprise Site in the private cloud. - Required. + :param hcx_enterprise_site_name: Name of the HCX Enterprise Site. Required. :type hcx_enterprise_site_name: str - :param hcx_enterprise_site: The HCX Enterprise Site. Required. - :type hcx_enterprise_site: IO + :param hcx_enterprise_site: Resource create parameters. Required. + :type hcx_enterprise_site: IO[bytes] :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: HcxEnterpriseSite or the result of cls(response) :rtype: ~azure.mgmt.avs.models.HcxEnterpriseSite :raises ~azure.core.exceptions.HttpResponseError: @@ -298,33 +278,26 @@ async def create_or_update( resource_group_name: str, private_cloud_name: str, hcx_enterprise_site_name: str, - hcx_enterprise_site: Union[_models.HcxEnterpriseSite, IO], + hcx_enterprise_site: Union[_models.HcxEnterpriseSite, IO[bytes]], **kwargs: Any ) -> _models.HcxEnterpriseSite: - """Create or update an activation key for on-premises HCX site. - - Create or update an activation key for on-premises HCX site. + """Create a HcxEnterpriseSite. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param hcx_enterprise_site_name: Name of the HCX Enterprise Site in the private cloud. - Required. + :param hcx_enterprise_site_name: Name of the HCX Enterprise Site. Required. :type hcx_enterprise_site_name: str - :param hcx_enterprise_site: The HCX Enterprise Site. Is either a HcxEnterpriseSite type or a IO - type. Required. - :type hcx_enterprise_site: ~azure.mgmt.avs.models.HcxEnterpriseSite 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 + :param hcx_enterprise_site: Resource create parameters. Is either a HcxEnterpriseSite type or a + IO[bytes] type. Required. + :type hcx_enterprise_site: ~azure.mgmt.avs.models.HcxEnterpriseSite or IO[bytes] :return: HcxEnterpriseSite or the result of cls(response) :rtype: ~azure.mgmt.avs.models.HcxEnterpriseSite :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -347,7 +320,7 @@ async def create_or_update( else: _json = self._serialize.body(hcx_enterprise_site, "HcxEnterpriseSite") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, hcx_enterprise_site_name=hcx_enterprise_site_name, @@ -356,16 +329,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -386,32 +358,24 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, private_cloud_name: str, hcx_enterprise_site_name: str, **kwargs: Any ) -> None: - """Delete HCX on-premises key in a private cloud. - - Delete HCX on-premises key in a private cloud. + """Delete a HcxEnterpriseSite. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param hcx_enterprise_site_name: Name of the HCX Enterprise Site in the private cloud. - Required. + :param hcx_enterprise_site_name: Name of the HCX Enterprise Site. Required. :type hcx_enterprise_site_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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -425,22 +389,21 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, hcx_enterprise_site_name=hcx_enterprise_site_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -451,8 +414,4 @@ async def delete( # pylint: disable=inconsistent-return-statements 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.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_iscsi_paths_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_iscsi_paths_operations.py new file mode 100644 index 000000000000..c40d276f6569 --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_iscsi_paths_operations.py @@ -0,0 +1,512 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, 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._iscsi_paths_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_private_cloud_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class IscsiPathsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.avs.aio.AVSClient`'s + :attr:`iscsi_paths` 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_private_cloud( + self, resource_group_name: str, private_cloud_name: str, **kwargs: Any + ) -> AsyncIterable["_models.IscsiPath"]: + """List IscsiPath resources by PrivateCloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. Required. + :type private_cloud_name: str + :return: An iterator like instance of either IscsiPath or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.IscsiPath] + :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.IscsiPathListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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_private_cloud_request( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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("IscsiPathListResult", 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) + + @distributed_trace_async + async def get(self, resource_group_name: str, private_cloud_name: str, **kwargs: Any) -> _models.IscsiPath: + """Get a IscsiPath. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. Required. + :type private_cloud_name: str + :return: IscsiPath or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.IscsiPath + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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.IscsiPath] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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("IscsiPath", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + private_cloud_name: str, + resource: Union[_models.IscsiPath, IO[bytes]], + **kwargs: Any + ) -> _models.IscsiPath: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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.IscsiPath] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "IscsiPath") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + 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) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("IscsiPath", pipeline_response) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("IscsiPath", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + private_cloud_name: str, + resource: _models.IscsiPath, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.IscsiPath]: + """Create a IscsiPath. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. Required. + :type private_cloud_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.avs.models.IscsiPath + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either IscsiPath or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.IscsiPath] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + private_cloud_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.IscsiPath]: + """Create a IscsiPath. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. Required. + :type private_cloud_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either IscsiPath or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.IscsiPath] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + private_cloud_name: str, + resource: Union[_models.IscsiPath, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.IscsiPath]: + """Create a IscsiPath. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. Required. + :type private_cloud_name: str + :param resource: Resource create parameters. Is either a IscsiPath type or a IO[bytes] type. + Required. + :type resource: ~azure.mgmt.avs.models.IscsiPath or IO[bytes] + :return: An instance of AsyncLROPoller that returns either IscsiPath or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.IscsiPath] + :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.IscsiPath] = 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, + private_cloud_name=private_cloud_name, + resource=resource, + 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("IscsiPath", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.IscsiPath].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.IscsiPath]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, private_cloud_name: str, **kwargs: Any + ) -> None: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + private_cloud_name=private_cloud_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, private_cloud_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a IscsiPath. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. Required. + :type private_cloud_name: str + :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, + private_cloud_name=private_cloud_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, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_locations_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_locations_operations.py index 6e2b77657110..d9983f93fc94 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_locations_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_locations_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,6 +32,10 @@ build_check_trial_availability_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,20 +59,72 @@ 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 check_quota_availability(self, location: str, **kwargs: Any) -> _models.Quota: + """Return quota for subscription by region. + + :param location: The name of the Azure region. Required. + :type location: str + :return: Quota or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.Quota + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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.Quota] = kwargs.pop("cls", None) + + _request = build_check_quota_availability_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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("Quota", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + @overload async def check_trial_availability( self, location: str, sku: Optional[_models.Sku] = None, *, content_type: str = "application/json", **kwargs: Any ) -> _models.Trial: """Return trial status for subscription by region. - :param location: Azure region. Required. + :param location: The name of the Azure region. Required. :type location: str - :param sku: The sku to check for trial availability. Default value is None. + :param sku: Optionally, check for a specific SKU. Default value is None. :type sku: ~azure.mgmt.avs.models.Sku :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: Trial or the result of cls(response) :rtype: ~azure.mgmt.avs.models.Trial :raises ~azure.core.exceptions.HttpResponseError: @@ -75,18 +132,17 @@ async def check_trial_availability( @overload async def check_trial_availability( - self, location: str, sku: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any + self, location: str, sku: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any ) -> _models.Trial: """Return trial status for subscription by region. - :param location: Azure region. Required. + :param location: The name of the Azure region. Required. :type location: str - :param sku: The sku to check for trial availability. Default value is None. - :type sku: IO + :param sku: Optionally, check for a specific SKU. Default value is None. + :type sku: IO[bytes] :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: Trial or the result of cls(response) :rtype: ~azure.mgmt.avs.models.Trial :raises ~azure.core.exceptions.HttpResponseError: @@ -94,24 +150,20 @@ async def check_trial_availability( @distributed_trace_async async def check_trial_availability( - self, location: str, sku: Optional[Union[_models.Sku, IO]] = None, **kwargs: Any + self, location: str, sku: Optional[Union[_models.Sku, IO[bytes]]] = None, **kwargs: Any ) -> _models.Trial: """Return trial status for subscription by region. - :param location: Azure region. Required. + :param location: The name of the Azure region. Required. :type location: str - :param sku: The sku to check for trial availability. Is either a Sku type or a IO type. Default - value is None. - :type sku: ~azure.mgmt.avs.models.Sku or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + :param sku: Optionally, check for a specific SKU. Is either a Sku type or a IO[bytes] type. Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :type sku: ~azure.mgmt.avs.models.Sku or IO[bytes] :return: Trial or the result of cls(response) :rtype: ~azure.mgmt.avs.models.Trial :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -137,23 +189,22 @@ async def check_trial_availability( else: _json = None - request = build_check_trial_availability_request( + _request = build_check_trial_availability_request( location=location, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.check_trial_availability.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -166,69 +217,6 @@ async def check_trial_availability( deserialized = self._deserialize("Trial", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - check_trial_availability.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkTrialAvailability" - } - - @distributed_trace_async - async def check_quota_availability(self, location: str, **kwargs: Any) -> _models.Quota: - """Return quota for subscription by region. - - :param location: Azure region. Required. - :type location: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Quota or the result of cls(response) - :rtype: ~azure.mgmt.avs.models.Quota - :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.Quota] = kwargs.pop("cls", None) - - request = build_check_quota_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.check_quota_availability.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("Quota", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - check_quota_availability.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkQuotaAvailability" - } + return deserialized # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_operations.py index 207d97cab96d..b5dea98598cd 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,9 +59,8 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: - """Lists all of the available operations. + """List the operations for the provider. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Operation or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: @@ -65,9 +69,9 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _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.OperationList] = kwargs.pop("cls", None) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -78,14 +82,13 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _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) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -97,27 +100,27 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("OperationList", 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) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -129,5 +132,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.AVS/operations"} diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_placement_policies_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_placement_policies_operations.py index 6dbe790d4d55..a255d69d7c2a 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_placement_policies_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_placement_policies_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -39,6 +40,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -66,18 +71,15 @@ def __init__(self, *args, **kwargs) -> None: def list( self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any ) -> AsyncIterable["_models.PlacementPolicy"]: - """List placement policies in a private cloud cluster. - - List placement policies in a private cloud cluster. + """List PlacementPolicy resources by Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: 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 PlacementPolicy or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.PlacementPolicy] :raises ~azure.core.exceptions.HttpResponseError: @@ -88,7 +90,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PlacementPoliciesList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -99,18 +101,17 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cluster_name=cluster_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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -122,13 +123,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("PlacementPoliciesList", pipeline_response) @@ -138,11 +139,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -155,10 +156,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies" - } - @distributed_trace_async async def get( self, @@ -168,26 +165,22 @@ async def get( placement_policy_name: str, **kwargs: Any ) -> _models.PlacementPolicy: - """Get a placement policy by name in a private cloud cluster. - - Get a placement policy by name in a private cloud cluster. + """Get a PlacementPolicy. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS) - placement policy. Required. + :param placement_policy_name: Name of the placement policy. Required. :type placement_policy_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PlacementPolicy or the result of cls(response) :rtype: ~azure.mgmt.avs.models.PlacementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,23 +194,22 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PlacementPolicy] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cluster_name=cluster_name, placement_policy_name=placement_policy_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -230,13 +222,9 @@ async def get( deserialized = self._deserialize("PlacementPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, @@ -244,10 +232,10 @@ async def _create_or_update_initial( private_cloud_name: str, cluster_name: str, placement_policy_name: str, - placement_policy: Union[_models.PlacementPolicy, IO], + placement_policy: Union[_models.PlacementPolicy, IO[bytes]], **kwargs: Any ) -> _models.PlacementPolicy: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -270,7 +258,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(placement_policy, "PlacementPolicy") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cluster_name=cluster_name, @@ -280,16 +268,15 @@ async def _create_or_update_initial( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -299,21 +286,20 @@ async def _create_or_update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("PlacementPolicy", pipeline_response) if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = self._deserialize("PlacementPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}" - } - @overload async def begin_create_or_update( self, @@ -326,33 +312,22 @@ async def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.PlacementPolicy]: - """Create or update a placement policy in a private cloud cluster. - - Create or update a placement policy in a private cloud cluster. + """Create a PlacementPolicy. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS) - placement policy. Required. + :param placement_policy_name: Name of the placement policy. Required. :type placement_policy_name: str - :param placement_policy: A placement policy in the private cloud cluster. Required. + :param placement_policy: Resource create parameters. Required. :type placement_policy: ~azure.mgmt.avs.models.PlacementPolicy :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 PlacementPolicy or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PlacementPolicy] @@ -366,38 +341,27 @@ async def begin_create_or_update( private_cloud_name: str, cluster_name: str, placement_policy_name: str, - placement_policy: IO, + placement_policy: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.PlacementPolicy]: - """Create or update a placement policy in a private cloud cluster. - - Create or update a placement policy in a private cloud cluster. + """Create a PlacementPolicy. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS) - placement policy. Required. + :param placement_policy_name: Name of the placement policy. Required. :type placement_policy_name: str - :param placement_policy: A placement policy in the private cloud cluster. Required. - :type placement_policy: IO + :param placement_policy: Resource create parameters. Required. + :type placement_policy: IO[bytes] :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 PlacementPolicy or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PlacementPolicy] @@ -411,37 +375,23 @@ async def begin_create_or_update( private_cloud_name: str, cluster_name: str, placement_policy_name: str, - placement_policy: Union[_models.PlacementPolicy, IO], + placement_policy: Union[_models.PlacementPolicy, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.PlacementPolicy]: - """Create or update a placement policy in a private cloud cluster. - - Create or update a placement policy in a private cloud cluster. + """Create a PlacementPolicy. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS) - placement policy. Required. + :param placement_policy_name: Name of the placement policy. Required. :type placement_policy_name: str - :param placement_policy: A placement policy in the private cloud cluster. Is either a - PlacementPolicy type or a IO type. Required. - :type placement_policy: ~azure.mgmt.avs.models.PlacementPolicy 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. + :param placement_policy: Resource create parameters. Is either a PlacementPolicy type or a + IO[bytes] type. Required. + :type placement_policy: ~azure.mgmt.avs.models.PlacementPolicy or IO[bytes] :return: An instance of AsyncLROPoller that returns either PlacementPolicy or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PlacementPolicy] @@ -475,27 +425,28 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("PlacementPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.PlacementPolicy].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.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}" - } + return AsyncLROPoller[_models.PlacementPolicy]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _update_initial( self, @@ -503,10 +454,10 @@ async def _update_initial( private_cloud_name: str, cluster_name: str, placement_policy_name: str, - placement_policy_update: Union[_models.PlacementPolicyUpdate, IO], + placement_policy_update: Union[_models.PlacementPolicyUpdate, IO[bytes]], **kwargs: Any ) -> _models.PlacementPolicy: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -529,7 +480,7 @@ async def _update_initial( else: _json = self._serialize.body(placement_policy_update, "PlacementPolicyUpdate") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cluster_name=cluster_name, @@ -539,16 +490,15 @@ async def _update_initial( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -558,21 +508,21 @@ async def _update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("PlacementPolicy", pipeline_response) if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = self._deserialize("PlacementPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}" - } - @overload async def begin_update( self, @@ -585,33 +535,22 @@ async def begin_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.PlacementPolicy]: - """Update a placement policy in a private cloud cluster. - - Update a placement policy in a private cloud cluster. + """Update a PlacementPolicy. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS) - placement policy. Required. + :param placement_policy_name: Name of the placement policy. Required. :type placement_policy_name: str - :param placement_policy_update: The placement policy properties that may be updated. Required. + :param placement_policy_update: The placement policy properties to be updated. Required. :type placement_policy_update: ~azure.mgmt.avs.models.PlacementPolicyUpdate :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 PlacementPolicy or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PlacementPolicy] @@ -625,38 +564,27 @@ async def begin_update( private_cloud_name: str, cluster_name: str, placement_policy_name: str, - placement_policy_update: IO, + placement_policy_update: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.PlacementPolicy]: - """Update a placement policy in a private cloud cluster. - - Update a placement policy in a private cloud cluster. + """Update a PlacementPolicy. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS) - placement policy. Required. + :param placement_policy_name: Name of the placement policy. Required. :type placement_policy_name: str - :param placement_policy_update: The placement policy properties that may be updated. Required. - :type placement_policy_update: IO + :param placement_policy_update: The placement policy properties to be updated. Required. + :type placement_policy_update: IO[bytes] :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 PlacementPolicy or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PlacementPolicy] @@ -670,37 +598,23 @@ async def begin_update( private_cloud_name: str, cluster_name: str, placement_policy_name: str, - placement_policy_update: Union[_models.PlacementPolicyUpdate, IO], + placement_policy_update: Union[_models.PlacementPolicyUpdate, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.PlacementPolicy]: - """Update a placement policy in a private cloud cluster. - - Update a placement policy in a private cloud cluster. + """Update a PlacementPolicy. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS) - placement policy. Required. + :param placement_policy_name: Name of the placement policy. Required. :type placement_policy_name: str - :param placement_policy_update: The placement policy properties that may be updated. Is either - a PlacementPolicyUpdate type or a IO type. Required. - :type placement_policy_update: ~azure.mgmt.avs.models.PlacementPolicyUpdate 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. + :param placement_policy_update: The placement policy properties to be updated. Is either a + PlacementPolicyUpdate type or a IO[bytes] type. Required. + :type placement_policy_update: ~azure.mgmt.avs.models.PlacementPolicyUpdate or IO[bytes] :return: An instance of AsyncLROPoller that returns either PlacementPolicy or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PlacementPolicy] @@ -734,27 +648,27 @@ async def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("PlacementPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.PlacementPolicy].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.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}" - } + return AsyncLROPoller[_models.PlacementPolicy]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -764,7 +678,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements placement_policy_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -778,23 +692,22 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cluster_name=cluster_name, placement_policy_name=placement_policy_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -804,12 +717,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, None, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async async def begin_delete( @@ -820,28 +734,17 @@ async def begin_delete( placement_policy_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Delete a placement policy in a private cloud cluster. - - Delete a placement policy in a private cloud cluster. + """Delete a PlacementPolicy. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS) - placement policy. Required. + :param placement_policy_name: Name of the placement policy. Required. :type placement_policy_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: @@ -870,23 +773,21 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_private_clouds_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_private_clouds_operations.py index 9c62783ef501..fcfb8bacf0c8 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_private_clouds_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_private_clouds_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -43,6 +44,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -67,15 +72,9 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.PrivateCloud"]: - """List private clouds in a resource group. - - List private clouds in a resource group. + def list_in_subscription(self, **kwargs: Any) -> AsyncIterable["_models.PrivateCloud"]: + """List PrivateCloud resources by subscription ID. - :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 PrivateCloud or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.PrivateCloud] :raises ~azure.core.exceptions.HttpResponseError: @@ -86,7 +85,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_model api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateCloudList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -97,16 +96,14 @@ def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_model def prepare_request(next_link=None): if not next_link: - request = build_list_request( - resource_group_name=resource_group_name, + _request = build_list_in_subscription_request( 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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -118,13 +115,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("PrivateCloudList", pipeline_response) @@ -134,11 +131,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,17 +148,13 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds" - } - @distributed_trace - def list_in_subscription(self, **kwargs: Any) -> AsyncIterable["_models.PrivateCloud"]: - """List private clouds in a subscription. - - List private clouds in a subscription. + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.PrivateCloud"]: + """List PrivateCloud resources by resource group. - :keyword callable cls: A custom type or function that will be passed the direct response + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str :return: An iterator like instance of either PrivateCloud or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.PrivateCloud] :raises ~azure.core.exceptions.HttpResponseError: @@ -172,7 +165,7 @@ def list_in_subscription(self, **kwargs: Any) -> AsyncIterable["_models.PrivateC api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateCloudList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -183,15 +176,15 @@ def list_in_subscription(self, **kwargs: Any) -> AsyncIterable["_models.PrivateC def prepare_request(next_link=None): if not next_link: - request = build_list_in_subscription_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_in_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -203,13 +196,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("PrivateCloudList", pipeline_response) @@ -219,11 +212,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -236,25 +229,20 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AVS/privateClouds"} - @distributed_trace_async async def get(self, resource_group_name: str, private_cloud_name: str, **kwargs: Any) -> _models.PrivateCloud: - """Get a private cloud. - - Get a private cloud. + """Get a PrivateCloud. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateCloud or the result of cls(response) :rtype: ~azure.mgmt.avs.models.PrivateCloud :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -268,21 +256,20 @@ async def get(self, resource_group_name: str, private_cloud_name: str, **kwargs: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateCloud] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -295,22 +282,18 @@ async def get(self, resource_group_name: str, private_cloud_name: str, **kwargs: deserialized = self._deserialize("PrivateCloud", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, private_cloud_name: str, - private_cloud: Union[_models.PrivateCloud, IO], + private_cloud: Union[_models.PrivateCloud, IO[bytes]], **kwargs: Any ) -> _models.PrivateCloud: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -333,7 +316,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(private_cloud, "PrivateCloud") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, subscription_id=self._config.subscription_id, @@ -341,16 +324,15 @@ async def _create_or_update_initial( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -360,21 +342,20 @@ async def _create_or_update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("PrivateCloud", pipeline_response) if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = self._deserialize("PrivateCloud", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}" - } - @overload async def begin_create_or_update( self, @@ -385,28 +366,18 @@ async def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.PrivateCloud]: - """Create or update a private cloud. - - Create or update a private cloud. + """Create a PrivateCloud. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param private_cloud: The private cloud. Required. + :param private_cloud: Resource create parameters. Required. :type private_cloud: ~azure.mgmt.avs.models.PrivateCloud :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 PrivateCloud or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PrivateCloud] @@ -418,33 +389,23 @@ async def begin_create_or_update( self, resource_group_name: str, private_cloud_name: str, - private_cloud: IO, + private_cloud: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.PrivateCloud]: - """Create or update a private cloud. - - Create or update a private cloud. + """Create a PrivateCloud. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param private_cloud: The private cloud. Required. - :type private_cloud: IO + :param private_cloud: Resource create parameters. Required. + :type private_cloud: IO[bytes] :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 PrivateCloud or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PrivateCloud] @@ -456,31 +417,19 @@ async def begin_create_or_update( self, resource_group_name: str, private_cloud_name: str, - private_cloud: Union[_models.PrivateCloud, IO], + private_cloud: Union[_models.PrivateCloud, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.PrivateCloud]: - """Create or update a private cloud. - - Create or update a private cloud. + """Create a PrivateCloud. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param private_cloud: The private cloud. Is either a PrivateCloud type or a IO type. Required. - :type private_cloud: ~azure.mgmt.avs.models.PrivateCloud 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. + :param private_cloud: Resource create parameters. Is either a PrivateCloud type or a IO[bytes] + type. Required. + :type private_cloud: ~azure.mgmt.avs.models.PrivateCloud or IO[bytes] :return: An instance of AsyncLROPoller that returns either PrivateCloud or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PrivateCloud] @@ -512,36 +461,37 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("PrivateCloud", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.PrivateCloud].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.AVS/privateClouds/{privateCloudName}" - } + return AsyncLROPoller[_models.PrivateCloud]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _update_initial( self, resource_group_name: str, private_cloud_name: str, - private_cloud_update: Union[_models.PrivateCloudUpdate, IO], + private_cloud_update: Union[_models.PrivateCloudUpdate, IO[bytes]], **kwargs: Any ) -> _models.PrivateCloud: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -564,7 +514,7 @@ async def _update_initial( else: _json = self._serialize.body(private_cloud_update, "PrivateCloudUpdate") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, subscription_id=self._config.subscription_id, @@ -572,16 +522,15 @@ async def _update_initial( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -591,21 +540,21 @@ async def _update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("PrivateCloud", pipeline_response) if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = self._deserialize("PrivateCloud", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}" - } - @overload async def begin_update( self, @@ -616,9 +565,7 @@ async def begin_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.PrivateCloud]: - """Update a private cloud. - - Update a private cloud. + """Update a PrivateCloud. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -630,14 +577,6 @@ async def begin_update( :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 PrivateCloud or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PrivateCloud] @@ -649,14 +588,12 @@ async def begin_update( self, resource_group_name: str, private_cloud_name: str, - private_cloud_update: IO, + private_cloud_update: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.PrivateCloud]: - """Update a private cloud. - - Update a private cloud. + """Update a PrivateCloud. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -664,18 +601,10 @@ async def begin_update( :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str :param private_cloud_update: The private cloud properties to be updated. Required. - :type private_cloud_update: IO + :type private_cloud_update: IO[bytes] :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 PrivateCloud or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PrivateCloud] @@ -687,12 +616,10 @@ async def begin_update( self, resource_group_name: str, private_cloud_name: str, - private_cloud_update: Union[_models.PrivateCloudUpdate, IO], + private_cloud_update: Union[_models.PrivateCloudUpdate, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.PrivateCloud]: - """Update a private cloud. - - Update a private cloud. + """Update a PrivateCloud. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -700,19 +627,8 @@ async def begin_update( :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str :param private_cloud_update: The private cloud properties to be updated. Is either a - PrivateCloudUpdate type or a IO type. Required. - :type private_cloud_update: ~azure.mgmt.avs.models.PrivateCloudUpdate 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. + PrivateCloudUpdate type or a IO[bytes] type. Required. + :type private_cloud_update: ~azure.mgmt.avs.models.PrivateCloudUpdate or IO[bytes] :return: An instance of AsyncLROPoller that returns either PrivateCloud or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PrivateCloud] @@ -744,32 +660,32 @@ async def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("PrivateCloud", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.PrivateCloud].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.AVS/privateClouds/{privateCloudName}" - } + return AsyncLROPoller[_models.PrivateCloud]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, private_cloud_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -783,21 +699,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -807,34 +722,25 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, None, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async async def begin_delete( self, resource_group_name: str, private_cloud_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Delete a private cloud. - - Delete a private cloud. + """Delete a PrivateCloud. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_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: @@ -861,31 +767,88 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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 + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}" - } + @distributed_trace_async + async def list_admin_credentials( + self, resource_group_name: str, private_cloud_name: str, **kwargs: Any + ) -> _models.AdminCredentials: + """List the admin credentials for the private cloud. - async def _rotate_vcenter_password_initial( # pylint: disable=inconsistent-return-statements + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. Required. + :type private_cloud_name: str + :return: AdminCredentials or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.AdminCredentials + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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.AdminCredentials] = kwargs.pop("cls", None) + + _request = build_list_admin_credentials_request( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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("AdminCredentials", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _rotate_nsxt_password_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, private_cloud_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -899,21 +862,20 @@ async def _rotate_vcenter_password_initial( # pylint: disable=inconsistent-retu api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_rotate_vcenter_password_request( + _request = build_rotate_nsxt_password_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_vcenter_password_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -923,34 +885,25 @@ async def _rotate_vcenter_password_initial( # pylint: disable=inconsistent-retu 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, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _rotate_vcenter_password_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateVcenterPassword" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async - async def begin_rotate_vcenter_password( + async def begin_rotate_nsxt_password( self, resource_group_name: str, private_cloud_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Rotate the vCenter password. - - Rotate the vCenter password. + """Rotate the NSX-T Manager password. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_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: @@ -964,7 +917,7 @@ async def begin_rotate_vcenter_password( 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._rotate_vcenter_password_initial( # type: ignore + raw_result = await self._rotate_nsxt_password_initial( # type: ignore resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, api_version=api_version, @@ -977,31 +930,29 @@ async def begin_rotate_vcenter_password( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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 + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_rotate_vcenter_password.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateVcenterPassword" - } - - async def _rotate_nsxt_password_initial( # pylint: disable=inconsistent-return-statements + async def _rotate_vcenter_password_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, private_cloud_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1015,21 +966,20 @@ async def _rotate_nsxt_password_initial( # pylint: disable=inconsistent-return- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_rotate_nsxt_password_request( + _request = build_rotate_vcenter_password_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_nsxt_password_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1039,34 +989,25 @@ async def _rotate_nsxt_password_initial( # pylint: disable=inconsistent-return- 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, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _rotate_nsxt_password_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateNsxtPassword" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async - async def begin_rotate_nsxt_password( + async def begin_rotate_vcenter_password( self, resource_group_name: str, private_cloud_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Rotate the NSX-T Manager password. - - Rotate the NSX-T Manager password. + """Rotate the vCenter password. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_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: @@ -1080,7 +1021,7 @@ async def begin_rotate_nsxt_password( 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._rotate_nsxt_password_initial( # type: ignore + raw_result = await self._rotate_vcenter_password_initial( # type: ignore resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, api_version=api_version, @@ -1093,90 +1034,21 @@ async def begin_rotate_nsxt_password( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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_rotate_nsxt_password.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateNsxtPassword" - } - - @distributed_trace_async - async def list_admin_credentials( - self, resource_group_name: str, private_cloud_name: str, **kwargs: Any - ) -> _models.AdminCredentials: - """List the admin credentials for the private cloud. - - List the admin credentials for the private cloud. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param private_cloud_name: Name of the private cloud. Required. - :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AdminCredentials or the result of cls(response) - :rtype: ~azure.mgmt.avs.models.AdminCredentials - :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.AdminCredentials] = kwargs.pop("cls", None) - - request = build_list_admin_credentials_request( - resource_group_name=resource_group_name, - private_cloud_name=private_cloud_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_admin_credentials.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("AdminCredentials", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_admin_credentials.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/listAdminCredentials" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_script_cmdlets_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_script_cmdlets_operations.py index 6533bde34e3b..ec55db5584fe 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_script_cmdlets_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_script_cmdlets_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -30,6 +31,10 @@ from ..._vendor import _convert_request from ...operations._script_cmdlets_operations import build_get_request, build_list_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,17 +62,15 @@ def __init__(self, *args, **kwargs) -> None: def list( self, resource_group_name: str, private_cloud_name: str, script_package_name: str, **kwargs: Any ) -> AsyncIterable["_models.ScriptCmdlet"]: - """List script cmdlet resources available for a private cloud to create a script execution - resource on a private cloud. + """List ScriptCmdlet resources by ScriptPackage. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param script_package_name: Name of the script package in the private cloud. Required. + :param script_package_name: Name of the script package. Required. :type script_package_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScriptCmdlet or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.ScriptCmdlet] :raises ~azure.core.exceptions.HttpResponseError: @@ -78,7 +81,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScriptCmdletsList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,18 +92,17 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, script_package_name=script_package_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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -112,13 +114,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("ScriptCmdletsList", pipeline_response) @@ -128,11 +130,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -145,10 +147,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}/scriptCmdlets" - } - @distributed_trace_async async def get( self, @@ -158,24 +156,22 @@ async def get( script_cmdlet_name: str, **kwargs: Any ) -> _models.ScriptCmdlet: - """Return information about a script cmdlet resource in a specific package on a private cloud. + """Get a ScriptCmdlet. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param script_package_name: Name of the script package in the private cloud. Required. + :param script_package_name: Name of the script package. Required. :type script_package_name: str - :param script_cmdlet_name: Name of the script cmdlet resource in the script package in the - private cloud. Required. + :param script_cmdlet_name: Name of the script cmdlet. Required. :type script_cmdlet_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScriptCmdlet or the result of cls(response) :rtype: ~azure.mgmt.avs.models.ScriptCmdlet :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -189,23 +185,22 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScriptCmdlet] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, script_package_name=script_package_name, script_cmdlet_name=script_cmdlet_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -218,10 +213,6 @@ async def get( deserialized = self._deserialize("ScriptCmdlet", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}/scriptCmdlets/{scriptCmdletName}" - } + return deserialized # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_script_executions_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_script_executions_operations.py index be773d15b42c..a9dceddb54d1 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_script_executions_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_script_executions_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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, List, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -39,6 +40,10 @@ build_list_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -66,16 +71,13 @@ def __init__(self, *args, **kwargs) -> None: def list( self, resource_group_name: str, private_cloud_name: str, **kwargs: Any ) -> AsyncIterable["_models.ScriptExecution"]: - """List script executions in a private cloud. - - List script executions in a private cloud. + """List ScriptExecution resources by PrivateCloud. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScriptExecution or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.ScriptExecution] :raises ~azure.core.exceptions.HttpResponseError: @@ -86,7 +88,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScriptExecutionsList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -97,17 +99,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -119,13 +120,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("ScriptExecutionsList", pipeline_response) @@ -135,11 +136,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -152,31 +153,24 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions" - } - @distributed_trace_async async def get( self, resource_group_name: str, private_cloud_name: str, script_execution_name: str, **kwargs: Any ) -> _models.ScriptExecution: - """Get an script execution by name in a private cloud. - - Get an script execution by name in a private cloud. + """Get a ScriptExecution. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param script_execution_name: Name of the user-invoked script execution resource. Required. + :param script_execution_name: Name of the script cmdlet. Required. :type script_execution_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScriptExecution or the result of cls(response) :rtype: ~azure.mgmt.avs.models.ScriptExecution :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -190,22 +184,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScriptExecution] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, script_execution_name=script_execution_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -218,23 +211,19 @@ async def get( deserialized = self._deserialize("ScriptExecution", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, private_cloud_name: str, script_execution_name: str, - script_execution: Union[_models.ScriptExecution, IO], + script_execution: Union[_models.ScriptExecution, IO[bytes]], **kwargs: Any ) -> _models.ScriptExecution: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -257,7 +246,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(script_execution, "ScriptExecution") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, script_execution_name=script_execution_name, @@ -266,16 +255,15 @@ async def _create_or_update_initial( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -285,21 +273,20 @@ async def _create_or_update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ScriptExecution", pipeline_response) if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = self._deserialize("ScriptExecution", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}" - } - @overload async def begin_create_or_update( self, @@ -311,30 +298,20 @@ async def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ScriptExecution]: - """Create or update a script execution in a private cloud. - - Create or update a script execution in a private cloud. + """Create a ScriptExecution. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param script_execution_name: Name of the user-invoked script execution resource. Required. + :param script_execution_name: Name of the script cmdlet. Required. :type script_execution_name: str - :param script_execution: A script running in the private cloud. Required. + :param script_execution: Resource create parameters. Required. :type script_execution: ~azure.mgmt.avs.models.ScriptExecution :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 ScriptExecution or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.ScriptExecution] @@ -347,35 +324,25 @@ async def begin_create_or_update( resource_group_name: str, private_cloud_name: str, script_execution_name: str, - script_execution: IO, + script_execution: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ScriptExecution]: - """Create or update a script execution in a private cloud. - - Create or update a script execution in a private cloud. + """Create a ScriptExecution. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param script_execution_name: Name of the user-invoked script execution resource. Required. + :param script_execution_name: Name of the script cmdlet. Required. :type script_execution_name: str - :param script_execution: A script running in the private cloud. Required. - :type script_execution: IO + :param script_execution: Resource create parameters. Required. + :type script_execution: IO[bytes] :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 ScriptExecution or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.ScriptExecution] @@ -388,34 +355,21 @@ async def begin_create_or_update( resource_group_name: str, private_cloud_name: str, script_execution_name: str, - script_execution: Union[_models.ScriptExecution, IO], + script_execution: Union[_models.ScriptExecution, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.ScriptExecution]: - """Create or update a script execution in a private cloud. - - Create or update a script execution in a private cloud. + """Create a ScriptExecution. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param script_execution_name: Name of the user-invoked script execution resource. Required. + :param script_execution_name: Name of the script cmdlet. Required. :type script_execution_name: str - :param script_execution: A script running in the private cloud. Is either a ScriptExecution - type or a IO type. Required. - :type script_execution: ~azure.mgmt.avs.models.ScriptExecution 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. + :param script_execution: Resource create parameters. Is either a ScriptExecution type or a + IO[bytes] type. Required. + :type script_execution: ~azure.mgmt.avs.models.ScriptExecution or IO[bytes] :return: An instance of AsyncLROPoller that returns either ScriptExecution or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.ScriptExecution] @@ -448,32 +402,33 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ScriptExecution", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ScriptExecution].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.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}" - } + return AsyncLROPoller[_models.ScriptExecution]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, private_cloud_name: str, script_execution_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -487,22 +442,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, script_execution_name=script_execution_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -512,36 +466,27 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, None, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async async def begin_delete( self, resource_group_name: str, private_cloud_name: str, script_execution_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Cancel a ScriptExecution in a private cloud. - - Cancel a ScriptExecution in a private cloud. + """Delete a ScriptExecution. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param script_execution_name: Name of the user-invoked script execution resource. Required. + :param script_execution_name: Name of the script cmdlet. Required. :type script_execution_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: @@ -569,26 +514,24 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @overload async def get_execution_logs( @@ -608,7 +551,7 @@ async def get_execution_logs( :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param script_execution_name: Name of the user-invoked script execution resource. Required. + :param script_execution_name: Name of the script cmdlet. Required. :type script_execution_name: str :param script_output_stream_type: Name of the desired output stream to return. If not provided, will return all. An empty array will return nothing. Default value is None. @@ -616,7 +559,6 @@ async def get_execution_logs( :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: ScriptExecution or the result of cls(response) :rtype: ~azure.mgmt.avs.models.ScriptExecution :raises ~azure.core.exceptions.HttpResponseError: @@ -628,7 +570,7 @@ async def get_execution_logs( resource_group_name: str, private_cloud_name: str, script_execution_name: str, - script_output_stream_type: Optional[IO] = None, + script_output_stream_type: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -640,15 +582,14 @@ async def get_execution_logs( :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param script_execution_name: Name of the user-invoked script execution resource. Required. + :param script_execution_name: Name of the script cmdlet. Required. :type script_execution_name: str :param script_output_stream_type: Name of the desired output stream to return. If not provided, will return all. An empty array will return nothing. Default value is None. - :type script_output_stream_type: IO + :type script_output_stream_type: IO[bytes] :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: ScriptExecution or the result of cls(response) :rtype: ~azure.mgmt.avs.models.ScriptExecution :raises ~azure.core.exceptions.HttpResponseError: @@ -660,7 +601,7 @@ async def get_execution_logs( resource_group_name: str, private_cloud_name: str, script_execution_name: str, - script_output_stream_type: Optional[Union[List[Union[str, _models.ScriptOutputStreamType]], IO]] = None, + script_output_stream_type: Optional[Union[List[Union[str, _models.ScriptOutputStreamType]], IO[bytes]]] = None, **kwargs: Any ) -> _models.ScriptExecution: """Return the logs for a script execution resource. @@ -670,22 +611,18 @@ async def get_execution_logs( :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param script_execution_name: Name of the user-invoked script execution resource. Required. + :param script_execution_name: Name of the script cmdlet. Required. :type script_execution_name: str :param script_output_stream_type: Name of the desired output stream to return. If not provided, will return all. An empty array will return nothing. Is either a [Union[str, - "_models.ScriptOutputStreamType"]] type or a IO type. Default value is None. + "_models.ScriptOutputStreamType"]] type or a IO[bytes] type. Default value is None. :type script_output_stream_type: list[str or ~azure.mgmt.avs.models.ScriptOutputStreamType] 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 + IO[bytes] :return: ScriptExecution or the result of cls(response) :rtype: ~azure.mgmt.avs.models.ScriptExecution :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -711,7 +648,7 @@ async def get_execution_logs( else: _json = None - request = build_get_execution_logs_request( + _request = build_get_execution_logs_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, script_execution_name=script_execution_name, @@ -720,16 +657,15 @@ async def get_execution_logs( content_type=content_type, json=_json, content=_content, - template_url=self.get_execution_logs.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -742,10 +678,6 @@ async def get_execution_logs( deserialized = self._deserialize("ScriptExecution", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_execution_logs.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}/getExecutionLogs" - } + return deserialized # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_script_packages_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_script_packages_operations.py index 67114362b10d..60c009a42bab 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_script_packages_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_script_packages_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -30,6 +31,10 @@ from ..._vendor import _convert_request from ...operations._script_packages_operations import build_get_request, build_list_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,14 +62,13 @@ def __init__(self, *args, **kwargs) -> None: def list( self, resource_group_name: str, private_cloud_name: str, **kwargs: Any ) -> AsyncIterable["_models.ScriptPackage"]: - """List script packages available to run on the private cloud. + """List ScriptPackage resources by PrivateCloud. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScriptPackage or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.ScriptPackage] :raises ~azure.core.exceptions.HttpResponseError: @@ -75,7 +79,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScriptPackagesList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -86,17 +90,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -108,13 +111,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("ScriptPackagesList", pipeline_response) @@ -124,11 +127,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -141,29 +144,24 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages" - } - @distributed_trace_async async def get( self, resource_group_name: str, private_cloud_name: str, script_package_name: str, **kwargs: Any ) -> _models.ScriptPackage: - """Get a script package available to run on a private cloud. + """Get a ScriptPackage. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param script_package_name: Name of the script package in the private cloud. Required. + :param script_package_name: Name of the script package. Required. :type script_package_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScriptPackage or the result of cls(response) :rtype: ~azure.mgmt.avs.models.ScriptPackage :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -177,22 +175,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScriptPackage] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, script_package_name=script_package_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -205,10 +202,6 @@ async def get( deserialized = self._deserialize("ScriptPackage", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}" - } + return deserialized # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_virtual_machines_operations.py index 517da4f491f7..4328beb7d5ba 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_virtual_machines_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -37,6 +38,10 @@ build_restrict_movement_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,18 +69,15 @@ def __init__(self, *args, **kwargs) -> None: def list( self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any ) -> AsyncIterable["_models.VirtualMachine"]: - """List of virtual machines in a private cloud cluster. - - List of virtual machines in a private cloud cluster. + """List VirtualMachine resources by Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: 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 VirtualMachine or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.VirtualMachine] :raises ~azure.core.exceptions.HttpResponseError: @@ -86,7 +88,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachinesList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -97,18 +99,17 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cluster_name=cluster_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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -120,13 +121,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("VirtualMachinesList", pipeline_response) @@ -136,11 +137,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -153,10 +154,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines" - } - @distributed_trace_async async def get( self, @@ -166,25 +163,22 @@ async def get( virtual_machine_id: str, **kwargs: Any ) -> _models.VirtualMachine: - """Get a virtual machine by id in a private cloud cluster. - - Get a virtual machine by id in a private cloud cluster. + """Get a VirtualMachine. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param virtual_machine_id: Virtual Machine identifier. Required. + :param virtual_machine_id: ID of the virtual machine. Required. :type virtual_machine_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine or the result of cls(response) :rtype: ~azure.mgmt.avs.models.VirtualMachine :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -198,23 +192,22 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cluster_name=cluster_name, virtual_machine_id=virtual_machine_id, 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -227,13 +220,9 @@ async def get( deserialized = self._deserialize("VirtualMachine", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId}" - } + return deserialized # type: ignore async def _restrict_movement_initial( # pylint: disable=inconsistent-return-statements self, @@ -241,10 +230,10 @@ async def _restrict_movement_initial( # pylint: disable=inconsistent-return-sta private_cloud_name: str, cluster_name: str, virtual_machine_id: str, - restrict_movement: Union[_models.VirtualMachineRestrictMovement, IO], + restrict_movement: Union[_models.VirtualMachineRestrictMovement, IO[bytes]], **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -267,7 +256,7 @@ async def _restrict_movement_initial( # pylint: disable=inconsistent-return-sta else: _json = self._serialize.body(restrict_movement, "VirtualMachineRestrictMovement") - request = build_restrict_movement_request( + _request = build_restrict_movement_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cluster_name=cluster_name, @@ -277,16 +266,15 @@ async def _restrict_movement_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, content=_content, - template_url=self._restrict_movement_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -296,12 +284,12 @@ async def _restrict_movement_initial( # pylint: disable=inconsistent-return-sta 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, {}) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _restrict_movement_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId}/restrictMovement" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @overload async def begin_restrict_movement( @@ -317,31 +305,20 @@ async def begin_restrict_movement( ) -> AsyncLROPoller[None]: """Enable or disable DRS-driven VM movement restriction. - Enable or disable DRS-driven VM movement restriction. - :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param virtual_machine_id: Virtual Machine identifier. Required. + :param virtual_machine_id: ID of the virtual machine. Required. :type virtual_machine_id: str - :param restrict_movement: Whether VM DRS-driven movement is restricted (Enabled) or not - (Disabled). Required. + :param restrict_movement: The body type of the operation request. Required. :type restrict_movement: ~azure.mgmt.avs.models.VirtualMachineRestrictMovement :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -354,38 +331,27 @@ async def begin_restrict_movement( private_cloud_name: str, cluster_name: str, virtual_machine_id: str, - restrict_movement: IO, + restrict_movement: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Enable or disable DRS-driven VM movement restriction. - Enable or disable DRS-driven VM movement restriction. - :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param virtual_machine_id: Virtual Machine identifier. Required. + :param virtual_machine_id: ID of the virtual machine. Required. :type virtual_machine_id: str - :param restrict_movement: Whether VM DRS-driven movement is restricted (Enabled) or not - (Disabled). Required. - :type restrict_movement: IO + :param restrict_movement: The body type of the operation request. Required. + :type restrict_movement: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -398,36 +364,23 @@ async def begin_restrict_movement( private_cloud_name: str, cluster_name: str, virtual_machine_id: str, - restrict_movement: Union[_models.VirtualMachineRestrictMovement, IO], + restrict_movement: Union[_models.VirtualMachineRestrictMovement, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Enable or disable DRS-driven VM movement restriction. - Enable or disable DRS-driven VM movement restriction. - :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param virtual_machine_id: Virtual Machine identifier. Required. + :param virtual_machine_id: ID of the virtual machine. Required. :type virtual_machine_id: str - :param restrict_movement: Whether VM DRS-driven movement is restricted (Enabled) or not - (Disabled). Is either a VirtualMachineRestrictMovement type or a IO type. Required. - :type restrict_movement: ~azure.mgmt.avs.models.VirtualMachineRestrictMovement 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. + :param restrict_movement: The body type of the operation request. Is either a + VirtualMachineRestrictMovement type or a IO[bytes] type. Required. + :type restrict_movement: ~azure.mgmt.avs.models.VirtualMachineRestrictMovement or IO[bytes] :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: @@ -459,23 +412,21 @@ async def begin_restrict_movement( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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_restrict_movement.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId}/restrictMovement" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_workload_networks_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_workload_networks_operations.py index ad008bd9c698..ae988ee9dd09 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_workload_networks_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/aio/operations/_workload_networks_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -74,6 +75,10 @@ build_update_vm_group_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -97,95 +102,17 @@ 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, - private_cloud_name: str, - workload_network_name: Union[str, _models.WorkloadNetworkName], - **kwargs: Any - ) -> _models.WorkloadNetwork: - """Get a private cloud workload network. - - Get a private cloud workload network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param private_cloud_name: Name of the private cloud. Required. - :type private_cloud_name: str - :param workload_network_name: Name for the workload network in the private cloud. "default" - Required. - :type workload_network_name: str or ~azure.mgmt.avs.models.WorkloadNetworkName - :keyword callable cls: A custom type or function that will be passed the direct response - :return: WorkloadNetwork or the result of cls(response) - :rtype: ~azure.mgmt.avs.models.WorkloadNetwork - :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.WorkloadNetwork] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - private_cloud_name=private_cloud_name, - workload_network_name=workload_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("WorkloadNetwork", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/{workloadNetworkName}" - } - @distributed_trace def list( self, resource_group_name: str, private_cloud_name: str, **kwargs: Any ) -> AsyncIterable["_models.WorkloadNetwork"]: - """List of workload networks in a private cloud. - - List of workload networks in a private cloud. + """List WorkloadNetwork resources by PrivateCloud. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WorkloadNetwork or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetwork] :raises ~azure.core.exceptions.HttpResponseError: @@ -196,7 +123,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WorkloadNetworkList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -207,17 +134,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -229,13 +155,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("WorkloadNetworkList", pipeline_response) @@ -245,11 +171,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -262,36 +188,85 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks" - } + @distributed_trace_async + async def get(self, resource_group_name: str, private_cloud_name: str, **kwargs: Any) -> _models.WorkloadNetwork: + """Get a WorkloadNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. Required. + :type private_cloud_name: str + :return: WorkloadNetwork or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetwork + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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.WorkloadNetwork] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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("WorkloadNetwork", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace - def list_segments( + def list_dhcp( self, resource_group_name: str, private_cloud_name: str, **kwargs: Any - ) -> AsyncIterable["_models.WorkloadNetworkSegment"]: - """List of segments in a private cloud workload network. - - List of segments in a private cloud workload network. + ) -> AsyncIterable["_models.WorkloadNetworkDhcp"]: + """List WorkloadNetworkDhcp resources by WorkloadNetwork. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadNetworkSegment or the result of - cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkSegment] + :return: An iterator like instance of either WorkloadNetworkDhcp or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDhcp] :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.WorkloadNetworkSegmentsList] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkDhcpList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -302,17 +277,16 @@ def list_segments( def prepare_request(next_link=None): if not next_link: - request = build_list_segments_request( + _request = build_list_dhcp_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_segments.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -324,27 +298,27 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("WorkloadNetworkSegmentsList", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDhcpList", 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) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -357,32 +331,24 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_segments.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments" - } - @distributed_trace_async - async def get_segment( - self, resource_group_name: str, private_cloud_name: str, segment_id: str, **kwargs: Any - ) -> _models.WorkloadNetworkSegment: - """Get a segment by id in a private cloud workload network. - - Get a segment by id in a private cloud workload network. + async def get_dhcp( + self, resource_group_name: str, dhcp_id: str, private_cloud_name: str, **kwargs: Any + ) -> _models.WorkloadNetworkDhcp: + """Get a WorkloadNetworkDhcp. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str + :param dhcp_id: The ID of the DHCP configuration. Required. + :type dhcp_id: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param segment_id: NSX Segment identifier. Generally the same as the Segment's display name. - Required. - :type segment_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: WorkloadNetworkSegment or the result of cls(response) - :rtype: ~azure.mgmt.avs.models.WorkloadNetworkSegment + :return: WorkloadNetworkDhcp or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetworkDhcp :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -394,24 +360,23 @@ async def get_segment( _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.WorkloadNetworkSegment] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkDhcp] = kwargs.pop("cls", None) - request = build_get_segment_request( + _request = build_get_dhcp_request( resource_group_name=resource_group_name, + dhcp_id=dhcp_id, private_cloud_name=private_cloud_name, - segment_id=segment_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_segment.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -421,26 +386,22 @@ async def get_segment( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_segment.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}" - } + return deserialized # type: ignore - async def _create_segments_initial( + async def _create_dhcp_initial( self, resource_group_name: str, private_cloud_name: str, - segment_id: str, - workload_network_segment: Union[_models.WorkloadNetworkSegment, IO], + dhcp_id: str, + workload_network_dhcp: Union[_models.WorkloadNetworkDhcp, IO[bytes]], **kwargs: Any - ) -> _models.WorkloadNetworkSegment: - error_map = { + ) -> _models.WorkloadNetworkDhcp: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -453,35 +414,34 @@ async def _create_segments_initial( 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.WorkloadNetworkSegment] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkDhcp] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(workload_network_segment, (IOBase, bytes)): - _content = workload_network_segment + if isinstance(workload_network_dhcp, (IOBase, bytes)): + _content = workload_network_dhcp else: - _json = self._serialize.body(workload_network_segment, "WorkloadNetworkSegment") + _json = self._serialize.body(workload_network_dhcp, "WorkloadNetworkDhcp") - request = build_create_segments_request( + _request = build_create_dhcp_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - segment_id=segment_id, + dhcp_id=dhcp_id, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_segments_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -491,143 +451,106 @@ async def _create_segments_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_segments_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}" - } - @overload - async def begin_create_segments( + async def begin_create_dhcp( self, resource_group_name: str, private_cloud_name: str, - segment_id: str, - workload_network_segment: _models.WorkloadNetworkSegment, + dhcp_id: str, + workload_network_dhcp: _models.WorkloadNetworkDhcp, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkSegment]: - """Create a segment by id in a private cloud workload network. - - Create a segment by id in a private cloud workload network. + ) -> AsyncLROPoller[_models.WorkloadNetworkDhcp]: + """Create a WorkloadNetworkDhcp. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param segment_id: NSX Segment identifier. Generally the same as the Segment's display name. - Required. - :type segment_id: str - :param workload_network_segment: NSX Segment. Required. - :type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment + :param dhcp_id: The ID of the DHCP configuration. Required. + :type dhcp_id: str + :param workload_network_dhcp: Resource create parameters. Required. + :type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp :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 WorkloadNetworkSegment or the result - of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment] + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkDhcp or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_segments( + async def begin_create_dhcp( self, resource_group_name: str, private_cloud_name: str, - segment_id: str, - workload_network_segment: IO, + dhcp_id: str, + workload_network_dhcp: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkSegment]: - """Create a segment by id in a private cloud workload network. - - Create a segment by id in a private cloud workload network. + ) -> AsyncLROPoller[_models.WorkloadNetworkDhcp]: + """Create a WorkloadNetworkDhcp. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param segment_id: NSX Segment identifier. Generally the same as the Segment's display name. - Required. - :type segment_id: str - :param workload_network_segment: NSX Segment. Required. - :type workload_network_segment: IO + :param dhcp_id: The ID of the DHCP configuration. Required. + :type dhcp_id: str + :param workload_network_dhcp: Resource create parameters. Required. + :type workload_network_dhcp: IO[bytes] :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 WorkloadNetworkSegment or the result - of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment] + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkDhcp or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_segments( + async def begin_create_dhcp( self, resource_group_name: str, private_cloud_name: str, - segment_id: str, - workload_network_segment: Union[_models.WorkloadNetworkSegment, IO], + dhcp_id: str, + workload_network_dhcp: Union[_models.WorkloadNetworkDhcp, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkSegment]: - """Create a segment by id in a private cloud workload network. - - Create a segment by id in a private cloud workload network. + ) -> AsyncLROPoller[_models.WorkloadNetworkDhcp]: + """Create a WorkloadNetworkDhcp. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param segment_id: NSX Segment identifier. Generally the same as the Segment's display name. - Required. - :type segment_id: str - :param workload_network_segment: NSX Segment. Is either a WorkloadNetworkSegment type or a IO - type. Required. - :type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment 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 WorkloadNetworkSegment or the result - of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment] + :param dhcp_id: The ID of the DHCP configuration. Required. + :type dhcp_id: str + :param workload_network_dhcp: Resource create parameters. Is either a WorkloadNetworkDhcp type + or a IO[bytes] type. Required. + :type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp or IO[bytes] + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkDhcp or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -635,16 +558,16 @@ async def begin_create_segments( 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.WorkloadNetworkSegment] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkDhcp] = 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_segments_initial( + raw_result = await self._create_dhcp_initial( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - segment_id=segment_id, - workload_network_segment=workload_network_segment, + dhcp_id=dhcp_id, + workload_network_dhcp=workload_network_dhcp, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -655,39 +578,40 @@ async def begin_create_segments( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.WorkloadNetworkDhcp].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_segments.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}" - } + return AsyncLROPoller[_models.WorkloadNetworkDhcp]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _update_segments_initial( + async def _update_dhcp_initial( self, resource_group_name: str, private_cloud_name: str, - segment_id: str, - workload_network_segment: Union[_models.WorkloadNetworkSegment, IO], + dhcp_id: str, + workload_network_dhcp: Union[_models.WorkloadNetworkDhcp, IO[bytes]], **kwargs: Any - ) -> Optional[_models.WorkloadNetworkSegment]: - error_map = { + ) -> Optional[_models.WorkloadNetworkDhcp]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -700,35 +624,34 @@ async def _update_segments_initial( 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.WorkloadNetworkSegment]] = kwargs.pop("cls", None) + cls: ClsType[Optional[_models.WorkloadNetworkDhcp]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(workload_network_segment, (IOBase, bytes)): - _content = workload_network_segment + if isinstance(workload_network_dhcp, (IOBase, bytes)): + _content = workload_network_dhcp else: - _json = self._serialize.body(workload_network_segment, "WorkloadNetworkSegment") + _json = self._serialize.body(workload_network_dhcp, "WorkloadNetworkDhcp") - request = build_update_segments_request( + _request = build_update_dhcp_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - segment_id=segment_id, + dhcp_id=dhcp_id, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._update_segments_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -739,140 +662,105 @@ async def _update_segments_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - return deserialized + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _update_segments_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}" - } + return deserialized # type: ignore @overload - async def begin_update_segments( + async def begin_update_dhcp( self, resource_group_name: str, private_cloud_name: str, - segment_id: str, - workload_network_segment: _models.WorkloadNetworkSegment, + dhcp_id: str, + workload_network_dhcp: _models.WorkloadNetworkDhcp, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkSegment]: - """Create or update a segment by id in a private cloud workload network. - - Create or update a segment by id in a private cloud workload network. + ) -> AsyncLROPoller[_models.WorkloadNetworkDhcp]: + """Update a WorkloadNetworkDhcp. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param segment_id: NSX Segment identifier. Generally the same as the Segment's display name. - Required. - :type segment_id: str - :param workload_network_segment: NSX Segment. Required. - :type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment + :param dhcp_id: The ID of the DHCP configuration. Required. + :type dhcp_id: str + :param workload_network_dhcp: The resource properties to be updated. Required. + :type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp :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 WorkloadNetworkSegment or the result - of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment] + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkDhcp or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update_segments( + async def begin_update_dhcp( self, resource_group_name: str, private_cloud_name: str, - segment_id: str, - workload_network_segment: IO, + dhcp_id: str, + workload_network_dhcp: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkSegment]: - """Create or update a segment by id in a private cloud workload network. - - Create or update a segment by id in a private cloud workload network. + ) -> AsyncLROPoller[_models.WorkloadNetworkDhcp]: + """Update a WorkloadNetworkDhcp. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param segment_id: NSX Segment identifier. Generally the same as the Segment's display name. - Required. - :type segment_id: str - :param workload_network_segment: NSX Segment. Required. - :type workload_network_segment: IO + :param dhcp_id: The ID of the DHCP configuration. Required. + :type dhcp_id: str + :param workload_network_dhcp: The resource properties to be updated. Required. + :type workload_network_dhcp: IO[bytes] :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 WorkloadNetworkSegment or the result - of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment] + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkDhcp or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update_segments( + async def begin_update_dhcp( self, resource_group_name: str, private_cloud_name: str, - segment_id: str, - workload_network_segment: Union[_models.WorkloadNetworkSegment, IO], + dhcp_id: str, + workload_network_dhcp: Union[_models.WorkloadNetworkDhcp, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkSegment]: - """Create or update a segment by id in a private cloud workload network. - - Create or update a segment by id in a private cloud workload network. + ) -> AsyncLROPoller[_models.WorkloadNetworkDhcp]: + """Update a WorkloadNetworkDhcp. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param segment_id: NSX Segment identifier. Generally the same as the Segment's display name. - Required. - :type segment_id: str - :param workload_network_segment: NSX Segment. Is either a WorkloadNetworkSegment type or a IO - type. Required. - :type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment 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 WorkloadNetworkSegment or the result - of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment] + :param dhcp_id: The ID of the DHCP configuration. Required. + :type dhcp_id: str + :param workload_network_dhcp: The resource properties to be updated. Is either a + WorkloadNetworkDhcp type or a IO[bytes] type. Required. + :type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp or IO[bytes] + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkDhcp or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -880,16 +768,16 @@ async def begin_update_segments( 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.WorkloadNetworkSegment] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkDhcp] = 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_segments_initial( + raw_result = await self._update_dhcp_initial( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - segment_id=segment_id, - workload_network_segment=workload_network_segment, + dhcp_id=dhcp_id, + workload_network_dhcp=workload_network_dhcp, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -900,34 +788,34 @@ async def begin_update_segments( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.WorkloadNetworkDhcp].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_segments.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}" - } + return AsyncLROPoller[_models.WorkloadNetworkDhcp]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_segment_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, private_cloud_name: str, segment_id: str, **kwargs: Any + async def _delete_dhcp_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, private_cloud_name: str, dhcp_id: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -941,22 +829,21 @@ async def _delete_segment_initial( # pylint: disable=inconsistent-return-statem 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_segment_request( + _request = build_delete_dhcp_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - segment_id=segment_id, + dhcp_id=dhcp_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_segment_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -966,37 +853,27 @@ async def _delete_segment_initial( # pylint: disable=inconsistent-return-statem 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, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _delete_segment_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async - async def begin_delete_segment( - self, resource_group_name: str, private_cloud_name: str, segment_id: str, **kwargs: Any + async def begin_delete_dhcp( + self, resource_group_name: str, private_cloud_name: str, dhcp_id: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Delete a segment by id in a private cloud workload network. - - Delete a segment by id in a private cloud workload network. + """Delete a WorkloadNetworkDhcp. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param segment_id: NSX Segment identifier. Generally the same as the Segment's display name. - Required. - :type segment_id: 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. + :param dhcp_id: The ID of the DHCP configuration. Required. + :type dhcp_id: str :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: @@ -1010,10 +887,10 @@ async def begin_delete_segment( 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_segment_initial( # type: ignore + raw_result = await self._delete_dhcp_initial( # type: ignore resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - segment_id=segment_id, + dhcp_id=dhcp_id, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -1024,52 +901,49 @@ async def begin_delete_segment( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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_segment.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_dhcp( + def list_dns_services( self, resource_group_name: str, private_cloud_name: str, **kwargs: Any - ) -> AsyncIterable["_models.WorkloadNetworkDhcp"]: - """List dhcp in a private cloud workload network. - - List dhcp in a private cloud workload network. + ) -> AsyncIterable["_models.WorkloadNetworkDnsService"]: + """List WorkloadNetworkDnsService resources by WorkloadNetwork. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadNetworkDhcp or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDhcp] + :return: An iterator like instance of either WorkloadNetworkDnsService or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDnsService] :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.WorkloadNetworkDhcpList] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkDnsServicesList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1080,17 +954,16 @@ def list_dhcp( def prepare_request(next_link=None): if not next_link: - request = build_list_dhcp_request( + _request = build_list_dns_services_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_dhcp.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1102,27 +975,27 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("WorkloadNetworkDhcpList", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDnsServicesList", 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) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1135,31 +1008,24 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_dhcp.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations" - } - @distributed_trace_async - async def get_dhcp( - self, resource_group_name: str, dhcp_id: str, private_cloud_name: str, **kwargs: Any - ) -> _models.WorkloadNetworkDhcp: - """Get dhcp by id in a private cloud workload network. - - Get dhcp by id in a private cloud workload network. + async def get_dns_service( + self, resource_group_name: str, private_cloud_name: str, dns_service_id: str, **kwargs: Any + ) -> _models.WorkloadNetworkDnsService: + """Get a WorkloadNetworkDnsService. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required. - :type dhcp_id: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: WorkloadNetworkDhcp or the result of cls(response) - :rtype: ~azure.mgmt.avs.models.WorkloadNetworkDhcp + :param dns_service_id: ID of the DNS service. Required. + :type dns_service_id: str + :return: WorkloadNetworkDnsService or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetworkDnsService :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1171,24 +1037,23 @@ async def get_dhcp( _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.WorkloadNetworkDhcp] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkDnsService] = kwargs.pop("cls", None) - request = build_get_dhcp_request( + _request = build_get_dns_service_request( resource_group_name=resource_group_name, - dhcp_id=dhcp_id, private_cloud_name=private_cloud_name, + dns_service_id=dns_service_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_dhcp.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1198,26 +1063,22 @@ async def get_dhcp( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_dhcp.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}" - } + return deserialized # type: ignore - async def _create_dhcp_initial( + async def _create_dns_service_initial( self, resource_group_name: str, private_cloud_name: str, - dhcp_id: str, - workload_network_dhcp: Union[_models.WorkloadNetworkDhcp, IO], + dns_service_id: str, + workload_network_dns_service: Union[_models.WorkloadNetworkDnsService, IO[bytes]], **kwargs: Any - ) -> _models.WorkloadNetworkDhcp: - error_map = { + ) -> _models.WorkloadNetworkDnsService: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1230,35 +1091,34 @@ async def _create_dhcp_initial( 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.WorkloadNetworkDhcp] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkDnsService] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(workload_network_dhcp, (IOBase, bytes)): - _content = workload_network_dhcp + if isinstance(workload_network_dns_service, (IOBase, bytes)): + _content = workload_network_dns_service else: - _json = self._serialize.body(workload_network_dhcp, "WorkloadNetworkDhcp") + _json = self._serialize.body(workload_network_dns_service, "WorkloadNetworkDnsService") - request = build_create_dhcp_request( + _request = build_create_dns_service_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - dhcp_id=dhcp_id, + dns_service_id=dns_service_id, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_dhcp_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1268,140 +1128,107 @@ async def _create_dhcp_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_dhcp_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}" - } - @overload - async def begin_create_dhcp( + async def begin_create_dns_service( self, resource_group_name: str, private_cloud_name: str, - dhcp_id: str, - workload_network_dhcp: _models.WorkloadNetworkDhcp, + dns_service_id: str, + workload_network_dns_service: _models.WorkloadNetworkDnsService, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkDhcp]: - """Create dhcp by id in a private cloud workload network. - - Create dhcp by id in a private cloud workload network. + ) -> AsyncLROPoller[_models.WorkloadNetworkDnsService]: + """Create a WorkloadNetworkDnsService. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required. - :type dhcp_id: str - :param workload_network_dhcp: NSX DHCP. Required. - :type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp + :param dns_service_id: ID of the DNS service. Required. + :type dns_service_id: str + :param workload_network_dns_service: Resource create parameters. Required. + :type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService :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 WorkloadNetworkDhcp or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp] + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsService or the + result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_dhcp( + async def begin_create_dns_service( self, resource_group_name: str, private_cloud_name: str, - dhcp_id: str, - workload_network_dhcp: IO, + dns_service_id: str, + workload_network_dns_service: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkDhcp]: - """Create dhcp by id in a private cloud workload network. - - Create dhcp by id in a private cloud workload network. + ) -> AsyncLROPoller[_models.WorkloadNetworkDnsService]: + """Create a WorkloadNetworkDnsService. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required. - :type dhcp_id: str - :param workload_network_dhcp: NSX DHCP. Required. - :type workload_network_dhcp: IO + :param dns_service_id: ID of the DNS service. Required. + :type dns_service_id: str + :param workload_network_dns_service: Resource create parameters. Required. + :type workload_network_dns_service: IO[bytes] :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 WorkloadNetworkDhcp or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp] + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsService or the + result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_dhcp( + async def begin_create_dns_service( self, resource_group_name: str, private_cloud_name: str, - dhcp_id: str, - workload_network_dhcp: Union[_models.WorkloadNetworkDhcp, IO], + dns_service_id: str, + workload_network_dns_service: Union[_models.WorkloadNetworkDnsService, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkDhcp]: - """Create dhcp by id in a private cloud workload network. - - Create dhcp by id in a private cloud workload network. + ) -> AsyncLROPoller[_models.WorkloadNetworkDnsService]: + """Create a WorkloadNetworkDnsService. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required. - :type dhcp_id: str - :param workload_network_dhcp: NSX DHCP. Is either a WorkloadNetworkDhcp type or a IO type. - Required. - :type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp 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 WorkloadNetworkDhcp or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp] + :param dns_service_id: ID of the DNS service. Required. + :type dns_service_id: str + :param workload_network_dns_service: Resource create parameters. Is either a + WorkloadNetworkDnsService type or a IO[bytes] type. Required. + :type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsService or the + result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -1409,16 +1236,16 @@ async def begin_create_dhcp( 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.WorkloadNetworkDhcp] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkDnsService] = 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_dhcp_initial( + raw_result = await self._create_dns_service_initial( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - dhcp_id=dhcp_id, - workload_network_dhcp=workload_network_dhcp, + dns_service_id=dns_service_id, + workload_network_dns_service=workload_network_dns_service, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -1429,39 +1256,40 @@ async def begin_create_dhcp( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.WorkloadNetworkDnsService].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_dhcp.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}" - } + return AsyncLROPoller[_models.WorkloadNetworkDnsService]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _update_dhcp_initial( + async def _update_dns_service_initial( self, resource_group_name: str, private_cloud_name: str, - dhcp_id: str, - workload_network_dhcp: Union[_models.WorkloadNetworkDhcp, IO], + dns_service_id: str, + workload_network_dns_service: Union[_models.WorkloadNetworkDnsService, IO[bytes]], **kwargs: Any - ) -> Optional[_models.WorkloadNetworkDhcp]: - error_map = { + ) -> Optional[_models.WorkloadNetworkDnsService]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1474,35 +1302,34 @@ async def _update_dhcp_initial( 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.WorkloadNetworkDhcp]] = kwargs.pop("cls", None) + cls: ClsType[Optional[_models.WorkloadNetworkDnsService]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(workload_network_dhcp, (IOBase, bytes)): - _content = workload_network_dhcp + if isinstance(workload_network_dns_service, (IOBase, bytes)): + _content = workload_network_dns_service else: - _json = self._serialize.body(workload_network_dhcp, "WorkloadNetworkDhcp") + _json = self._serialize.body(workload_network_dns_service, "WorkloadNetworkDnsService") - request = build_update_dhcp_request( + _request = build_update_dns_service_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - dhcp_id=dhcp_id, + dns_service_id=dns_service_id, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._update_dhcp_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1513,137 +1340,106 @@ async def _update_dhcp_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - return deserialized + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _update_dhcp_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}" - } + return deserialized # type: ignore @overload - async def begin_update_dhcp( + async def begin_update_dns_service( self, resource_group_name: str, private_cloud_name: str, - dhcp_id: str, - workload_network_dhcp: _models.WorkloadNetworkDhcp, + dns_service_id: str, + workload_network_dns_service: _models.WorkloadNetworkDnsService, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkDhcp]: - """Create or update dhcp by id in a private cloud workload network. - - Create or update dhcp by id in a private cloud workload network. + ) -> AsyncLROPoller[_models.WorkloadNetworkDnsService]: + """Update a WorkloadNetworkDnsService. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required. - :type dhcp_id: str - :param workload_network_dhcp: NSX DHCP. Required. - :type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp + :param dns_service_id: ID of the DNS service. Required. + :type dns_service_id: str + :param workload_network_dns_service: The resource properties to be updated. Required. + :type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService :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 WorkloadNetworkDhcp or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp] + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsService or the + result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update_dhcp( + async def begin_update_dns_service( self, resource_group_name: str, private_cloud_name: str, - dhcp_id: str, - workload_network_dhcp: IO, + dns_service_id: str, + workload_network_dns_service: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkDhcp]: - """Create or update dhcp by id in a private cloud workload network. - - Create or update dhcp by id in a private cloud workload network. + ) -> AsyncLROPoller[_models.WorkloadNetworkDnsService]: + """Update a WorkloadNetworkDnsService. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required. - :type dhcp_id: str - :param workload_network_dhcp: NSX DHCP. Required. - :type workload_network_dhcp: IO + :param dns_service_id: ID of the DNS service. Required. + :type dns_service_id: str + :param workload_network_dns_service: The resource properties to be updated. Required. + :type workload_network_dns_service: IO[bytes] :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 WorkloadNetworkDhcp or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp] + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsService or the + result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update_dhcp( + async def begin_update_dns_service( self, resource_group_name: str, private_cloud_name: str, - dhcp_id: str, - workload_network_dhcp: Union[_models.WorkloadNetworkDhcp, IO], + dns_service_id: str, + workload_network_dns_service: Union[_models.WorkloadNetworkDnsService, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkDhcp]: - """Create or update dhcp by id in a private cloud workload network. - - Create or update dhcp by id in a private cloud workload network. + ) -> AsyncLROPoller[_models.WorkloadNetworkDnsService]: + """Update a WorkloadNetworkDnsService. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required. - :type dhcp_id: str - :param workload_network_dhcp: NSX DHCP. Is either a WorkloadNetworkDhcp type or a IO type. - Required. - :type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp 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 WorkloadNetworkDhcp or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp] + :param dns_service_id: ID of the DNS service. Required. + :type dns_service_id: str + :param workload_network_dns_service: The resource properties to be updated. Is either a + WorkloadNetworkDnsService type or a IO[bytes] type. Required. + :type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsService or the + result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -1651,16 +1447,16 @@ async def begin_update_dhcp( 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.WorkloadNetworkDhcp] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkDnsService] = 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_dhcp_initial( + raw_result = await self._update_dns_service_initial( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - dhcp_id=dhcp_id, - workload_network_dhcp=workload_network_dhcp, + dns_service_id=dns_service_id, + workload_network_dns_service=workload_network_dns_service, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -1671,34 +1467,34 @@ async def begin_update_dhcp( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.WorkloadNetworkDnsService].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_dhcp.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}" - } + return AsyncLROPoller[_models.WorkloadNetworkDnsService]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_dhcp_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, private_cloud_name: str, dhcp_id: str, **kwargs: Any + async def _delete_dns_service_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, dns_service_id: str, private_cloud_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1712,22 +1508,21 @@ async def _delete_dhcp_initial( # pylint: disable=inconsistent-return-statement 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_dhcp_request( + _request = build_delete_dns_service_request( resource_group_name=resource_group_name, + dns_service_id=dns_service_id, private_cloud_name=private_cloud_name, - dhcp_id=dhcp_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_dhcp_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1737,36 +1532,27 @@ async def _delete_dhcp_initial( # pylint: disable=inconsistent-return-statement 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, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _delete_dhcp_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async - async def begin_delete_dhcp( - self, resource_group_name: str, private_cloud_name: str, dhcp_id: str, **kwargs: Any + async def begin_delete_dns_service( + self, resource_group_name: str, dns_service_id: str, private_cloud_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Delete dhcp by id in a private cloud workload network. - - Delete dhcp by id in a private cloud workload network. + """Delete a WorkloadNetworkDnsService. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str + :param dns_service_id: ID of the DNS service. Required. + :type dns_service_id: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required. - :type dhcp_id: 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: @@ -1780,10 +1566,10 @@ async def begin_delete_dhcp( 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_dhcp_initial( # type: ignore + raw_result = await self._delete_dns_service_initial( # type: ignore resource_group_name=resource_group_name, + dns_service_id=dns_service_id, private_cloud_name=private_cloud_name, - dhcp_id=dhcp_id, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -1794,220 +1580,48 @@ async def begin_delete_dhcp( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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_dhcp.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}" - } - - @distributed_trace - def list_gateways( - self, resource_group_name: str, private_cloud_name: str, **kwargs: Any - ) -> AsyncIterable["_models.WorkloadNetworkGateway"]: - """List of gateways in a private cloud workload network. - - List of gateways in a private cloud workload network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param private_cloud_name: Name of the private cloud. Required. - :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadNetworkGateway or the result of - cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkGateway] - :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.WorkloadNetworkGatewayList] = 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_gateways_request( - resource_group_name=resource_group_name, - private_cloud_name=private_cloud_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_gateways.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("WorkloadNetworkGatewayList", 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_gateways.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways" - } - - @distributed_trace_async - async def get_gateway( - self, resource_group_name: str, private_cloud_name: str, gateway_id: str, **kwargs: Any - ) -> _models.WorkloadNetworkGateway: - """Get a gateway by id in a private cloud workload network. - - Get a gateway by id in a private cloud workload network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param private_cloud_name: Name of the private cloud. Required. - :type private_cloud_name: str - :param gateway_id: NSX Gateway identifier. Generally the same as the Gateway's display name. - Required. - :type gateway_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: WorkloadNetworkGateway or the result of cls(response) - :rtype: ~azure.mgmt.avs.models.WorkloadNetworkGateway - :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.WorkloadNetworkGateway] = kwargs.pop("cls", None) - - request = build_get_gateway_request( - resource_group_name=resource_group_name, - private_cloud_name=private_cloud_name, - gateway_id=gateway_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get_gateway.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("WorkloadNetworkGateway", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_gateway.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways/{gatewayId}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_port_mirroring( + def list_dns_zones( self, resource_group_name: str, private_cloud_name: str, **kwargs: Any - ) -> AsyncIterable["_models.WorkloadNetworkPortMirroring"]: - """List of port mirroring profiles in a private cloud workload network. - - List of port mirroring profiles in a private cloud workload network. + ) -> AsyncIterable["_models.WorkloadNetworkDnsZone"]: + """List WorkloadNetworkDnsZone resources by WorkloadNetwork. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadNetworkPortMirroring or the result of + :return: An iterator like instance of either WorkloadNetworkDnsZone or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] :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.WorkloadNetworkPortMirroringList] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkDnsZonesList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2018,17 +1632,16 @@ def list_port_mirroring( def prepare_request(next_link=None): if not next_link: - request = build_list_port_mirroring_request( + _request = build_list_dns_zones_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_port_mirroring.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -2040,27 +1653,27 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("WorkloadNetworkPortMirroringList", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDnsZonesList", 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) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2073,32 +1686,24 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_port_mirroring.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles" - } - @distributed_trace_async - async def get_port_mirroring( - self, resource_group_name: str, private_cloud_name: str, port_mirroring_id: str, **kwargs: Any - ) -> _models.WorkloadNetworkPortMirroring: - """Get a port mirroring profile by id in a private cloud workload network. - - Get a port mirroring profile by id in a private cloud workload network. + async def get_dns_zone( + self, resource_group_name: str, private_cloud_name: str, dns_zone_id: str, **kwargs: Any + ) -> _models.WorkloadNetworkDnsZone: + """Get a WorkloadNetworkDnsZone. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port - Mirroring display name. Required. - :type port_mirroring_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: WorkloadNetworkPortMirroring or the result of cls(response) - :rtype: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring + :param dns_zone_id: ID of the DNS zone. Required. + :type dns_zone_id: str + :return: WorkloadNetworkDnsZone or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2110,24 +1715,23 @@ async def get_port_mirroring( _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.WorkloadNetworkPortMirroring] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkDnsZone] = kwargs.pop("cls", None) - request = build_get_port_mirroring_request( + _request = build_get_dns_zone_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - port_mirroring_id=port_mirroring_id, + dns_zone_id=dns_zone_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_port_mirroring.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2137,26 +1741,22 @@ async def get_port_mirroring( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_port_mirroring.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}" - } + return deserialized # type: ignore - async def _create_port_mirroring_initial( + async def _create_dns_zone_initial( self, resource_group_name: str, private_cloud_name: str, - port_mirroring_id: str, - workload_network_port_mirroring: Union[_models.WorkloadNetworkPortMirroring, IO], + dns_zone_id: str, + workload_network_dns_zone: Union[_models.WorkloadNetworkDnsZone, IO[bytes]], **kwargs: Any - ) -> _models.WorkloadNetworkPortMirroring: - error_map = { + ) -> _models.WorkloadNetworkDnsZone: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2169,35 +1769,34 @@ async def _create_port_mirroring_initial( 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.WorkloadNetworkPortMirroring] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkDnsZone] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(workload_network_port_mirroring, (IOBase, bytes)): - _content = workload_network_port_mirroring + if isinstance(workload_network_dns_zone, (IOBase, bytes)): + _content = workload_network_dns_zone else: - _json = self._serialize.body(workload_network_port_mirroring, "WorkloadNetworkPortMirroring") + _json = self._serialize.body(workload_network_dns_zone, "WorkloadNetworkDnsZone") - request = build_create_port_mirroring_request( + _request = build_create_dns_zone_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - port_mirroring_id=port_mirroring_id, + dns_zone_id=dns_zone_id, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_port_mirroring_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2207,144 +1806,106 @@ async def _create_port_mirroring_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_port_mirroring_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}" - } - @overload - async def begin_create_port_mirroring( + async def begin_create_dns_zone( self, resource_group_name: str, private_cloud_name: str, - port_mirroring_id: str, - workload_network_port_mirroring: _models.WorkloadNetworkPortMirroring, + dns_zone_id: str, + workload_network_dns_zone: _models.WorkloadNetworkDnsZone, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkPortMirroring]: - """Create a port mirroring profile by id in a private cloud workload network. - - Create a port mirroring profile by id in a private cloud workload network. + ) -> AsyncLROPoller[_models.WorkloadNetworkDnsZone]: + """Create a WorkloadNetworkDnsZone. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port - Mirroring display name. Required. - :type port_mirroring_id: str - :param workload_network_port_mirroring: NSX port mirroring. Required. - :type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring + :param dns_zone_id: ID of the DNS zone. Required. + :type dns_zone_id: str + :param workload_network_dns_zone: Resource create parameters. Required. + :type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone :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 WorkloadNetworkPortMirroring or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsZone or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_port_mirroring( + async def begin_create_dns_zone( self, resource_group_name: str, private_cloud_name: str, - port_mirroring_id: str, - workload_network_port_mirroring: IO, + dns_zone_id: str, + workload_network_dns_zone: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkPortMirroring]: - """Create a port mirroring profile by id in a private cloud workload network. - - Create a port mirroring profile by id in a private cloud workload network. + ) -> AsyncLROPoller[_models.WorkloadNetworkDnsZone]: + """Create a WorkloadNetworkDnsZone. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port - Mirroring display name. Required. - :type port_mirroring_id: str - :param workload_network_port_mirroring: NSX port mirroring. Required. - :type workload_network_port_mirroring: IO + :param dns_zone_id: ID of the DNS zone. Required. + :type dns_zone_id: str + :param workload_network_dns_zone: Resource create parameters. Required. + :type workload_network_dns_zone: IO[bytes] :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 WorkloadNetworkPortMirroring or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsZone or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_port_mirroring( + async def begin_create_dns_zone( self, resource_group_name: str, private_cloud_name: str, - port_mirroring_id: str, - workload_network_port_mirroring: Union[_models.WorkloadNetworkPortMirroring, IO], + dns_zone_id: str, + workload_network_dns_zone: Union[_models.WorkloadNetworkDnsZone, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkPortMirroring]: - """Create a port mirroring profile by id in a private cloud workload network. - - Create a port mirroring profile by id in a private cloud workload network. + ) -> AsyncLROPoller[_models.WorkloadNetworkDnsZone]: + """Create a WorkloadNetworkDnsZone. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port - Mirroring display name. Required. - :type port_mirroring_id: str - :param workload_network_port_mirroring: NSX port mirroring. Is either a - WorkloadNetworkPortMirroring type or a IO type. Required. - :type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring 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 WorkloadNetworkPortMirroring or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] + :param dns_zone_id: ID of the DNS zone. Required. + :type dns_zone_id: str + :param workload_network_dns_zone: Resource create parameters. Is either a + WorkloadNetworkDnsZone type or a IO[bytes] type. Required. + :type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone or IO[bytes] + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsZone or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -2352,16 +1913,16 @@ async def begin_create_port_mirroring( 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.WorkloadNetworkPortMirroring] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkDnsZone] = 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_port_mirroring_initial( + raw_result = await self._create_dns_zone_initial( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - port_mirroring_id=port_mirroring_id, - workload_network_port_mirroring=workload_network_port_mirroring, + dns_zone_id=dns_zone_id, + workload_network_dns_zone=workload_network_dns_zone, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -2372,39 +1933,40 @@ async def begin_create_port_mirroring( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.WorkloadNetworkDnsZone].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_port_mirroring.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}" - } + return AsyncLROPoller[_models.WorkloadNetworkDnsZone]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _update_port_mirroring_initial( + async def _update_dns_zone_initial( self, resource_group_name: str, private_cloud_name: str, - port_mirroring_id: str, - workload_network_port_mirroring: Union[_models.WorkloadNetworkPortMirroring, IO], + dns_zone_id: str, + workload_network_dns_zone: Union[_models.WorkloadNetworkDnsZone, IO[bytes]], **kwargs: Any - ) -> Optional[_models.WorkloadNetworkPortMirroring]: - error_map = { + ) -> Optional[_models.WorkloadNetworkDnsZone]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2417,35 +1979,34 @@ async def _update_port_mirroring_initial( 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.WorkloadNetworkPortMirroring]] = kwargs.pop("cls", None) + cls: ClsType[Optional[_models.WorkloadNetworkDnsZone]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(workload_network_port_mirroring, (IOBase, bytes)): - _content = workload_network_port_mirroring + if isinstance(workload_network_dns_zone, (IOBase, bytes)): + _content = workload_network_dns_zone else: - _json = self._serialize.body(workload_network_port_mirroring, "WorkloadNetworkPortMirroring") + _json = self._serialize.body(workload_network_dns_zone, "WorkloadNetworkDnsZone") - request = build_update_port_mirroring_request( + _request = build_update_dns_zone_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - port_mirroring_id=port_mirroring_id, + dns_zone_id=dns_zone_id, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._update_port_mirroring_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2456,141 +2017,105 @@ async def _update_port_mirroring_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - return deserialized + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _update_port_mirroring_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}" - } + return deserialized # type: ignore @overload - async def begin_update_port_mirroring( + async def begin_update_dns_zone( self, resource_group_name: str, private_cloud_name: str, - port_mirroring_id: str, - workload_network_port_mirroring: _models.WorkloadNetworkPortMirroring, + dns_zone_id: str, + workload_network_dns_zone: _models.WorkloadNetworkDnsZone, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkPortMirroring]: - """Create or update a port mirroring profile by id in a private cloud workload network. - - Create or update a port mirroring profile by id in a private cloud workload network. + ) -> AsyncLROPoller[_models.WorkloadNetworkDnsZone]: + """Update a WorkloadNetworkDnsZone. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port - Mirroring display name. Required. - :type port_mirroring_id: str - :param workload_network_port_mirroring: NSX port mirroring. Required. - :type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring + :param dns_zone_id: ID of the DNS zone. Required. + :type dns_zone_id: str + :param workload_network_dns_zone: The resource properties to be updated. Required. + :type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone :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 WorkloadNetworkPortMirroring or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsZone or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update_port_mirroring( + async def begin_update_dns_zone( self, resource_group_name: str, private_cloud_name: str, - port_mirroring_id: str, - workload_network_port_mirroring: IO, + dns_zone_id: str, + workload_network_dns_zone: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkPortMirroring]: - """Create or update a port mirroring profile by id in a private cloud workload network. - - Create or update a port mirroring profile by id in a private cloud workload network. + ) -> AsyncLROPoller[_models.WorkloadNetworkDnsZone]: + """Update a WorkloadNetworkDnsZone. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port - Mirroring display name. Required. - :type port_mirroring_id: str - :param workload_network_port_mirroring: NSX port mirroring. Required. - :type workload_network_port_mirroring: IO + :param dns_zone_id: ID of the DNS zone. Required. + :type dns_zone_id: str + :param workload_network_dns_zone: The resource properties to be updated. Required. + :type workload_network_dns_zone: IO[bytes] :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 WorkloadNetworkPortMirroring or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsZone or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update_port_mirroring( + async def begin_update_dns_zone( self, resource_group_name: str, private_cloud_name: str, - port_mirroring_id: str, - workload_network_port_mirroring: Union[_models.WorkloadNetworkPortMirroring, IO], + dns_zone_id: str, + workload_network_dns_zone: Union[_models.WorkloadNetworkDnsZone, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkPortMirroring]: - """Create or update a port mirroring profile by id in a private cloud workload network. - - Create or update a port mirroring profile by id in a private cloud workload network. + ) -> AsyncLROPoller[_models.WorkloadNetworkDnsZone]: + """Update a WorkloadNetworkDnsZone. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port - Mirroring display name. Required. - :type port_mirroring_id: str - :param workload_network_port_mirroring: NSX port mirroring. Is either a - WorkloadNetworkPortMirroring type or a IO type. Required. - :type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring 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 WorkloadNetworkPortMirroring or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] + :param dns_zone_id: ID of the DNS zone. Required. + :type dns_zone_id: str + :param workload_network_dns_zone: The resource properties to be updated. Is either a + WorkloadNetworkDnsZone type or a IO[bytes] type. Required. + :type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone or IO[bytes] + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsZone or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -2598,16 +2123,16 @@ async def begin_update_port_mirroring( 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.WorkloadNetworkPortMirroring] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkDnsZone] = 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_port_mirroring_initial( + raw_result = await self._update_dns_zone_initial( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - port_mirroring_id=port_mirroring_id, - workload_network_port_mirroring=workload_network_port_mirroring, + dns_zone_id=dns_zone_id, + workload_network_dns_zone=workload_network_dns_zone, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -2618,34 +2143,34 @@ async def begin_update_port_mirroring( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.WorkloadNetworkDnsZone].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_port_mirroring.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}" - } + return AsyncLROPoller[_models.WorkloadNetworkDnsZone]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_port_mirroring_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, port_mirroring_id: str, private_cloud_name: str, **kwargs: Any + async def _delete_dns_zone_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, dns_zone_id: str, private_cloud_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2659,22 +2184,21 @@ async def _delete_port_mirroring_initial( # pylint: disable=inconsistent-return 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_port_mirroring_request( + _request = build_delete_dns_zone_request( resource_group_name=resource_group_name, - port_mirroring_id=port_mirroring_id, + dns_zone_id=dns_zone_id, private_cloud_name=private_cloud_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_port_mirroring_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2684,37 +2208,27 @@ async def _delete_port_mirroring_initial( # pylint: disable=inconsistent-return 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, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _delete_port_mirroring_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async - async def begin_delete_port_mirroring( - self, resource_group_name: str, port_mirroring_id: str, private_cloud_name: str, **kwargs: Any + async def begin_delete_dns_zone( + self, resource_group_name: str, dns_zone_id: str, private_cloud_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Delete a port mirroring profile by id in a private cloud workload network. - - Delete a port mirroring profile by id in a private cloud workload network. + """Delete a WorkloadNetworkDnsZone. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port - Mirroring display name. Required. - :type port_mirroring_id: str + :param dns_zone_id: ID of the DNS zone. Required. + :type dns_zone_id: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_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: @@ -2728,9 +2242,9 @@ async def begin_delete_port_mirroring( 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_port_mirroring_initial( # type: ignore + raw_result = await self._delete_dns_zone_initial( # type: ignore resource_group_name=resource_group_name, - port_mirroring_id=port_mirroring_id, + dns_zone_id=dns_zone_id, private_cloud_name=private_cloud_name, api_version=api_version, cls=lambda x, y, z: x, @@ -2742,53 +2256,48 @@ async def begin_delete_port_mirroring( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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_port_mirroring.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_vm_groups( + def list_gateways( self, resource_group_name: str, private_cloud_name: str, **kwargs: Any - ) -> AsyncIterable["_models.WorkloadNetworkVMGroup"]: - """List of vm groups in a private cloud workload network. - - List of vm groups in a private cloud workload network. + ) -> AsyncIterable["_models.WorkloadNetworkGateway"]: + """List WorkloadNetworkGateway resources by WorkloadNetwork. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadNetworkVMGroup or the result of + :return: An iterator like instance of either WorkloadNetworkGateway or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkGateway] :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.WorkloadNetworkVMGroupsList] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkGatewayList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2799,17 +2308,16 @@ def list_vm_groups( def prepare_request(next_link=None): if not next_link: - request = build_list_vm_groups_request( + _request = build_list_gateways_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_vm_groups.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -2821,27 +2329,27 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("WorkloadNetworkVMGroupsList", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkGatewayList", 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) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2854,32 +2362,24 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_vm_groups.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups" - } - @distributed_trace_async - async def get_vm_group( - self, resource_group_name: str, private_cloud_name: str, vm_group_id: str, **kwargs: Any - ) -> _models.WorkloadNetworkVMGroup: - """Get a vm group by id in a private cloud workload network. - - Get a vm group by id in a private cloud workload network. + async def get_gateway( + self, resource_group_name: str, private_cloud_name: str, gateway_id: str, **kwargs: Any + ) -> _models.WorkloadNetworkGateway: + """Get a WorkloadNetworkGateway. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name. - Required. - :type vm_group_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: WorkloadNetworkVMGroup or the result of cls(response) - :rtype: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup + :param gateway_id: The ID of the NSX Gateway. Required. + :type gateway_id: str + :return: WorkloadNetworkGateway or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetworkGateway :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2891,24 +2391,23 @@ async def get_vm_group( _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.WorkloadNetworkVMGroup] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkGateway] = kwargs.pop("cls", None) - request = build_get_vm_group_request( + _request = build_get_gateway_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - vm_group_id=vm_group_id, + gateway_id=gateway_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_vm_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2918,26 +2417,37 @@ async def get_vm_group( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkGateway", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - get_vm_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}" - } + @distributed_trace + def list_port_mirroring( + self, resource_group_name: str, private_cloud_name: str, **kwargs: Any + ) -> AsyncIterable["_models.WorkloadNetworkPortMirroring"]: + """List WorkloadNetworkPortMirroring resources by WorkloadNetwork. - async def _create_vm_group_initial( - self, - resource_group_name: str, - private_cloud_name: str, - vm_group_id: str, - workload_network_vm_group: Union[_models.WorkloadNetworkVMGroup, IO], - **kwargs: Any - ) -> _models.WorkloadNetworkVMGroup: - error_map = { + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. Required. + :type private_cloud_name: str + :return: An iterator like instance of either WorkloadNetworkPortMirroring or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] + :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.WorkloadNetworkPortMirroringList] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2945,40 +2455,174 @@ async def _create_vm_group_initial( } 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.WorkloadNetworkVMGroup] = kwargs.pop("cls", None) + def prepare_request(next_link=None): + if not next_link: - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(workload_network_vm_group, (IOBase, bytes)): - _content = workload_network_vm_group - else: - _json = self._serialize.body(workload_network_vm_group, "WorkloadNetworkVMGroup") + _request = build_list_port_mirroring_request( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) - request = build_create_vm_group_request( - resource_group_name=resource_group_name, - private_cloud_name=private_cloud_name, - vm_group_id=vm_group_id, + 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("WorkloadNetworkPortMirroringList", 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) + + @distributed_trace_async + async def get_port_mirroring( + self, resource_group_name: str, private_cloud_name: str, port_mirroring_id: str, **kwargs: Any + ) -> _models.WorkloadNetworkPortMirroring: + """Get a WorkloadNetworkPortMirroring. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. Required. + :type private_cloud_name: str + :param port_mirroring_id: ID of the NSX port mirroring profile. Required. + :type port_mirroring_id: str + :return: WorkloadNetworkPortMirroring or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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.WorkloadNetworkPortMirroring] = kwargs.pop("cls", None) + + _request = build_get_port_mirroring_request( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + port_mirroring_id=port_mirroring_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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("WorkloadNetworkPortMirroring", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_port_mirroring_initial( + self, + resource_group_name: str, + private_cloud_name: str, + port_mirroring_id: str, + workload_network_port_mirroring: Union[_models.WorkloadNetworkPortMirroring, IO[bytes]], + **kwargs: Any + ) -> _models.WorkloadNetworkPortMirroring: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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.WorkloadNetworkPortMirroring] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workload_network_port_mirroring, (IOBase, bytes)): + _content = workload_network_port_mirroring + else: + _json = self._serialize.body(workload_network_port_mirroring, "WorkloadNetworkPortMirroring") + + _request = build_create_port_mirroring_request( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + port_mirroring_id=port_mirroring_id, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_vm_group_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2988,143 +2632,107 @@ async def _create_vm_group_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_vm_group_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}" - } - @overload - async def begin_create_vm_group( + async def begin_create_port_mirroring( self, resource_group_name: str, private_cloud_name: str, - vm_group_id: str, - workload_network_vm_group: _models.WorkloadNetworkVMGroup, + port_mirroring_id: str, + workload_network_port_mirroring: _models.WorkloadNetworkPortMirroring, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkVMGroup]: - """Create a vm group by id in a private cloud workload network. - - Create a vm group by id in a private cloud workload network. + ) -> AsyncLROPoller[_models.WorkloadNetworkPortMirroring]: + """Create a WorkloadNetworkPortMirroring. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name. - Required. - :type vm_group_id: str - :param workload_network_vm_group: NSX VM Group. Required. - :type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup + :param port_mirroring_id: ID of the NSX port mirroring profile. Required. + :type port_mirroring_id: str + :param workload_network_port_mirroring: Resource create parameters. Required. + :type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring :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 WorkloadNetworkVMGroup or the result - of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkPortMirroring or the + result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_vm_group( + async def begin_create_port_mirroring( self, resource_group_name: str, private_cloud_name: str, - vm_group_id: str, - workload_network_vm_group: IO, + port_mirroring_id: str, + workload_network_port_mirroring: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkVMGroup]: - """Create a vm group by id in a private cloud workload network. - - Create a vm group by id in a private cloud workload network. + ) -> AsyncLROPoller[_models.WorkloadNetworkPortMirroring]: + """Create a WorkloadNetworkPortMirroring. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name. - Required. - :type vm_group_id: str - :param workload_network_vm_group: NSX VM Group. Required. - :type workload_network_vm_group: IO + :param port_mirroring_id: ID of the NSX port mirroring profile. Required. + :type port_mirroring_id: str + :param workload_network_port_mirroring: Resource create parameters. Required. + :type workload_network_port_mirroring: IO[bytes] :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 WorkloadNetworkVMGroup or the result - of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkPortMirroring or the + result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_vm_group( + async def begin_create_port_mirroring( self, resource_group_name: str, private_cloud_name: str, - vm_group_id: str, - workload_network_vm_group: Union[_models.WorkloadNetworkVMGroup, IO], + port_mirroring_id: str, + workload_network_port_mirroring: Union[_models.WorkloadNetworkPortMirroring, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkVMGroup]: - """Create a vm group by id in a private cloud workload network. - - Create a vm group by id in a private cloud workload network. + ) -> AsyncLROPoller[_models.WorkloadNetworkPortMirroring]: + """Create a WorkloadNetworkPortMirroring. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name. - Required. - :type vm_group_id: str - :param workload_network_vm_group: NSX VM Group. Is either a WorkloadNetworkVMGroup type or a IO - type. Required. - :type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup 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 WorkloadNetworkVMGroup or the result - of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] + :param port_mirroring_id: ID of the NSX port mirroring profile. Required. + :type port_mirroring_id: str + :param workload_network_port_mirroring: Resource create parameters. Is either a + WorkloadNetworkPortMirroring type or a IO[bytes] type. Required. + :type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkPortMirroring or the + result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -3132,16 +2740,16 @@ async def begin_create_vm_group( 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.WorkloadNetworkVMGroup] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkPortMirroring] = 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_vm_group_initial( + raw_result = await self._create_port_mirroring_initial( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - vm_group_id=vm_group_id, - workload_network_vm_group=workload_network_vm_group, + port_mirroring_id=port_mirroring_id, + workload_network_port_mirroring=workload_network_port_mirroring, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -3152,39 +2760,40 @@ async def begin_create_vm_group( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.WorkloadNetworkPortMirroring].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_vm_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}" - } + return AsyncLROPoller[_models.WorkloadNetworkPortMirroring]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _update_vm_group_initial( + async def _update_port_mirroring_initial( self, resource_group_name: str, private_cloud_name: str, - vm_group_id: str, - workload_network_vm_group: Union[_models.WorkloadNetworkVMGroup, IO], + port_mirroring_id: str, + workload_network_port_mirroring: Union[_models.WorkloadNetworkPortMirroring, IO[bytes]], **kwargs: Any - ) -> Optional[_models.WorkloadNetworkVMGroup]: - error_map = { + ) -> Optional[_models.WorkloadNetworkPortMirroring]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3197,35 +2806,34 @@ async def _update_vm_group_initial( 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.WorkloadNetworkVMGroup]] = kwargs.pop("cls", None) + cls: ClsType[Optional[_models.WorkloadNetworkPortMirroring]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(workload_network_vm_group, (IOBase, bytes)): - _content = workload_network_vm_group + if isinstance(workload_network_port_mirroring, (IOBase, bytes)): + _content = workload_network_port_mirroring else: - _json = self._serialize.body(workload_network_vm_group, "WorkloadNetworkVMGroup") + _json = self._serialize.body(workload_network_port_mirroring, "WorkloadNetworkPortMirroring") - request = build_update_vm_group_request( + _request = build_update_port_mirroring_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - vm_group_id=vm_group_id, + port_mirroring_id=port_mirroring_id, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._update_vm_group_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -3236,140 +2844,106 @@ async def _update_vm_group_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - return deserialized + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _update_vm_group_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}" - } + return deserialized # type: ignore @overload - async def begin_update_vm_group( + async def begin_update_port_mirroring( self, resource_group_name: str, private_cloud_name: str, - vm_group_id: str, - workload_network_vm_group: _models.WorkloadNetworkVMGroup, + port_mirroring_id: str, + workload_network_port_mirroring: _models.WorkloadNetworkPortMirroring, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkVMGroup]: - """Create or update a vm group by id in a private cloud workload network. - - Create or update a vm group by id in a private cloud workload network. + ) -> AsyncLROPoller[_models.WorkloadNetworkPortMirroring]: + """Update a WorkloadNetworkPortMirroring. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name. - Required. - :type vm_group_id: str - :param workload_network_vm_group: NSX VM Group. Required. - :type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup + :param port_mirroring_id: ID of the NSX port mirroring profile. Required. + :type port_mirroring_id: str + :param workload_network_port_mirroring: The resource properties to be updated. Required. + :type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring :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 WorkloadNetworkVMGroup or the result - of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkPortMirroring or the + result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update_vm_group( + async def begin_update_port_mirroring( self, resource_group_name: str, private_cloud_name: str, - vm_group_id: str, - workload_network_vm_group: IO, + port_mirroring_id: str, + workload_network_port_mirroring: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkVMGroup]: - """Create or update a vm group by id in a private cloud workload network. - - Create or update a vm group by id in a private cloud workload network. + ) -> AsyncLROPoller[_models.WorkloadNetworkPortMirroring]: + """Update a WorkloadNetworkPortMirroring. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name. - Required. - :type vm_group_id: str - :param workload_network_vm_group: NSX VM Group. Required. - :type workload_network_vm_group: IO + :param port_mirroring_id: ID of the NSX port mirroring profile. Required. + :type port_mirroring_id: str + :param workload_network_port_mirroring: The resource properties to be updated. Required. + :type workload_network_port_mirroring: IO[bytes] :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 WorkloadNetworkVMGroup or the result - of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkPortMirroring or the + result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update_vm_group( + async def begin_update_port_mirroring( self, resource_group_name: str, private_cloud_name: str, - vm_group_id: str, - workload_network_vm_group: Union[_models.WorkloadNetworkVMGroup, IO], + port_mirroring_id: str, + workload_network_port_mirroring: Union[_models.WorkloadNetworkPortMirroring, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkVMGroup]: - """Create or update a vm group by id in a private cloud workload network. - - Create or update a vm group by id in a private cloud workload network. + ) -> AsyncLROPoller[_models.WorkloadNetworkPortMirroring]: + """Update a WorkloadNetworkPortMirroring. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name. - Required. - :type vm_group_id: str - :param workload_network_vm_group: NSX VM Group. Is either a WorkloadNetworkVMGroup type or a IO - type. Required. - :type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup 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 WorkloadNetworkVMGroup or the result - of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] + :param port_mirroring_id: ID of the NSX port mirroring profile. Required. + :type port_mirroring_id: str + :param workload_network_port_mirroring: The resource properties to be updated. Is either a + WorkloadNetworkPortMirroring type or a IO[bytes] type. Required. + :type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkPortMirroring or the + result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -3377,16 +2951,16 @@ async def begin_update_vm_group( 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.WorkloadNetworkVMGroup] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkPortMirroring] = 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_vm_group_initial( + raw_result = await self._update_port_mirroring_initial( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - vm_group_id=vm_group_id, - workload_network_vm_group=workload_network_vm_group, + port_mirroring_id=port_mirroring_id, + workload_network_port_mirroring=workload_network_port_mirroring, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -3397,34 +2971,34 @@ async def begin_update_vm_group( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.WorkloadNetworkPortMirroring].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_vm_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}" - } + return AsyncLROPoller[_models.WorkloadNetworkPortMirroring]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_vm_group_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, vm_group_id: str, private_cloud_name: str, **kwargs: Any + async def _delete_port_mirroring_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, port_mirroring_id: str, private_cloud_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3438,22 +3012,21 @@ async def _delete_vm_group_initial( # pylint: disable=inconsistent-return-state 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_vm_group_request( + _request = build_delete_port_mirroring_request( resource_group_name=resource_group_name, - vm_group_id=vm_group_id, + port_mirroring_id=port_mirroring_id, private_cloud_name=private_cloud_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_vm_group_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -3463,37 +3036,27 @@ async def _delete_vm_group_initial( # pylint: disable=inconsistent-return-state 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, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _delete_vm_group_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async - async def begin_delete_vm_group( - self, resource_group_name: str, vm_group_id: str, private_cloud_name: str, **kwargs: Any + async def begin_delete_port_mirroring( + self, resource_group_name: str, port_mirroring_id: str, private_cloud_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Delete a vm group by id in a private cloud workload network. - - Delete a vm group by id in a private cloud workload network. + """Delete a WorkloadNetworkPortMirroring. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name. - Required. - :type vm_group_id: str + :param port_mirroring_id: ID of the NSX port mirroring profile. Required. + :type port_mirroring_id: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_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: @@ -3507,9 +3070,9 @@ async def begin_delete_vm_group( 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_vm_group_initial( # type: ignore + raw_result = await self._delete_port_mirroring_initial( # type: ignore resource_group_name=resource_group_name, - vm_group_id=vm_group_id, + port_mirroring_id=port_mirroring_id, private_cloud_name=private_cloud_name, api_version=api_version, cls=lambda x, y, z: x, @@ -3521,220 +3084,48 @@ async def begin_delete_vm_group( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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_vm_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}" - } - - @distributed_trace - def list_virtual_machines( - self, resource_group_name: str, private_cloud_name: str, **kwargs: Any - ) -> AsyncIterable["_models.WorkloadNetworkVirtualMachine"]: - """List of virtual machines in a private cloud workload network. - - List of virtual machines in a private cloud workload network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param private_cloud_name: Name of the private cloud. Required. - :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadNetworkVirtualMachine or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkVirtualMachine] - :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.WorkloadNetworkVirtualMachinesList] = 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_virtual_machines_request( - resource_group_name=resource_group_name, - private_cloud_name=private_cloud_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_virtual_machines.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("WorkloadNetworkVirtualMachinesList", 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_virtual_machines.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines" - } - - @distributed_trace_async - async def get_virtual_machine( - self, resource_group_name: str, private_cloud_name: str, virtual_machine_id: str, **kwargs: Any - ) -> _models.WorkloadNetworkVirtualMachine: - """Get a virtual machine by id in a private cloud workload network. - - Get a virtual machine by id in a private cloud workload network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param private_cloud_name: Name of the private cloud. Required. - :type private_cloud_name: str - :param virtual_machine_id: Virtual Machine identifier. Required. - :type virtual_machine_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: WorkloadNetworkVirtualMachine or the result of cls(response) - :rtype: ~azure.mgmt.avs.models.WorkloadNetworkVirtualMachine - :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.WorkloadNetworkVirtualMachine] = kwargs.pop("cls", None) - - request = build_get_virtual_machine_request( - resource_group_name=resource_group_name, - private_cloud_name=private_cloud_name, - virtual_machine_id=virtual_machine_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get_virtual_machine.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("WorkloadNetworkVirtualMachine", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_virtual_machine.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines/{virtualMachineId}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_dns_services( + def list_public_i_ps( self, resource_group_name: str, private_cloud_name: str, **kwargs: Any - ) -> AsyncIterable["_models.WorkloadNetworkDnsService"]: - """List of DNS services in a private cloud workload network. - - List of DNS services in a private cloud workload network. + ) -> AsyncIterable["_models.WorkloadNetworkPublicIP"]: + """List WorkloadNetworkPublicIP resources by WorkloadNetwork. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadNetworkDnsService or the result of + :return: An iterator like instance of either WorkloadNetworkPublicIP or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDnsService] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkPublicIP] :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.WorkloadNetworkDnsServicesList] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkPublicIPsList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3745,17 +3136,16 @@ def list_dns_services( def prepare_request(next_link=None): if not next_link: - request = build_list_dns_services_request( + _request = build_list_public_i_ps_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_dns_services.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -3767,27 +3157,27 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("WorkloadNetworkDnsServicesList", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkPublicIPsList", 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) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -3800,32 +3190,24 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_dns_services.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices" - } - @distributed_trace_async - async def get_dns_service( - self, resource_group_name: str, private_cloud_name: str, dns_service_id: str, **kwargs: Any - ) -> _models.WorkloadNetworkDnsService: - """Get a DNS service by id in a private cloud workload network. - - Get a DNS service by id in a private cloud workload network. + async def get_public_ip( + self, resource_group_name: str, private_cloud_name: str, public_ip_id: str, **kwargs: Any + ) -> _models.WorkloadNetworkPublicIP: + """Get a WorkloadNetworkPublicIP. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's - display name. Required. - :type dns_service_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: WorkloadNetworkDnsService or the result of cls(response) - :rtype: ~azure.mgmt.avs.models.WorkloadNetworkDnsService + :param public_ip_id: ID of the DNS zone. Required. + :type public_ip_id: str + :return: WorkloadNetworkPublicIP or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetworkPublicIP :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3837,24 +3219,23 @@ async def get_dns_service( _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.WorkloadNetworkDnsService] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkPublicIP] = kwargs.pop("cls", None) - request = build_get_dns_service_request( + _request = build_get_public_ip_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - dns_service_id=dns_service_id, + public_ip_id=public_ip_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_dns_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -3864,273 +3245,22 @@ async def get_dns_service( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_dns_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}" - } - - async def _create_dns_service_initial( - self, - resource_group_name: str, - private_cloud_name: str, - dns_service_id: str, - workload_network_dns_service: Union[_models.WorkloadNetworkDnsService, IO], - **kwargs: Any - ) -> _models.WorkloadNetworkDnsService: - 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.WorkloadNetworkDnsService] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(workload_network_dns_service, (IOBase, bytes)): - _content = workload_network_dns_service - else: - _json = self._serialize.body(workload_network_dns_service, "WorkloadNetworkDnsService") - - request = build_create_dns_service_request( - resource_group_name=resource_group_name, - private_cloud_name=private_cloud_name, - dns_service_id=dns_service_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_dns_service_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("WorkloadNetworkDnsService", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkPublicIP", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - _create_dns_service_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}" - } - - @overload - async def begin_create_dns_service( - self, - resource_group_name: str, - private_cloud_name: str, - dns_service_id: str, - workload_network_dns_service: _models.WorkloadNetworkDnsService, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkDnsService]: - """Create a DNS service by id in a private cloud workload network. - - Create a DNS service by id in a private cloud workload network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param private_cloud_name: Name of the private cloud. Required. - :type private_cloud_name: str - :param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's - display name. Required. - :type dns_service_id: str - :param workload_network_dns_service: NSX DNS Service. Required. - :type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService - :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 WorkloadNetworkDnsService or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_dns_service( - self, - resource_group_name: str, - private_cloud_name: str, - dns_service_id: str, - workload_network_dns_service: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkDnsService]: - """Create a DNS service by id in a private cloud workload network. - - Create a DNS service by id in a private cloud workload network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param private_cloud_name: Name of the private cloud. Required. - :type private_cloud_name: str - :param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's - display name. Required. - :type dns_service_id: str - :param workload_network_dns_service: NSX DNS Service. Required. - :type workload_network_dns_service: 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 WorkloadNetworkDnsService or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_dns_service( - self, - resource_group_name: str, - private_cloud_name: str, - dns_service_id: str, - workload_network_dns_service: Union[_models.WorkloadNetworkDnsService, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkDnsService]: - """Create a DNS service by id in a private cloud workload network. - - Create a DNS service by id in a private cloud workload network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param private_cloud_name: Name of the private cloud. Required. - :type private_cloud_name: str - :param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's - display name. Required. - :type dns_service_id: str - :param workload_network_dns_service: NSX DNS Service. Is either a WorkloadNetworkDnsService - type or a IO type. Required. - :type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService 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 WorkloadNetworkDnsService or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService] - :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.WorkloadNetworkDnsService] = 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_dns_service_initial( - resource_group_name=resource_group_name, - private_cloud_name=private_cloud_name, - dns_service_id=dns_service_id, - workload_network_dns_service=workload_network_dns_service, - 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("WorkloadNetworkDnsService", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_dns_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}" - } - - async def _update_dns_service_initial( + async def _create_public_ip_initial( self, resource_group_name: str, private_cloud_name: str, - dns_service_id: str, - workload_network_dns_service: Union[_models.WorkloadNetworkDnsService, IO], + public_ip_id: str, + workload_network_public_ip: Union[_models.WorkloadNetworkPublicIP, IO[bytes]], **kwargs: Any - ) -> Optional[_models.WorkloadNetworkDnsService]: - error_map = { + ) -> _models.WorkloadNetworkPublicIP: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4143,179 +3273,143 @@ async def _update_dns_service_initial( 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.WorkloadNetworkDnsService]] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkPublicIP] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(workload_network_dns_service, (IOBase, bytes)): - _content = workload_network_dns_service + if isinstance(workload_network_public_ip, (IOBase, bytes)): + _content = workload_network_public_ip else: - _json = self._serialize.body(workload_network_dns_service, "WorkloadNetworkDnsService") + _json = self._serialize.body(workload_network_public_ip, "WorkloadNetworkPublicIP") - request = build_update_dns_service_request( + _request = build_create_public_ip_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - dns_service_id=dns_service_id, + public_ip_id=public_ip_id, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._update_dns_service_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: + 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) - deserialized = None + response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkPublicIP", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("WorkloadNetworkPublicIP", pipeline_response) - return deserialized + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _update_dns_service_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}" - } + return deserialized # type: ignore @overload - async def begin_update_dns_service( + async def begin_create_public_ip( self, resource_group_name: str, private_cloud_name: str, - dns_service_id: str, - workload_network_dns_service: _models.WorkloadNetworkDnsService, + public_ip_id: str, + workload_network_public_ip: _models.WorkloadNetworkPublicIP, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkDnsService]: - """Create or update a DNS service by id in a private cloud workload network. - - Create or update a DNS service by id in a private cloud workload network. + ) -> AsyncLROPoller[_models.WorkloadNetworkPublicIP]: + """Create a WorkloadNetworkPublicIP. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's - display name. Required. - :type dns_service_id: str - :param workload_network_dns_service: NSX DNS Service. Required. - :type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService + :param public_ip_id: ID of the DNS zone. Required. + :type public_ip_id: str + :param workload_network_public_ip: Resource create parameters. Required. + :type workload_network_public_ip: ~azure.mgmt.avs.models.WorkloadNetworkPublicIP :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 WorkloadNetworkDnsService or the + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkPublicIP or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPublicIP] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update_dns_service( + async def begin_create_public_ip( self, resource_group_name: str, private_cloud_name: str, - dns_service_id: str, - workload_network_dns_service: IO, + public_ip_id: str, + workload_network_public_ip: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkDnsService]: - """Create or update a DNS service by id in a private cloud workload network. - - Create or update a DNS service by id in a private cloud workload network. + ) -> AsyncLROPoller[_models.WorkloadNetworkPublicIP]: + """Create a WorkloadNetworkPublicIP. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's - display name. Required. - :type dns_service_id: str - :param workload_network_dns_service: NSX DNS Service. Required. - :type workload_network_dns_service: IO + :param public_ip_id: ID of the DNS zone. Required. + :type public_ip_id: str + :param workload_network_public_ip: Resource create parameters. Required. + :type workload_network_public_ip: IO[bytes] :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 WorkloadNetworkDnsService or the + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkPublicIP or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPublicIP] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update_dns_service( + async def begin_create_public_ip( self, resource_group_name: str, private_cloud_name: str, - dns_service_id: str, - workload_network_dns_service: Union[_models.WorkloadNetworkDnsService, IO], + public_ip_id: str, + workload_network_public_ip: Union[_models.WorkloadNetworkPublicIP, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkDnsService]: - """Create or update a DNS service by id in a private cloud workload network. - - Create or update a DNS service by id in a private cloud workload network. + ) -> AsyncLROPoller[_models.WorkloadNetworkPublicIP]: + """Create a WorkloadNetworkPublicIP. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's - display name. Required. - :type dns_service_id: str - :param workload_network_dns_service: NSX DNS Service. Is either a WorkloadNetworkDnsService - type or a IO type. Required. - :type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService 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 WorkloadNetworkDnsService or the + :param public_ip_id: ID of the DNS zone. Required. + :type public_ip_id: str + :param workload_network_public_ip: Resource create parameters. Is either a + WorkloadNetworkPublicIP type or a IO[bytes] type. Required. + :type workload_network_public_ip: ~azure.mgmt.avs.models.WorkloadNetworkPublicIP or IO[bytes] + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkPublicIP or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPublicIP] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -4323,16 +3417,16 @@ async def begin_update_dns_service( 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.WorkloadNetworkDnsService] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkPublicIP] = 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_dns_service_initial( + raw_result = await self._create_public_ip_initial( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - dns_service_id=dns_service_id, - workload_network_dns_service=workload_network_dns_service, + public_ip_id=public_ip_id, + workload_network_public_ip=workload_network_public_ip, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -4343,34 +3437,35 @@ async def begin_update_dns_service( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkPublicIP", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.WorkloadNetworkPublicIP].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_dns_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}" - } + return AsyncLROPoller[_models.WorkloadNetworkPublicIP]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_dns_service_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, dns_service_id: str, private_cloud_name: str, **kwargs: Any + async def _delete_public_ip_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, public_ip_id: str, private_cloud_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4384,22 +3479,21 @@ async def _delete_dns_service_initial( # pylint: disable=inconsistent-return-st 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_dns_service_request( + _request = build_delete_public_ip_request( resource_group_name=resource_group_name, - dns_service_id=dns_service_id, + public_ip_id=public_ip_id, private_cloud_name=private_cloud_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_dns_service_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -4409,37 +3503,27 @@ async def _delete_dns_service_initial( # pylint: disable=inconsistent-return-st 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, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _delete_dns_service_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async - async def begin_delete_dns_service( - self, resource_group_name: str, dns_service_id: str, private_cloud_name: str, **kwargs: Any + async def begin_delete_public_ip( + self, resource_group_name: str, public_ip_id: str, private_cloud_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Delete a DNS service by id in a private cloud workload network. - - Delete a DNS service by id in a private cloud workload network. + """Delete a WorkloadNetworkPublicIP. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's - display name. Required. - :type dns_service_id: str + :param public_ip_id: ID of the DNS zone. Required. + :type public_ip_id: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_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: @@ -4453,9 +3537,9 @@ async def begin_delete_dns_service( 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_dns_service_initial( # type: ignore + raw_result = await self._delete_public_ip_initial( # type: ignore resource_group_name=resource_group_name, - dns_service_id=dns_service_id, + public_ip_id=public_ip_id, private_cloud_name=private_cloud_name, api_version=api_version, cls=lambda x, y, z: x, @@ -4467,53 +3551,48 @@ async def begin_delete_dns_service( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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_dns_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_dns_zones( + def list_segments( self, resource_group_name: str, private_cloud_name: str, **kwargs: Any - ) -> AsyncIterable["_models.WorkloadNetworkDnsZone"]: - """List of DNS zones in a private cloud workload network. - - List of DNS zones in a private cloud workload network. + ) -> AsyncIterable["_models.WorkloadNetworkSegment"]: + """List WorkloadNetworkSegment resources by WorkloadNetwork. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadNetworkDnsZone or the result of + :return: An iterator like instance of either WorkloadNetworkSegment or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkSegment] :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.WorkloadNetworkDnsZonesList] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkSegmentsList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4524,17 +3603,16 @@ def list_dns_zones( def prepare_request(next_link=None): if not next_link: - request = build_list_dns_zones_request( + _request = build_list_segments_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_dns_zones.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -4546,27 +3624,27 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("WorkloadNetworkDnsZonesList", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkSegmentsList", 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) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -4579,32 +3657,24 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_dns_zones.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones" - } - @distributed_trace_async - async def get_dns_zone( - self, resource_group_name: str, private_cloud_name: str, dns_zone_id: str, **kwargs: Any - ) -> _models.WorkloadNetworkDnsZone: - """Get a DNS zone by id in a private cloud workload network. - - Get a DNS zone by id in a private cloud workload network. + async def get_segment( + self, resource_group_name: str, private_cloud_name: str, segment_id: str, **kwargs: Any + ) -> _models.WorkloadNetworkSegment: + """Get a WorkloadNetworkSegment. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. - Required. - :type dns_zone_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: WorkloadNetworkDnsZone or the result of cls(response) - :rtype: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone + :param segment_id: The ID of the NSX Segment. Required. + :type segment_id: str + :return: WorkloadNetworkSegment or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetworkSegment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4616,24 +3686,23 @@ async def get_dns_zone( _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.WorkloadNetworkDnsZone] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkSegment] = kwargs.pop("cls", None) - request = build_get_dns_zone_request( + _request = build_get_segment_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - dns_zone_id=dns_zone_id, + segment_id=segment_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_dns_zone.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -4643,26 +3712,22 @@ async def get_dns_zone( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_dns_zone.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}" - } + return deserialized # type: ignore - async def _create_dns_zone_initial( + async def _create_segments_initial( self, resource_group_name: str, private_cloud_name: str, - dns_zone_id: str, - workload_network_dns_zone: Union[_models.WorkloadNetworkDnsZone, IO], + segment_id: str, + workload_network_segment: Union[_models.WorkloadNetworkSegment, IO[bytes]], **kwargs: Any - ) -> _models.WorkloadNetworkDnsZone: - error_map = { + ) -> _models.WorkloadNetworkSegment: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4675,35 +3740,34 @@ async def _create_dns_zone_initial( 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.WorkloadNetworkDnsZone] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkSegment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(workload_network_dns_zone, (IOBase, bytes)): - _content = workload_network_dns_zone + if isinstance(workload_network_segment, (IOBase, bytes)): + _content = workload_network_segment else: - _json = self._serialize.body(workload_network_dns_zone, "WorkloadNetworkDnsZone") + _json = self._serialize.body(workload_network_segment, "WorkloadNetworkSegment") - request = build_create_dns_zone_request( + _request = build_create_segments_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - dns_zone_id=dns_zone_id, + segment_id=segment_id, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_dns_zone_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -4713,143 +3777,106 @@ async def _create_dns_zone_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_dns_zone_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}" - } - @overload - async def begin_create_dns_zone( + async def begin_create_segments( self, resource_group_name: str, private_cloud_name: str, - dns_zone_id: str, - workload_network_dns_zone: _models.WorkloadNetworkDnsZone, + segment_id: str, + workload_network_segment: _models.WorkloadNetworkSegment, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkDnsZone]: - """Create a DNS zone by id in a private cloud workload network. - - Create a DNS zone by id in a private cloud workload network. + ) -> AsyncLROPoller[_models.WorkloadNetworkSegment]: + """Create a WorkloadNetworkSegment. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. - Required. - :type dns_zone_id: str - :param workload_network_dns_zone: NSX DNS Zone. Required. - :type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone + :param segment_id: The ID of the NSX Segment. Required. + :type segment_id: str + :param workload_network_segment: Resource create parameters. Required. + :type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment :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 WorkloadNetworkDnsZone or the result + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkSegment or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_dns_zone( + async def begin_create_segments( self, resource_group_name: str, private_cloud_name: str, - dns_zone_id: str, - workload_network_dns_zone: IO, + segment_id: str, + workload_network_segment: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkDnsZone]: - """Create a DNS zone by id in a private cloud workload network. - - Create a DNS zone by id in a private cloud workload network. + ) -> AsyncLROPoller[_models.WorkloadNetworkSegment]: + """Create a WorkloadNetworkSegment. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. - Required. - :type dns_zone_id: str - :param workload_network_dns_zone: NSX DNS Zone. Required. - :type workload_network_dns_zone: IO + :param segment_id: The ID of the NSX Segment. Required. + :type segment_id: str + :param workload_network_segment: Resource create parameters. Required. + :type workload_network_segment: IO[bytes] :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 WorkloadNetworkDnsZone or the result + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkSegment or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_dns_zone( + async def begin_create_segments( self, resource_group_name: str, private_cloud_name: str, - dns_zone_id: str, - workload_network_dns_zone: Union[_models.WorkloadNetworkDnsZone, IO], + segment_id: str, + workload_network_segment: Union[_models.WorkloadNetworkSegment, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkDnsZone]: - """Create a DNS zone by id in a private cloud workload network. - - Create a DNS zone by id in a private cloud workload network. + ) -> AsyncLROPoller[_models.WorkloadNetworkSegment]: + """Create a WorkloadNetworkSegment. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. - Required. - :type dns_zone_id: str - :param workload_network_dns_zone: NSX DNS Zone. Is either a WorkloadNetworkDnsZone type or a IO - type. Required. - :type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone 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 WorkloadNetworkDnsZone or the result + :param segment_id: The ID of the NSX Segment. Required. + :type segment_id: str + :param workload_network_segment: Resource create parameters. Is either a WorkloadNetworkSegment + type or a IO[bytes] type. Required. + :type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment or IO[bytes] + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkSegment or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -4857,16 +3884,16 @@ async def begin_create_dns_zone( 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.WorkloadNetworkDnsZone] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkSegment] = 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_dns_zone_initial( + raw_result = await self._create_segments_initial( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - dns_zone_id=dns_zone_id, - workload_network_dns_zone=workload_network_dns_zone, + segment_id=segment_id, + workload_network_segment=workload_network_segment, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -4877,39 +3904,40 @@ async def begin_create_dns_zone( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.WorkloadNetworkSegment].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_dns_zone.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}" - } + return AsyncLROPoller[_models.WorkloadNetworkSegment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _update_dns_zone_initial( + async def _update_segments_initial( self, resource_group_name: str, private_cloud_name: str, - dns_zone_id: str, - workload_network_dns_zone: Union[_models.WorkloadNetworkDnsZone, IO], + segment_id: str, + workload_network_segment: Union[_models.WorkloadNetworkSegment, IO[bytes]], **kwargs: Any - ) -> Optional[_models.WorkloadNetworkDnsZone]: - error_map = { + ) -> Optional[_models.WorkloadNetworkSegment]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4922,35 +3950,34 @@ async def _update_dns_zone_initial( 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.WorkloadNetworkDnsZone]] = kwargs.pop("cls", None) + cls: ClsType[Optional[_models.WorkloadNetworkSegment]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(workload_network_dns_zone, (IOBase, bytes)): - _content = workload_network_dns_zone + if isinstance(workload_network_segment, (IOBase, bytes)): + _content = workload_network_segment else: - _json = self._serialize.body(workload_network_dns_zone, "WorkloadNetworkDnsZone") + _json = self._serialize.body(workload_network_segment, "WorkloadNetworkSegment") - request = build_update_dns_zone_request( + _request = build_update_segments_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - dns_zone_id=dns_zone_id, + segment_id=segment_id, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._update_dns_zone_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -4961,140 +3988,105 @@ async def _update_dns_zone_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - return deserialized + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _update_dns_zone_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}" - } + return deserialized # type: ignore @overload - async def begin_update_dns_zone( + async def begin_update_segments( self, resource_group_name: str, private_cloud_name: str, - dns_zone_id: str, - workload_network_dns_zone: _models.WorkloadNetworkDnsZone, + segment_id: str, + workload_network_segment: _models.WorkloadNetworkSegment, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkDnsZone]: - """Create or update a DNS zone by id in a private cloud workload network. - - Create or update a DNS zone by id in a private cloud workload network. + ) -> AsyncLROPoller[_models.WorkloadNetworkSegment]: + """Update a WorkloadNetworkSegment. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. - Required. - :type dns_zone_id: str - :param workload_network_dns_zone: NSX DNS Zone. Required. - :type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone + :param segment_id: The ID of the NSX Segment. Required. + :type segment_id: str + :param workload_network_segment: The resource properties to be updated. Required. + :type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment :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 WorkloadNetworkDnsZone or the result + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkSegment or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update_dns_zone( + async def begin_update_segments( self, resource_group_name: str, private_cloud_name: str, - dns_zone_id: str, - workload_network_dns_zone: IO, + segment_id: str, + workload_network_segment: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkDnsZone]: - """Create or update a DNS zone by id in a private cloud workload network. - - Create or update a DNS zone by id in a private cloud workload network. + ) -> AsyncLROPoller[_models.WorkloadNetworkSegment]: + """Update a WorkloadNetworkSegment. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. - :type private_cloud_name: str - :param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. - Required. - :type dns_zone_id: str - :param workload_network_dns_zone: NSX DNS Zone. Required. - :type workload_network_dns_zone: IO + :type private_cloud_name: str + :param segment_id: The ID of the NSX Segment. Required. + :type segment_id: str + :param workload_network_segment: The resource properties to be updated. Required. + :type workload_network_segment: IO[bytes] :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 WorkloadNetworkDnsZone or the result + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkSegment or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update_dns_zone( + async def begin_update_segments( self, resource_group_name: str, private_cloud_name: str, - dns_zone_id: str, - workload_network_dns_zone: Union[_models.WorkloadNetworkDnsZone, IO], + segment_id: str, + workload_network_segment: Union[_models.WorkloadNetworkSegment, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkDnsZone]: - """Create or update a DNS zone by id in a private cloud workload network. - - Create or update a DNS zone by id in a private cloud workload network. + ) -> AsyncLROPoller[_models.WorkloadNetworkSegment]: + """Update a WorkloadNetworkSegment. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. - Required. - :type dns_zone_id: str - :param workload_network_dns_zone: NSX DNS Zone. Is either a WorkloadNetworkDnsZone type or a IO - type. Required. - :type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone 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 WorkloadNetworkDnsZone or the result + :param segment_id: The ID of the NSX Segment. Required. + :type segment_id: str + :param workload_network_segment: The resource properties to be updated. Is either a + WorkloadNetworkSegment type or a IO[bytes] type. Required. + :type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment or IO[bytes] + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkSegment or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -5102,16 +4094,16 @@ async def begin_update_dns_zone( 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.WorkloadNetworkDnsZone] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkSegment] = 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_dns_zone_initial( + raw_result = await self._update_segments_initial( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - dns_zone_id=dns_zone_id, - workload_network_dns_zone=workload_network_dns_zone, + segment_id=segment_id, + workload_network_segment=workload_network_segment, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -5122,34 +4114,34 @@ async def begin_update_dns_zone( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.WorkloadNetworkSegment].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_dns_zone.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}" - } + return AsyncLROPoller[_models.WorkloadNetworkSegment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_dns_zone_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, dns_zone_id: str, private_cloud_name: str, **kwargs: Any + async def _delete_segment_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, private_cloud_name: str, segment_id: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5163,22 +4155,21 @@ async def _delete_dns_zone_initial( # pylint: disable=inconsistent-return-state 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_dns_zone_request( + _request = build_delete_segment_request( resource_group_name=resource_group_name, - dns_zone_id=dns_zone_id, private_cloud_name=private_cloud_name, + segment_id=segment_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_dns_zone_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -5188,37 +4179,27 @@ async def _delete_dns_zone_initial( # pylint: disable=inconsistent-return-state 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, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _delete_dns_zone_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async - async def begin_delete_dns_zone( - self, resource_group_name: str, dns_zone_id: str, private_cloud_name: str, **kwargs: Any + async def begin_delete_segment( + self, resource_group_name: str, private_cloud_name: str, segment_id: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Delete a DNS zone by id in a private cloud workload network. - - Delete a DNS zone by id in a private cloud workload network. + """Delete a WorkloadNetworkSegment. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. - Required. - :type dns_zone_id: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_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. + :param segment_id: The ID of the NSX Segment. Required. + :type segment_id: str :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: @@ -5232,10 +4213,10 @@ async def begin_delete_dns_zone( 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_dns_zone_initial( # type: ignore + raw_result = await self._delete_segment_initial( # type: ignore resource_group_name=resource_group_name, - dns_zone_id=dns_zone_id, private_cloud_name=private_cloud_name, + segment_id=segment_id, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -5246,53 +4227,49 @@ async def begin_delete_dns_zone( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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_dns_zone.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_public_i_ps( + def list_virtual_machines( self, resource_group_name: str, private_cloud_name: str, **kwargs: Any - ) -> AsyncIterable["_models.WorkloadNetworkPublicIP"]: - """List of Public IP Blocks in a private cloud workload network. - - List of Public IP Blocks in a private cloud workload network. + ) -> AsyncIterable["_models.WorkloadNetworkVirtualMachine"]: + """List WorkloadNetworkVirtualMachine resources by WorkloadNetwork. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadNetworkPublicIP or the result of + :return: An iterator like instance of either WorkloadNetworkVirtualMachine or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkPublicIP] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkVirtualMachine] :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.WorkloadNetworkPublicIPsList] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkVirtualMachinesList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5303,17 +4280,16 @@ def list_public_i_ps( def prepare_request(next_link=None): if not next_link: - request = build_list_public_i_ps_request( + _request = build_list_virtual_machines_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_public_i_ps.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -5325,27 +4301,27 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("WorkloadNetworkPublicIPsList", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkVirtualMachinesList", 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) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -5358,32 +4334,226 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_public_i_ps.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs" - } - @distributed_trace_async - async def get_public_ip( - self, resource_group_name: str, private_cloud_name: str, public_ip_id: str, **kwargs: Any - ) -> _models.WorkloadNetworkPublicIP: - """Get a Public IP Block by id in a private cloud workload network. + async def get_virtual_machine( + self, resource_group_name: str, private_cloud_name: str, virtual_machine_id: str, **kwargs: Any + ) -> _models.WorkloadNetworkVirtualMachine: + """Get a WorkloadNetworkVirtualMachine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. Required. + :type private_cloud_name: str + :param virtual_machine_id: ID of the virtual machine. Required. + :type virtual_machine_id: str + :return: WorkloadNetworkVirtualMachine or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetworkVirtualMachine + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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.WorkloadNetworkVirtualMachine] = kwargs.pop("cls", None) + + _request = build_get_virtual_machine_request( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + virtual_machine_id=virtual_machine_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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("WorkloadNetworkVirtualMachine", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_vm_groups( + self, resource_group_name: str, private_cloud_name: str, **kwargs: Any + ) -> AsyncIterable["_models.WorkloadNetworkVMGroup"]: + """List WorkloadNetworkVMGroup resources by WorkloadNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. Required. + :type private_cloud_name: str + :return: An iterator like instance of either WorkloadNetworkVMGroup or the result of + cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] + :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.WorkloadNetworkVMGroupsList] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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_vm_groups_request( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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("WorkloadNetworkVMGroupsList", 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 - Get a Public IP Block by id in a private cloud workload network. + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get_vm_group( + self, resource_group_name: str, private_cloud_name: str, vm_group_id: str, **kwargs: Any + ) -> _models.WorkloadNetworkVMGroup: + """Get a WorkloadNetworkVMGroup. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param public_ip_id: NSX Public IP Block identifier. Generally the same as the Public IP - Block's display name. Required. - :type public_ip_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: WorkloadNetworkPublicIP or the result of cls(response) - :rtype: ~azure.mgmt.avs.models.WorkloadNetworkPublicIP + :param vm_group_id: ID of the VM group. Required. + :type vm_group_id: str + :return: WorkloadNetworkVMGroup or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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.WorkloadNetworkVMGroup] = kwargs.pop("cls", None) + + _request = build_get_vm_group_request( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + vm_group_id=vm_group_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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("WorkloadNetworkVMGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_vm_group_initial( + self, + resource_group_name: str, + private_cloud_name: str, + vm_group_id: str, + workload_network_vm_group: Union[_models.WorkloadNetworkVMGroup, IO[bytes]], + **kwargs: Any + ) -> _models.WorkloadNetworkVMGroup: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5391,57 +4561,209 @@ async def get_public_ip( } 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkloadNetworkPublicIP] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WorkloadNetworkVMGroup] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workload_network_vm_group, (IOBase, bytes)): + _content = workload_network_vm_group + else: + _json = self._serialize.body(workload_network_vm_group, "WorkloadNetworkVMGroup") - request = build_get_public_ip_request( + _request = build_create_vm_group_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - public_ip_id=public_ip_id, + vm_group_id=vm_group_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_public_ip.metadata["url"], + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) - deserialized = self._deserialize("WorkloadNetworkPublicIP", pipeline_response) + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore - return deserialized + @overload + async def begin_create_vm_group( + self, + resource_group_name: str, + private_cloud_name: str, + vm_group_id: str, + workload_network_vm_group: _models.WorkloadNetworkVMGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.WorkloadNetworkVMGroup]: + """Create a WorkloadNetworkVMGroup. - get_public_ip.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}" - } + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. Required. + :type private_cloud_name: str + :param vm_group_id: ID of the VM group. Required. + :type vm_group_id: str + :param workload_network_vm_group: Resource create parameters. Required. + :type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkVMGroup or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ - async def _create_public_ip_initial( + @overload + async def begin_create_vm_group( self, resource_group_name: str, private_cloud_name: str, - public_ip_id: str, - workload_network_public_ip: Union[_models.WorkloadNetworkPublicIP, IO], + vm_group_id: str, + workload_network_vm_group: IO[bytes], + *, + content_type: str = "application/json", **kwargs: Any - ) -> _models.WorkloadNetworkPublicIP: - error_map = { + ) -> AsyncLROPoller[_models.WorkloadNetworkVMGroup]: + """Create a WorkloadNetworkVMGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. Required. + :type private_cloud_name: str + :param vm_group_id: ID of the VM group. Required. + :type vm_group_id: str + :param workload_network_vm_group: Resource create parameters. Required. + :type workload_network_vm_group: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkVMGroup or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_vm_group( + self, + resource_group_name: str, + private_cloud_name: str, + vm_group_id: str, + workload_network_vm_group: Union[_models.WorkloadNetworkVMGroup, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.WorkloadNetworkVMGroup]: + """Create a WorkloadNetworkVMGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. Required. + :type private_cloud_name: str + :param vm_group_id: ID of the VM group. Required. + :type vm_group_id: str + :param workload_network_vm_group: Resource create parameters. Is either a + WorkloadNetworkVMGroup type or a IO[bytes] type. Required. + :type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup or IO[bytes] + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkVMGroup or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] + :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.WorkloadNetworkVMGroup] = 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_vm_group_initial( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + vm_group_id=vm_group_id, + workload_network_vm_group=workload_network_vm_group, + 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("WorkloadNetworkVMGroup", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.WorkloadNetworkVMGroup].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.WorkloadNetworkVMGroup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_vm_group_initial( + self, + resource_group_name: str, + private_cloud_name: str, + vm_group_id: str, + workload_network_vm_group: Union[_models.WorkloadNetworkVMGroup, IO[bytes]], + **kwargs: Any + ) -> Optional[_models.WorkloadNetworkVMGroup]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5454,181 +4776,143 @@ async def _create_public_ip_initial( 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.WorkloadNetworkPublicIP] = kwargs.pop("cls", None) + cls: ClsType[Optional[_models.WorkloadNetworkVMGroup]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(workload_network_public_ip, (IOBase, bytes)): - _content = workload_network_public_ip + if isinstance(workload_network_vm_group, (IOBase, bytes)): + _content = workload_network_vm_group else: - _json = self._serialize.body(workload_network_public_ip, "WorkloadNetworkPublicIP") + _json = self._serialize.body(workload_network_vm_group, "WorkloadNetworkVMGroup") - request = build_create_public_ip_request( + _request = build_update_vm_group_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - public_ip_id=public_ip_id, + vm_group_id=vm_group_id, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_public_ip_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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("WorkloadNetworkPublicIP", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response) - if response.status_code == 201: - deserialized = self._deserialize("WorkloadNetworkPublicIP", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_public_ip_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}" - } - @overload - async def begin_create_public_ip( + async def begin_update_vm_group( self, resource_group_name: str, private_cloud_name: str, - public_ip_id: str, - workload_network_public_ip: _models.WorkloadNetworkPublicIP, + vm_group_id: str, + workload_network_vm_group: _models.WorkloadNetworkVMGroup, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkPublicIP]: - """Create a Public IP Block by id in a private cloud workload network. - - Create a Public IP Block by id in a private cloud workload network. + ) -> AsyncLROPoller[_models.WorkloadNetworkVMGroup]: + """Update a WorkloadNetworkVMGroup. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param public_ip_id: NSX Public IP Block identifier. Generally the same as the Public IP - Block's display name. Required. - :type public_ip_id: str - :param workload_network_public_ip: NSX Public IP Block. Required. - :type workload_network_public_ip: ~azure.mgmt.avs.models.WorkloadNetworkPublicIP + :param vm_group_id: ID of the VM group. Required. + :type vm_group_id: str + :param workload_network_vm_group: The resource properties to be updated. Required. + :type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup :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 WorkloadNetworkPublicIP or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPublicIP] + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkVMGroup or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_public_ip( + async def begin_update_vm_group( self, resource_group_name: str, private_cloud_name: str, - public_ip_id: str, - workload_network_public_ip: IO, + vm_group_id: str, + workload_network_vm_group: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkPublicIP]: - """Create a Public IP Block by id in a private cloud workload network. - - Create a Public IP Block by id in a private cloud workload network. + ) -> AsyncLROPoller[_models.WorkloadNetworkVMGroup]: + """Update a WorkloadNetworkVMGroup. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param public_ip_id: NSX Public IP Block identifier. Generally the same as the Public IP - Block's display name. Required. - :type public_ip_id: str - :param workload_network_public_ip: NSX Public IP Block. Required. - :type workload_network_public_ip: IO + :param vm_group_id: ID of the VM group. Required. + :type vm_group_id: str + :param workload_network_vm_group: The resource properties to be updated. Required. + :type workload_network_vm_group: IO[bytes] :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 WorkloadNetworkPublicIP or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPublicIP] + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkVMGroup or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_public_ip( + async def begin_update_vm_group( self, resource_group_name: str, private_cloud_name: str, - public_ip_id: str, - workload_network_public_ip: Union[_models.WorkloadNetworkPublicIP, IO], + vm_group_id: str, + workload_network_vm_group: Union[_models.WorkloadNetworkVMGroup, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.WorkloadNetworkPublicIP]: - """Create a Public IP Block by id in a private cloud workload network. - - Create a Public IP Block by id in a private cloud workload network. + ) -> AsyncLROPoller[_models.WorkloadNetworkVMGroup]: + """Update a WorkloadNetworkVMGroup. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param public_ip_id: NSX Public IP Block identifier. Generally the same as the Public IP - Block's display name. Required. - :type public_ip_id: str - :param workload_network_public_ip: NSX Public IP Block. Is either a WorkloadNetworkPublicIP - type or a IO type. Required. - :type workload_network_public_ip: ~azure.mgmt.avs.models.WorkloadNetworkPublicIP 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 WorkloadNetworkPublicIP or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPublicIP] + :param vm_group_id: ID of the VM group. Required. + :type vm_group_id: str + :param workload_network_vm_group: The resource properties to be updated. Is either a + WorkloadNetworkVMGroup type or a IO[bytes] type. Required. + :type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup or IO[bytes] + :return: An instance of AsyncLROPoller that returns either WorkloadNetworkVMGroup or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -5636,16 +4920,16 @@ async def begin_create_public_ip( 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.WorkloadNetworkPublicIP] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkVMGroup] = 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_public_ip_initial( + raw_result = await self._update_vm_group_initial( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - public_ip_id=public_ip_id, - workload_network_public_ip=workload_network_public_ip, + vm_group_id=vm_group_id, + workload_network_vm_group=workload_network_vm_group, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -5656,34 +4940,34 @@ async def begin_create_public_ip( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkloadNetworkPublicIP", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.WorkloadNetworkVMGroup].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_public_ip.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}" - } + return AsyncLROPoller[_models.WorkloadNetworkVMGroup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_public_ip_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, public_ip_id: str, private_cloud_name: str, **kwargs: Any + async def _delete_vm_group_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, vm_group_id: str, private_cloud_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5697,22 +4981,21 @@ async def _delete_public_ip_initial( # pylint: disable=inconsistent-return-stat 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_public_ip_request( + _request = build_delete_vm_group_request( resource_group_name=resource_group_name, - public_ip_id=public_ip_id, + vm_group_id=vm_group_id, private_cloud_name=private_cloud_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_public_ip_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -5722,37 +5005,27 @@ async def _delete_public_ip_initial( # pylint: disable=inconsistent-return-stat 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, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _delete_public_ip_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async - async def begin_delete_public_ip( - self, resource_group_name: str, public_ip_id: str, private_cloud_name: str, **kwargs: Any + async def begin_delete_vm_group( + self, resource_group_name: str, vm_group_id: str, private_cloud_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Delete a Public IP Block by id in a private cloud workload network. - - Delete a Public IP Block by id in a private cloud workload network. + """Delete a WorkloadNetworkVMGroup. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param public_ip_id: NSX Public IP Block identifier. Generally the same as the Public IP - Block's display name. Required. - :type public_ip_id: str + :param vm_group_id: ID of the VM group. Required. + :type vm_group_id: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_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: @@ -5766,9 +5039,9 @@ async def begin_delete_public_ip( 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_public_ip_initial( # type: ignore + raw_result = await self._delete_vm_group_initial( # type: ignore resource_group_name=resource_group_name, - public_ip_id=public_ip_id, + vm_group_id=vm_group_id, private_cloud_name=private_cloud_name, api_version=api_version, cls=lambda x, y, z: x, @@ -5780,23 +5053,21 @@ async def begin_delete_public_ip( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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_public_ip.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/__init__.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/__init__.py index 3e1a3e5014b4..5edc6d7fee51 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/__init__.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/__init__.py @@ -20,14 +20,13 @@ from ._models_py3 import CloudLinkList from ._models_py3 import Cluster from ._models_py3 import ClusterList -from ._models_py3 import ClusterProperties from ._models_py3 import ClusterUpdate from ._models_py3 import ClusterZone from ._models_py3 import ClusterZoneList -from ._models_py3 import CommonClusterProperties from ._models_py3 import Datastore from ._models_py3 import DatastoreList from ._models_py3 import DiskPoolVolume +from ._models_py3 import ElasticSanVolume from ._models_py3 import Encryption from ._models_py3 import EncryptionKeyVaultProperties from ._models_py3 import Endpoints @@ -41,15 +40,13 @@ from ._models_py3 import HcxEnterpriseSite from ._models_py3 import HcxEnterpriseSiteList from ._models_py3 import IdentitySource -from ._models_py3 import LogSpecification +from ._models_py3 import IscsiPath +from ._models_py3 import IscsiPathListResult from ._models_py3 import ManagementCluster -from ._models_py3 import MetricDimension -from ._models_py3 import MetricSpecification from ._models_py3 import NetAppVolume from ._models_py3 import Operation from ._models_py3 import OperationDisplay -from ._models_py3 import OperationList -from ._models_py3 import OperationProperties +from ._models_py3 import OperationListResult from ._models_py3 import PSCredentialExecutionParameter from ._models_py3 import PlacementPoliciesList from ._models_py3 import PlacementPolicy @@ -58,9 +55,7 @@ from ._models_py3 import PrivateCloud from ._models_py3 import PrivateCloudIdentity from ._models_py3 import PrivateCloudList -from ._models_py3 import PrivateCloudProperties from ._models_py3 import PrivateCloudUpdate -from ._models_py3 import PrivateCloudUpdateProperties from ._models_py3 import ProxyResource from ._models_py3 import Quota from ._models_py3 import Resource @@ -74,8 +69,8 @@ from ._models_py3 import ScriptParameter from ._models_py3 import ScriptSecureStringExecutionParameter from ._models_py3 import ScriptStringExecutionParameter -from ._models_py3 import ServiceSpecification from ._models_py3 import Sku +from ._models_py3 import SystemData from ._models_py3 import TrackedResource from ._models_py3 import Trial from ._models_py3 import VirtualMachine @@ -109,30 +104,37 @@ from ._models_py3 import WorkloadNetworkVirtualMachine from ._models_py3 import WorkloadNetworkVirtualMachinesList +from ._avs_client_enums import ActionType from ._avs_client_enums import AddonProvisioningState from ._avs_client_enums import AddonType from ._avs_client_enums import AffinityStrength from ._avs_client_enums import AffinityType from ._avs_client_enums import AvailabilityStrategy from ._avs_client_enums import AzureHybridBenefitType +from ._avs_client_enums import CloudLinkProvisioningState from ._avs_client_enums import CloudLinkStatus from ._avs_client_enums import ClusterProvisioningState +from ._avs_client_enums import CreatedByType from ._avs_client_enums import DatastoreProvisioningState from ._avs_client_enums import DatastoreStatus from ._avs_client_enums import DhcpTypeEnum from ._avs_client_enums import DnsServiceLogLevelEnum from ._avs_client_enums import DnsServiceStatusEnum +from ._avs_client_enums import DnsZoneType from ._avs_client_enums import EncryptionKeyStatus from ._avs_client_enums import EncryptionState from ._avs_client_enums import EncryptionVersionType from ._avs_client_enums import ExpressRouteAuthorizationProvisioningState from ._avs_client_enums import GlobalReachConnectionProvisioningState from ._avs_client_enums import GlobalReachConnectionStatus +from ._avs_client_enums import HcxEnterpriseSiteProvisioningState from ._avs_client_enums import HcxEnterpriseSiteStatus from ._avs_client_enums import InternetEnum +from ._avs_client_enums import IscsiPathProvisioningState from ._avs_client_enums import MountOptionEnum from ._avs_client_enums import NsxPublicIpQuotaRaisedEnum from ._avs_client_enums import OptionalParamEnum +from ._avs_client_enums import Origin from ._avs_client_enums import PlacementPolicyProvisioningState from ._avs_client_enums import PlacementPolicyState from ._avs_client_enums import PlacementPolicyType @@ -141,22 +143,27 @@ from ._avs_client_enums import PrivateCloudProvisioningState from ._avs_client_enums import QuotaEnabled from ._avs_client_enums import ResourceIdentityType +from ._avs_client_enums import ScriptCmdletAudience +from ._avs_client_enums import ScriptCmdletProvisioningState from ._avs_client_enums import ScriptExecutionParameterType from ._avs_client_enums import ScriptExecutionProvisioningState from ._avs_client_enums import ScriptOutputStreamType +from ._avs_client_enums import ScriptPackageProvisioningState from ._avs_client_enums import ScriptParameterTypes from ._avs_client_enums import SegmentStatusEnum +from ._avs_client_enums import SkuTier from ._avs_client_enums import SslEnum from ._avs_client_enums import TrialStatus from ._avs_client_enums import VMGroupStatusEnum from ._avs_client_enums import VMTypeEnum +from ._avs_client_enums import VirtualMachineProvisioningState from ._avs_client_enums import VirtualMachineRestrictMovementState from ._avs_client_enums import VisibilityParameterEnum from ._avs_client_enums import WorkloadNetworkDhcpProvisioningState from ._avs_client_enums import WorkloadNetworkDnsServiceProvisioningState from ._avs_client_enums import WorkloadNetworkDnsZoneProvisioningState -from ._avs_client_enums import WorkloadNetworkName from ._avs_client_enums import WorkloadNetworkPortMirroringProvisioningState +from ._avs_client_enums import WorkloadNetworkProvisioningState from ._avs_client_enums import WorkloadNetworkPublicIPProvisioningState from ._avs_client_enums import WorkloadNetworkSegmentProvisioningState from ._avs_client_enums import WorkloadNetworkVMGroupProvisioningState @@ -179,14 +186,13 @@ "CloudLinkList", "Cluster", "ClusterList", - "ClusterProperties", "ClusterUpdate", "ClusterZone", "ClusterZoneList", - "CommonClusterProperties", "Datastore", "DatastoreList", "DiskPoolVolume", + "ElasticSanVolume", "Encryption", "EncryptionKeyVaultProperties", "Endpoints", @@ -200,15 +206,13 @@ "HcxEnterpriseSite", "HcxEnterpriseSiteList", "IdentitySource", - "LogSpecification", + "IscsiPath", + "IscsiPathListResult", "ManagementCluster", - "MetricDimension", - "MetricSpecification", "NetAppVolume", "Operation", "OperationDisplay", - "OperationList", - "OperationProperties", + "OperationListResult", "PSCredentialExecutionParameter", "PlacementPoliciesList", "PlacementPolicy", @@ -217,9 +221,7 @@ "PrivateCloud", "PrivateCloudIdentity", "PrivateCloudList", - "PrivateCloudProperties", "PrivateCloudUpdate", - "PrivateCloudUpdateProperties", "ProxyResource", "Quota", "Resource", @@ -233,8 +235,8 @@ "ScriptParameter", "ScriptSecureStringExecutionParameter", "ScriptStringExecutionParameter", - "ServiceSpecification", "Sku", + "SystemData", "TrackedResource", "Trial", "VirtualMachine", @@ -267,30 +269,37 @@ "WorkloadNetworkVMGroupsList", "WorkloadNetworkVirtualMachine", "WorkloadNetworkVirtualMachinesList", + "ActionType", "AddonProvisioningState", "AddonType", "AffinityStrength", "AffinityType", "AvailabilityStrategy", "AzureHybridBenefitType", + "CloudLinkProvisioningState", "CloudLinkStatus", "ClusterProvisioningState", + "CreatedByType", "DatastoreProvisioningState", "DatastoreStatus", "DhcpTypeEnum", "DnsServiceLogLevelEnum", "DnsServiceStatusEnum", + "DnsZoneType", "EncryptionKeyStatus", "EncryptionState", "EncryptionVersionType", "ExpressRouteAuthorizationProvisioningState", "GlobalReachConnectionProvisioningState", "GlobalReachConnectionStatus", + "HcxEnterpriseSiteProvisioningState", "HcxEnterpriseSiteStatus", "InternetEnum", + "IscsiPathProvisioningState", "MountOptionEnum", "NsxPublicIpQuotaRaisedEnum", "OptionalParamEnum", + "Origin", "PlacementPolicyProvisioningState", "PlacementPolicyState", "PlacementPolicyType", @@ -299,22 +308,27 @@ "PrivateCloudProvisioningState", "QuotaEnabled", "ResourceIdentityType", + "ScriptCmdletAudience", + "ScriptCmdletProvisioningState", "ScriptExecutionParameterType", "ScriptExecutionProvisioningState", "ScriptOutputStreamType", + "ScriptPackageProvisioningState", "ScriptParameterTypes", "SegmentStatusEnum", + "SkuTier", "SslEnum", "TrialStatus", "VMGroupStatusEnum", "VMTypeEnum", + "VirtualMachineProvisioningState", "VirtualMachineRestrictMovementState", "VisibilityParameterEnum", "WorkloadNetworkDhcpProvisioningState", "WorkloadNetworkDnsServiceProvisioningState", "WorkloadNetworkDnsZoneProvisioningState", - "WorkloadNetworkName", "WorkloadNetworkPortMirroringProvisioningState", + "WorkloadNetworkProvisioningState", "WorkloadNetworkPublicIPProvisioningState", "WorkloadNetworkSegmentProvisioningState", "WorkloadNetworkVMGroupProvisioningState", diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/_avs_client_enums.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/_avs_client_enums.py index d0d1e671127a..e33fcda02308 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/_avs_client_enums.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/_avs_client_enums.py @@ -10,20 +10,33 @@ from azure.core import CaseInsensitiveEnumMeta +class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" + + INTERNAL = "Internal" + + class AddonProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The state of the addon provisioning.""" + """Addon provisioning state.""" SUCCEEDED = "Succeeded" + """Resource has been created.""" FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" CANCELLED = "Cancelled" + """is cancelled""" BUILDING = "Building" + """is building""" DELETING = "Deleting" + """is deleting""" UPDATING = "Updating" - CANCELED = "Canceled" + """is updating""" class AddonType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of private cloud addon.""" + """Addon type.""" SRM = "SRM" VR = "VR" @@ -32,77 +45,131 @@ class AddonType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class AffinityStrength(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """VM-Host placement policy affinity strength (should/must).""" + """Affinity Strength.""" SHOULD = "Should" + """is should""" MUST = "Must" + """is must""" class AffinityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Placement policy affinity type.""" + """Affinity type.""" AFFINITY = "Affinity" + """is affinity""" ANTI_AFFINITY = "AntiAffinity" + """is anti-affinity""" class AvailabilityStrategy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The availability strategy for the private cloud.""" + """Whether the private clouds is available in a single zone or two zones.""" SINGLE_ZONE = "SingleZone" + """in single zone""" DUAL_ZONE = "DualZone" + """in two zones""" class AzureHybridBenefitType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Placement policy hosts opt-in Azure Hybrid Benefit type.""" + """Azure Hybrid Benefit type.""" SQL_HOST = "SqlHost" + """is SqlHost""" NONE = "None" + """is None""" + + +class CloudLinkProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """cloud link provisioning state.""" + + SUCCEEDED = "Succeeded" + """Resource has been created.""" + FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" class CloudLinkStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The state of the cloud link.""" + """Cloud Link status.""" ACTIVE = "Active" + """is active""" BUILDING = "Building" + """is building""" DELETING = "Deleting" + """is deleting""" FAILED = "Failed" + """is failed""" DISCONNECTED = "Disconnected" + """is disconnected""" class ClusterProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The state of the cluster provisioning.""" + """Cluster provisioning state.""" SUCCEEDED = "Succeeded" + """Resource has been created.""" FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" CANCELLED = "Cancelled" + """is cancelled""" DELETING = "Deleting" + """is deleting""" UPDATING = "Updating" - CANCELED = "Canceled" + """is updating""" + + +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity that created the resource.""" + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" class DatastoreProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The state of the datastore provisioning.""" + """datastore provisioning state.""" SUCCEEDED = "Succeeded" + """Resource has been created.""" FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" CANCELLED = "Cancelled" + """is cancelled""" PENDING = "Pending" + """is pending""" CREATING = "Creating" + """is creating""" UPDATING = "Updating" + """is updating""" DELETING = "Deleting" - CANCELED = "Canceled" + """is deleting""" class DatastoreStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The operational status of the datastore.""" + """datastore status.""" UNKNOWN = "Unknown" + """is unknown""" ACCESSIBLE = "Accessible" + """is accessible""" INACCESSIBLE = "Inaccessible" + """is inaccessible""" ATTACHED = "Attached" + """is attached""" DETACHED = "Detached" + """is detached""" LOST_COMMUNICATION = "LostCommunication" + """is lost communication""" DEAD_OR_ERROR = "DeadOrError" + """is dead or error""" class DhcpTypeEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -113,179 +180,307 @@ class DhcpTypeEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): class DnsServiceLogLevelEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """DNS Service log level.""" + """DNS service log level.""" DEBUG = "DEBUG" + """is debug""" INFO = "INFO" + """is info""" WARNING = "WARNING" + """is warning""" ERROR = "ERROR" + """is error""" FATAL = "FATAL" + """is fatal""" class DnsServiceStatusEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """DNS Service status.""" + """DNS service status.""" SUCCESS = "SUCCESS" + """is success""" FAILURE = "FAILURE" + """is failure""" + + +class DnsZoneType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of DNS zone.""" + + PUBLIC = "Public" + """Primary DNS zone.""" + PRIVATE = "Private" + """Private DNS zone.""" class EncryptionKeyStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The state of key provided.""" + """Whether the the encryption key is connected or access denied.""" CONNECTED = "Connected" + """is connected""" ACCESS_DENIED = "AccessDenied" + """is access denied""" class EncryptionState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of customer managed encryption key.""" + """Whether encryption is enabled or disabled.""" ENABLED = "Enabled" + """is enabled""" DISABLED = "Disabled" + """is disabled""" class EncryptionVersionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Property of the key if user provided or auto detected.""" + """Whether the encryption version is fixed or auto-detected.""" FIXED = "Fixed" + """is fixed""" AUTO_DETECTED = "AutoDetected" + """is auto-detected""" class ExpressRouteAuthorizationProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The state of the ExpressRoute Circuit Authorization provisioning.""" + """Express Route Circuit Authorization provisioning state.""" SUCCEEDED = "Succeeded" + """Resource has been created.""" FAILED = "Failed" - UPDATING = "Updating" + """Resource creation failed.""" CANCELED = "Canceled" + """Resource creation was canceled.""" + UPDATING = "Updating" + """is updating""" class GlobalReachConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The state of the ExpressRoute Circuit Authorization provisioning.""" + """Global Reach Connection provisioning state.""" SUCCEEDED = "Succeeded" + """Resource has been created.""" FAILED = "Failed" - UPDATING = "Updating" + """Resource creation failed.""" CANCELED = "Canceled" + """Resource creation was canceled.""" + UPDATING = "Updating" + """is updating""" class GlobalReachConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The connection status of the global reach connection.""" + """Global Reach Connection status.""" CONNECTED = "Connected" + """is connected""" CONNECTING = "Connecting" + """is connecting""" DISCONNECTED = "Disconnected" + """is disconnected""" + + +class HcxEnterpriseSiteProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """HCX Enterprise Site provisioning state.""" + + SUCCEEDED = "Succeeded" + """Resource has been created.""" + FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" class HcxEnterpriseSiteStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The status of the HCX Enterprise Site.""" + """HCX Enterprise Site status.""" AVAILABLE = "Available" + """is available""" CONSUMED = "Consumed" + """is consumed""" DEACTIVATED = "Deactivated" + """is deactivated""" DELETED = "Deleted" + """is deleted""" class InternetEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Connectivity to internet is enabled or disabled.""" + """Whether internet is enabled or disabled.""" ENABLED = "Enabled" + """is enabled""" DISABLED = "Disabled" + """is disabled""" + + +class IscsiPathProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """private cloud provisioning state.""" + + SUCCEEDED = "Succeeded" + """Resource has been created.""" + FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" + PENDING = "Pending" + """is pending""" + BUILDING = "Building" + """is building""" + DELETING = "Deleting" + """is deleting""" + UPDATING = "Updating" + """is updating""" class MountOptionEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Mode that describes whether the LUN has to be mounted as a datastore or attached as a LUN.""" + """Mode that describes whether the LUN has to be mounted as a datastore or + attached as a LUN. + """ MOUNT = "MOUNT" + """is mount""" ATTACH = "ATTACH" + """is attach""" class NsxPublicIpQuotaRaisedEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Flag to indicate whether the private cloud has the quota for provisioned NSX Public IP count - raised from 64 to 1024. - """ + """NSX public IP quota raised.""" ENABLED = "Enabled" + """is enabled""" DISABLED = "Disabled" + """is disabled""" class OptionalParamEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Is this parameter required or optional.""" + """Optional Param.""" OPTIONAL = "Optional" + """is optional""" REQUIRED = "Required" + """is required""" + + +class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is "user,system". + """ + + USER = "user" + SYSTEM = "system" + USER_SYSTEM = "user,system" class PlacementPolicyProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state.""" + """Placement Policy provisioning state.""" SUCCEEDED = "Succeeded" + """Resource has been created.""" FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" BUILDING = "Building" + """is building""" DELETING = "Deleting" + """is deleting""" UPDATING = "Updating" - CANCELED = "Canceled" + """is updating""" class PlacementPolicyState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Whether the placement policy is enabled or disabled.""" + """Placement Policy state.""" ENABLED = "Enabled" + """is enabled""" DISABLED = "Disabled" + """is disabled""" class PlacementPolicyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """placement policy type.""" + """Placement Policy type.""" VM_VM = "VmVm" VM_HOST = "VmHost" class PortMirroringDirectionEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Direction of port mirroring profile.""" + """Port Mirroring Direction.""" INGRESS = "INGRESS" + """is ingress""" EGRESS = "EGRESS" + """is egress""" BIDIRECTIONAL = "BIDIRECTIONAL" + """is bidirectional""" class PortMirroringStatusEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Port Mirroring Status.""" + """Port Mirroring status.""" SUCCESS = "SUCCESS" + """is success""" FAILURE = "FAILURE" + """is failure""" class PrivateCloudProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state.""" + """private cloud provisioning state.""" SUCCEEDED = "Succeeded" + """Resource has been created.""" FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" CANCELLED = "Cancelled" + """is cancelled""" PENDING = "Pending" + """is pending""" BUILDING = "Building" + """is building""" DELETING = "Deleting" + """is deleting""" UPDATING = "Updating" - CANCELED = "Canceled" + """is updating""" class QuotaEnabled(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Host quota is active for current subscription.""" + """quota enabled.""" ENABLED = "Enabled" + """is enabled""" DISABLED = "Disabled" + """is disabled""" class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity used for the private cloud. The type 'SystemAssigned' refers to an - implicitly created identity. The type 'None' will remove any identities from the Private Cloud. - """ + """Type of managed service identity (either system assigned, or none).""" - SYSTEM_ASSIGNED = "SystemAssigned" NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + + +class ScriptCmdletAudience(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies whether a script cmdlet is intended to be invoked only through automation or visible + to customers. + """ + + AUTOMATION = "Automation" + """is automation""" + ANY = "Any" + """is any""" + + +class ScriptCmdletProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """A script cmdlet provisioning state.""" + + SUCCEEDED = "Succeeded" + """Resource has been created.""" + FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" class ScriptExecutionParameterType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of execution parameter.""" + """script execution parameter type.""" VALUE = "Value" SECURE_VALUE = "SecureValue" @@ -293,167 +488,287 @@ class ScriptExecutionParameterType(str, Enum, metaclass=CaseInsensitiveEnumMeta) class ScriptExecutionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The state of the script execution resource.""" + """Script Execution provisioning state.""" - PENDING = "Pending" - RUNNING = "Running" SUCCEEDED = "Succeeded" + """Resource has been created.""" FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" + PENDING = "Pending" + """is pending""" + RUNNING = "Running" + """is running""" CANCELLING = "Cancelling" + """is cancelling""" CANCELLED = "Cancelled" + """is cancelled""" DELETING = "Deleting" - CANCELED = "Canceled" + """is deleting""" class ScriptOutputStreamType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ScriptOutputStreamType.""" + """Script Output Stream type.""" INFORMATION = "Information" + """is information""" WARNING = "Warning" + """is warning""" OUTPUT = "Output" + """is output""" ERROR = "Error" + """is error""" + + +class ScriptPackageProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Script Package provisioning state.""" + + SUCCEEDED = "Succeeded" + """Resource has been created.""" + FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" class ScriptParameterTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of parameter the script is expecting. psCredential is a PSCredentialObject.""" + """Script Parameter types.""" STRING = "String" + """is string""" SECURE_STRING = "SecureString" + """is secure string""" CREDENTIAL = "Credential" - INT = "Int" + """is credential""" + INT_ENUM = "Int" + """is int""" BOOL = "Bool" + """is bool""" FLOAT = "Float" + """is float""" class SegmentStatusEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Segment status.""" SUCCESS = "SUCCESS" + """is success""" FAILURE = "FAILURE" + """is failure""" + + +class SkuTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """This field is required to be implemented by the Resource Provider if the service has more than + one tier, but is not required on a PUT. + """ + + FREE = "Free" + BASIC = "Basic" + STANDARD = "Standard" + PREMIUM = "Premium" class SslEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Protect LDAP communication using SSL certificate (LDAPS).""" + """Whether SSL is enabled or disabled.""" ENABLED = "Enabled" + """is enabled""" DISABLED = "Disabled" + """is disabled""" class TrialStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Trial status.""" + """trial status.""" TRIAL_AVAILABLE = "TrialAvailable" + """is available""" TRIAL_USED = "TrialUsed" + """is used""" TRIAL_DISABLED = "TrialDisabled" + """is disabled""" + + +class VirtualMachineProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Virtual Machine provisioning state.""" + + SUCCEEDED = "Succeeded" + """Resource has been created.""" + FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" class VirtualMachineRestrictMovementState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Whether VM DRS-driven movement is restricted (enabled) or not (disabled).""" + """Virtual Machine Restrict Movement state.""" ENABLED = "Enabled" + """is enabled""" DISABLED = "Disabled" + """is disabled""" class VisibilityParameterEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Should this parameter be visible to arm and passed in the parameters argument when executing.""" + """Visibility Parameter.""" VISIBLE = "Visible" + """is visible""" HIDDEN = "Hidden" + """is hidden""" class VMGroupStatusEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """VM Group status.""" + """VM group status.""" SUCCESS = "SUCCESS" + """is success""" FAILURE = "FAILURE" + """is failure""" class VMTypeEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Virtual machine type.""" + """VM type.""" REGULAR = "REGULAR" + """is regular""" EDGE = "EDGE" + """is edge""" SERVICE = "SERVICE" + """is service""" class WorkloadNetworkDhcpProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state.""" + """Workload Network DHCP provisioning state.""" SUCCEEDED = "Succeeded" + """Resource has been created.""" FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" BUILDING = "Building" + """is building""" DELETING = "Deleting" + """is deleting""" UPDATING = "Updating" - CANCELED = "Canceled" + """is updating""" class WorkloadNetworkDnsServiceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state.""" + """Workload Network DNS Service provisioning state.""" SUCCEEDED = "Succeeded" + """Resource has been created.""" FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" BUILDING = "Building" + """is building""" DELETING = "Deleting" + """is deleting""" UPDATING = "Updating" - CANCELED = "Canceled" + """is updating""" class WorkloadNetworkDnsZoneProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state.""" + """Workload Network DNS Zone provisioning state.""" SUCCEEDED = "Succeeded" + """Resource has been created.""" FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" BUILDING = "Building" + """is building""" DELETING = "Deleting" + """is deleting""" UPDATING = "Updating" - CANCELED = "Canceled" + """is updating""" -class WorkloadNetworkName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """WorkloadNetworkName.""" +class WorkloadNetworkPortMirroringProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Workload Network Port Mirroring provisioning state.""" - DEFAULT = "default" + SUCCEEDED = "Succeeded" + """Resource has been created.""" + FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" + BUILDING = "Building" + """is building""" + DELETING = "Deleting" + """is deleting""" + UPDATING = "Updating" + """is updating""" -class WorkloadNetworkPortMirroringProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state.""" +class WorkloadNetworkProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """base Workload Network provisioning state.""" SUCCEEDED = "Succeeded" + """Resource has been created.""" FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" BUILDING = "Building" + """is building""" DELETING = "Deleting" + """is deleting""" UPDATING = "Updating" - CANCELED = "Canceled" + """is updating""" class WorkloadNetworkPublicIPProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state.""" + """Workload Network Public IP provisioning state.""" SUCCEEDED = "Succeeded" + """Resource has been created.""" FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" BUILDING = "Building" + """is building""" DELETING = "Deleting" + """is deleting""" UPDATING = "Updating" - CANCELED = "Canceled" + """is updating""" class WorkloadNetworkSegmentProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state.""" + """Workload Network Segment provisioning state.""" SUCCEEDED = "Succeeded" + """Resource has been created.""" FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" BUILDING = "Building" + """is building""" DELETING = "Deleting" + """is deleting""" UPDATING = "Updating" - CANCELED = "Canceled" + """is updating""" class WorkloadNetworkVMGroupProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state.""" + """Workload Network VM Group provisioning state.""" SUCCEEDED = "Succeeded" + """Resource has been created.""" FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" BUILDING = "Building" + """is building""" DELETING = "Deleting" + """is deleting""" UPDATING = "Updating" - CANCELED = "Canceled" + """is updating""" diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/_models_py3.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/_models_py3.py index dc1c5cf05689..0c3425b55537 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/models/_models_py3.py @@ -7,6 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import datetime import sys from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union @@ -24,28 +25,35 @@ class Resource(_serialization.Model): - """The core properties of ARM resources. + """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: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.avs.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: @@ -54,20 +62,46 @@ def __init__(self, **kwargs: Any) -> None: self.id = None self.name = None self.type = None + self.system_data = None -class Addon(Resource): +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. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :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.avs.models.SystemData + """ + + +class Addon(ProxyResource): """An addon resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :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 properties: The properties of an addon resource. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.avs.models.SystemData + :ivar properties: The resource-specific properties for this resource. :vartype properties: ~azure.mgmt.avs.models.AddonProperties """ @@ -75,18 +109,20 @@ class Addon(Resource): "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"}, "properties": {"key": "properties", "type": "AddonProperties"}, } def __init__(self, *, properties: Optional["_models.AddonProperties"] = None, **kwargs: Any) -> None: """ - :keyword properties: The properties of an addon resource. + :keyword properties: The resource-specific properties for this resource. :paramtype properties: ~azure.mgmt.avs.models.AddonProperties """ super().__init__(**kwargs) @@ -101,13 +137,12 @@ class AddonProperties(_serialization.Model): 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. + All required parameters must be populated in order to send to server. - :ivar addon_type: The type of private cloud addon. Required. Known values are: "SRM", "VR", - "HCX", and "Arc". + :ivar addon_type: Addon type. Required. Known values are: "SRM", "VR", "HCX", and "Arc". :vartype addon_type: str or ~azure.mgmt.avs.models.AddonType :ivar provisioning_state: The state of the addon provisioning. Known values are: "Succeeded", - "Failed", "Cancelled", "Building", "Deleting", "Updating", and "Canceled". + "Failed", "Canceled", "Cancelled", "Building", "Deleting", and "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.AddonProvisioningState """ @@ -142,13 +177,12 @@ class AddonArcProperties(AddonProperties): 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. + All required parameters must be populated in order to send to server. - :ivar addon_type: The type of private cloud addon. Required. Known values are: "SRM", "VR", - "HCX", and "Arc". + :ivar addon_type: Addon type. Required. Known values are: "SRM", "VR", "HCX", and "Arc". :vartype addon_type: str or ~azure.mgmt.avs.models.AddonType :ivar provisioning_state: The state of the addon provisioning. Known values are: "Succeeded", - "Failed", "Cancelled", "Building", "Deleting", "Updating", and "Canceled". + "Failed", "Canceled", "Cancelled", "Building", "Deleting", and "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.AddonProvisioningState :ivar v_center: The VMware vCenter resource ID. :vartype v_center: str @@ -180,13 +214,12 @@ class AddonHcxProperties(AddonProperties): 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. + All required parameters must be populated in order to send to server. - :ivar addon_type: The type of private cloud addon. Required. Known values are: "SRM", "VR", - "HCX", and "Arc". + :ivar addon_type: Addon type. Required. Known values are: "SRM", "VR", "HCX", and "Arc". :vartype addon_type: str or ~azure.mgmt.avs.models.AddonType :ivar provisioning_state: The state of the addon provisioning. Known values are: "Succeeded", - "Failed", "Cancelled", "Building", "Deleting", "Updating", and "Canceled". + "Failed", "Canceled", "Cancelled", "Building", "Deleting", and "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.AddonProvisioningState :ivar offer: The HCX offer, example VMware MaaS Cloud Provider (Enterprise). Required. :vartype offer: str @@ -215,19 +248,18 @@ def __init__(self, *, offer: str, **kwargs: Any) -> None: class AddonList(_serialization.Model): - """A paged list of addons. + """The response of a Addon list operation. - 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 server. - :ivar value: The items on a page. + :ivar value: The Addon items on this page. Required. :vartype value: list[~azure.mgmt.avs.models.Addon] - :ivar next_link: URL to get the next page if any. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -235,11 +267,16 @@ class AddonList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__(self, *, value: List["_models.Addon"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The Addon items on this page. Required. + :paramtype value: list[~azure.mgmt.avs.models.Addon] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ super().__init__(**kwargs) - self.value = None - self.next_link = None + self.value = value + self.next_link = next_link class AddonSrmProperties(AddonProperties): @@ -247,13 +284,12 @@ class AddonSrmProperties(AddonProperties): 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. + All required parameters must be populated in order to send to server. - :ivar addon_type: The type of private cloud addon. Required. Known values are: "SRM", "VR", - "HCX", and "Arc". + :ivar addon_type: Addon type. Required. Known values are: "SRM", "VR", "HCX", and "Arc". :vartype addon_type: str or ~azure.mgmt.avs.models.AddonType :ivar provisioning_state: The state of the addon provisioning. Known values are: "Succeeded", - "Failed", "Cancelled", "Building", "Deleting", "Updating", and "Canceled". + "Failed", "Canceled", "Cancelled", "Building", "Deleting", and "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.AddonProvisioningState :ivar license_key: The Site Recovery Manager (SRM) license. :vartype license_key: str @@ -285,13 +321,12 @@ class AddonVrProperties(AddonProperties): 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. + All required parameters must be populated in order to send to server. - :ivar addon_type: The type of private cloud addon. Required. Known values are: "SRM", "VR", - "HCX", and "Arc". + :ivar addon_type: Addon type. Required. Known values are: "SRM", "VR", "HCX", and "Arc". :vartype addon_type: str or ~azure.mgmt.avs.models.AddonType :ivar provisioning_state: The state of the addon provisioning. Known values are: "Succeeded", - "Failed", "Cancelled", "Building", "Deleting", "Updating", and "Canceled". + "Failed", "Canceled", "Cancelled", "Building", "Deleting", and "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.AddonProvisioningState :ivar vrs_count: The vSphere Replication Server (VRS) count. Required. :vartype vrs_count: int @@ -436,17 +471,25 @@ def __init__(self, **kwargs: Any) -> None: self.express_route_private_peering_id = None -class CloudLink(Resource): +class CloudLink(ProxyResource): """A cloud link resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.avs.models.SystemData + :ivar provisioning_state: The provisioning state of the resource. Known values are: + "Succeeded", "Failed", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.CloudLinkProvisioningState :ivar status: The state of the cloud link. Known values are: "Active", "Building", "Deleting", "Failed", and "Disconnected". :vartype status: str or ~azure.mgmt.avs.models.CloudLinkStatus @@ -458,6 +501,8 @@ class CloudLink(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, "status": {"readonly": True}, } @@ -465,6 +510,8 @@ class CloudLink(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "status": {"key": "properties.status", "type": "str"}, "linked_cloud": {"key": "properties.linkedCloud", "type": "str"}, } @@ -475,24 +522,24 @@ def __init__(self, *, linked_cloud: Optional[str] = None, **kwargs: Any) -> None :paramtype linked_cloud: str """ super().__init__(**kwargs) + self.provisioning_state = None self.status = None self.linked_cloud = linked_cloud class CloudLinkList(_serialization.Model): - """A paged list of cloud links. + """The response of a CloudLink list operation. - 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 server. - :ivar value: The items on a page. + :ivar value: The CloudLink items on this page. Required. :vartype value: list[~azure.mgmt.avs.models.CloudLink] - :ivar next_link: URL to get the next page if any. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -500,43 +547,56 @@ class CloudLinkList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__(self, *, value: List["_models.CloudLink"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The CloudLink items on this page. Required. + :paramtype value: list[~azure.mgmt.avs.models.CloudLink] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ super().__init__(**kwargs) - self.value = None - self.next_link = None + self.value = value + self.next_link = next_link -class Cluster(Resource): +class Cluster(ProxyResource): """A cluster resource. 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. + All required parameters must be populated in order to send to server. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :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 sku: The cluster SKU. Required. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.avs.models.SystemData + :ivar sku: The SKU (Stock Keeping Unit) assigned to this resource. Required. :vartype sku: ~azure.mgmt.avs.models.Sku :ivar cluster_size: The cluster size. :vartype cluster_size: int :ivar provisioning_state: The state of the cluster provisioning. Known values are: "Succeeded", - "Failed", "Cancelled", "Deleting", "Updating", and "Canceled". + "Failed", "Canceled", "Cancelled", "Deleting", and "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.ClusterProvisioningState :ivar cluster_id: The identity. :vartype cluster_id: int :ivar hosts: The hosts. :vartype hosts: list[str] + :ivar vsan_datastore_name: Name of the vsan datastore associated with the cluster. + :vartype vsan_datastore_name: str """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "sku": {"required": True}, "provisioning_state": {"readonly": True}, "cluster_id": {"readonly": True}, @@ -546,11 +606,13 @@ class Cluster(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "sku": {"key": "sku", "type": "Sku"}, "cluster_size": {"key": "properties.clusterSize", "type": "int"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "cluster_id": {"key": "properties.clusterId", "type": "int"}, "hosts": {"key": "properties.hosts", "type": "[str]"}, + "vsan_datastore_name": {"key": "properties.vsanDatastoreName", "type": "str"}, } def __init__( @@ -559,15 +621,18 @@ def __init__( sku: "_models.Sku", cluster_size: Optional[int] = None, hosts: Optional[List[str]] = None, + vsan_datastore_name: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword sku: The cluster SKU. Required. + :keyword sku: The SKU (Stock Keeping Unit) assigned to this resource. Required. :paramtype sku: ~azure.mgmt.avs.models.Sku :keyword cluster_size: The cluster size. :paramtype cluster_size: int :keyword hosts: The hosts. :paramtype hosts: list[str] + :keyword vsan_datastore_name: Name of the vsan datastore associated with the cluster. + :paramtype vsan_datastore_name: str """ super().__init__(**kwargs) self.sku = sku @@ -575,22 +640,22 @@ def __init__( self.provisioning_state = None self.cluster_id = None self.hosts = hosts + self.vsan_datastore_name = vsan_datastore_name class ClusterList(_serialization.Model): - """A paged list of clusters. + """The response of a Cluster list operation. - 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 server. - :ivar value: The items on a page. + :ivar value: The Cluster items on this page. Required. :vartype value: list[~azure.mgmt.avs.models.Cluster] - :ivar next_link: URL to get the next page if any. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -598,96 +663,23 @@ class ClusterList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - self.next_link = None - - -class CommonClusterProperties(_serialization.Model): - """The common properties of a cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cluster_size: The cluster size. - :vartype cluster_size: int - :ivar provisioning_state: The state of the cluster provisioning. Known values are: "Succeeded", - "Failed", "Cancelled", "Deleting", "Updating", and "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.avs.models.ClusterProvisioningState - :ivar cluster_id: The identity. - :vartype cluster_id: int - :ivar hosts: The hosts. - :vartype hosts: list[str] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "cluster_id": {"readonly": True}, - } - - _attribute_map = { - "cluster_size": {"key": "clusterSize", "type": "int"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "cluster_id": {"key": "clusterId", "type": "int"}, - "hosts": {"key": "hosts", "type": "[str]"}, - } - - def __init__(self, *, cluster_size: Optional[int] = None, hosts: Optional[List[str]] = None, **kwargs: Any) -> None: + def __init__(self, *, value: List["_models.Cluster"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword cluster_size: The cluster size. - :paramtype cluster_size: int - :keyword hosts: The hosts. - :paramtype hosts: list[str] + :keyword value: The Cluster items on this page. Required. + :paramtype value: list[~azure.mgmt.avs.models.Cluster] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str """ super().__init__(**kwargs) - self.cluster_size = cluster_size - self.provisioning_state = None - self.cluster_id = None - self.hosts = hosts - - -class ClusterProperties(CommonClusterProperties): - """The properties of a cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cluster_size: The cluster size. - :vartype cluster_size: int - :ivar provisioning_state: The state of the cluster provisioning. Known values are: "Succeeded", - "Failed", "Cancelled", "Deleting", "Updating", and "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.avs.models.ClusterProvisioningState - :ivar cluster_id: The identity. - :vartype cluster_id: int - :ivar hosts: The hosts. - :vartype hosts: list[str] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "cluster_id": {"readonly": True}, - } - - _attribute_map = { - "cluster_size": {"key": "clusterSize", "type": "int"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "cluster_id": {"key": "clusterId", "type": "int"}, - "hosts": {"key": "hosts", "type": "[str]"}, - } - - def __init__(self, *, cluster_size: Optional[int] = None, hosts: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword cluster_size: The cluster size. - :paramtype cluster_size: int - :keyword hosts: The hosts. - :paramtype hosts: list[str] - """ - super().__init__(cluster_size=cluster_size, hosts=hosts, **kwargs) + self.value = value + self.next_link = next_link class ClusterUpdate(_serialization.Model): """An update of a cluster resource. + :ivar sku: The SKU (Stock Keeping Unit) assigned to this resource. + :vartype sku: ~azure.mgmt.avs.models.Sku :ivar cluster_size: The cluster size. :vartype cluster_size: int :ivar hosts: The hosts. @@ -695,18 +687,29 @@ class ClusterUpdate(_serialization.Model): """ _attribute_map = { + "sku": {"key": "sku", "type": "Sku"}, "cluster_size": {"key": "properties.clusterSize", "type": "int"}, "hosts": {"key": "properties.hosts", "type": "[str]"}, } - def __init__(self, *, cluster_size: Optional[int] = None, hosts: Optional[List[str]] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + sku: Optional["_models.Sku"] = None, + cluster_size: Optional[int] = None, + hosts: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """ + :keyword sku: The SKU (Stock Keeping Unit) assigned to this resource. + :paramtype sku: ~azure.mgmt.avs.models.Sku :keyword cluster_size: The cluster size. :paramtype cluster_size: int :keyword hosts: The hosts. :paramtype hosts: list[str] """ super().__init__(**kwargs) + self.sku = sku self.cluster_size = cluster_size self.hosts = hosts @@ -759,25 +762,32 @@ def __init__(self, *, zones: Optional[List["_models.ClusterZone"]] = None, **kwa self.zones = zones -class Datastore(Resource): +class Datastore(ProxyResource): """A datastore resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.avs.models.SystemData :ivar provisioning_state: The state of the datastore provisioning. Known values are: - "Succeeded", "Failed", "Cancelled", "Pending", "Creating", "Updating", "Deleting", and - "Canceled". + "Succeeded", "Failed", "Canceled", "Cancelled", "Pending", "Creating", "Updating", and + "Deleting". :vartype provisioning_state: str or ~azure.mgmt.avs.models.DatastoreProvisioningState :ivar net_app_volume: An Azure NetApp Files volume. :vartype net_app_volume: ~azure.mgmt.avs.models.NetAppVolume :ivar disk_pool_volume: An iSCSI volume. :vartype disk_pool_volume: ~azure.mgmt.avs.models.DiskPoolVolume + :ivar elastic_san_volume: An Elastic SAN volume. + :vartype elastic_san_volume: ~azure.mgmt.avs.models.ElasticSanVolume :ivar status: The operational status of the datastore. Known values are: "Unknown", "Accessible", "Inaccessible", "Attached", "Detached", "LostCommunication", and "DeadOrError". :vartype status: str or ~azure.mgmt.avs.models.DatastoreStatus @@ -787,6 +797,7 @@ class Datastore(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "provisioning_state": {"readonly": True}, "status": {"readonly": True}, } @@ -795,9 +806,11 @@ class Datastore(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "net_app_volume": {"key": "properties.netAppVolume", "type": "NetAppVolume"}, "disk_pool_volume": {"key": "properties.diskPoolVolume", "type": "DiskPoolVolume"}, + "elastic_san_volume": {"key": "properties.elasticSanVolume", "type": "ElasticSanVolume"}, "status": {"key": "properties.status", "type": "str"}, } @@ -806,6 +819,7 @@ def __init__( *, net_app_volume: Optional["_models.NetAppVolume"] = None, disk_pool_volume: Optional["_models.DiskPoolVolume"] = None, + elastic_san_volume: Optional["_models.ElasticSanVolume"] = None, **kwargs: Any ) -> None: """ @@ -813,28 +827,30 @@ def __init__( :paramtype net_app_volume: ~azure.mgmt.avs.models.NetAppVolume :keyword disk_pool_volume: An iSCSI volume. :paramtype disk_pool_volume: ~azure.mgmt.avs.models.DiskPoolVolume + :keyword elastic_san_volume: An Elastic SAN volume. + :paramtype elastic_san_volume: ~azure.mgmt.avs.models.ElasticSanVolume """ super().__init__(**kwargs) self.provisioning_state = None self.net_app_volume = net_app_volume self.disk_pool_volume = disk_pool_volume + self.elastic_san_volume = elastic_san_volume self.status = None class DatastoreList(_serialization.Model): - """A paged list of datastores. + """The response of a Datastore list operation. - 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 server. - :ivar value: The items on a page. + :ivar value: The Datastore items on this page. Required. :vartype value: list[~azure.mgmt.avs.models.Datastore] - :ivar next_link: URL to get the next page if any. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -842,11 +858,16 @@ class DatastoreList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__(self, *, value: List["_models.Datastore"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The Datastore items on this page. Required. + :paramtype value: list[~azure.mgmt.avs.models.Datastore] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ super().__init__(**kwargs) - self.value = None - self.next_link = None + self.value = value + self.next_link = next_link class DiskPoolVolume(_serialization.Model): @@ -854,7 +875,7 @@ class DiskPoolVolume(_serialization.Model): 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. + All required parameters must be populated in order to send to server. :ivar target_id: Azure resource ID of the iSCSI target. Required. :vartype target_id: str @@ -904,6 +925,32 @@ def __init__( self.path = None +class ElasticSanVolume(_serialization.Model): + """An Elastic SAN volume from Microsoft.ElasticSan provider. + + All required parameters must be populated in order to send to server. + + :ivar target_id: Azure resource ID of the Elastic SAN Volume. Required. + :vartype target_id: str + """ + + _validation = { + "target_id": {"required": True}, + } + + _attribute_map = { + "target_id": {"key": "targetId", "type": "str"}, + } + + def __init__(self, *, target_id: str, **kwargs: Any) -> None: + """ + :keyword target_id: Azure resource ID of the Elastic SAN Volume. Required. + :paramtype target_id: str + """ + super().__init__(**kwargs) + self.target_id = target_id + + class Encryption(_serialization.Model): """The properties of customer managed encryption key. @@ -1004,24 +1051,36 @@ class Endpoints(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar nsxt_manager: Endpoint for the NSX-T Data Center manager. + :ivar nsxt_manager: Endpoint FQDN for the NSX-T Data Center manager. :vartype nsxt_manager: str - :ivar vcsa: Endpoint for Virtual Center Server Appliance. + :ivar vcsa: Endpoint FQDN for Virtual Center Server Appliance. :vartype vcsa: str - :ivar hcx_cloud_manager: Endpoint for the HCX Cloud Manager. + :ivar hcx_cloud_manager: Endpoint FQDN for the HCX Cloud Manager. :vartype hcx_cloud_manager: str + :ivar nsxt_manager_ip: Endpoint IP for the NSX-T Data Center manager. + :vartype nsxt_manager_ip: str + :ivar vcenter_ip: Endpoint IP for Virtual Center Server Appliance. + :vartype vcenter_ip: str + :ivar hcx_cloud_manager_ip: Endpoint IP for the HCX Cloud Manager. + :vartype hcx_cloud_manager_ip: str """ _validation = { "nsxt_manager": {"readonly": True}, "vcsa": {"readonly": True}, "hcx_cloud_manager": {"readonly": True}, + "nsxt_manager_ip": {"readonly": True}, + "vcenter_ip": {"readonly": True}, + "hcx_cloud_manager_ip": {"readonly": True}, } _attribute_map = { "nsxt_manager": {"key": "nsxtManager", "type": "str"}, "vcsa": {"key": "vcsa", "type": "str"}, "hcx_cloud_manager": {"key": "hcxCloudManager", "type": "str"}, + "nsxt_manager_ip": {"key": "nsxtManagerIp", "type": "str"}, + "vcenter_ip": {"key": "vcenterIp", "type": "str"}, + "hcx_cloud_manager_ip": {"key": "hcxCloudManagerIp", "type": "str"}, } def __init__(self, **kwargs: Any) -> None: @@ -1030,6 +1089,9 @@ def __init__(self, **kwargs: Any) -> None: self.nsxt_manager = None self.vcsa = None self.hcx_cloud_manager = None + self.nsxt_manager_ip = None + self.vcenter_ip = None + self.hcx_cloud_manager_ip = None class ErrorAdditionalInfo(_serialization.Model): @@ -1124,19 +1186,24 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: A self.error = error -class ExpressRouteAuthorization(Resource): +class ExpressRouteAuthorization(ProxyResource): """ExpressRoute Circuit Authorization. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :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 provisioning_state: The state of the ExpressRoute Circuit Authorization provisioning. - Known values are: "Succeeded", "Failed", "Updating", and "Canceled". + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.avs.models.SystemData + :ivar provisioning_state: The state of the ExpressRoute Circuit Authorization provisioning. + Known values are: "Succeeded", "Failed", "Canceled", and "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.ExpressRouteAuthorizationProvisioningState :ivar express_route_authorization_id: The ID of the ExpressRoute Circuit Authorization. @@ -1151,6 +1218,7 @@ class ExpressRouteAuthorization(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "provisioning_state": {"readonly": True}, "express_route_authorization_id": {"readonly": True}, "express_route_authorization_key": {"readonly": True}, @@ -1160,6 +1228,7 @@ class ExpressRouteAuthorization(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "express_route_authorization_id": {"key": "properties.expressRouteAuthorizationId", "type": "str"}, "express_route_authorization_key": {"key": "properties.expressRouteAuthorizationKey", "type": "str"}, @@ -1179,19 +1248,18 @@ def __init__(self, *, express_route_id: Optional[str] = None, **kwargs: Any) -> class ExpressRouteAuthorizationList(_serialization.Model): - """A paged list of ExpressRoute Circuit Authorizations. + """The response of a ExpressRouteAuthorization list operation. - 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 server. - :ivar value: The items on a page. + :ivar value: The ExpressRouteAuthorization items on this page. Required. :vartype value: list[~azure.mgmt.avs.models.ExpressRouteAuthorization] - :ivar next_link: URL to get the next page if any. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -1199,42 +1267,58 @@ class ExpressRouteAuthorizationList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, *, value: List["_models.ExpressRouteAuthorization"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The ExpressRouteAuthorization items on this page. Required. + :paramtype value: list[~azure.mgmt.avs.models.ExpressRouteAuthorization] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ super().__init__(**kwargs) - self.value = None - self.next_link = None + self.value = value + self.next_link = next_link -class GlobalReachConnection(Resource): +class GlobalReachConnection(ProxyResource): """A global reach connection resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.avs.models.SystemData :ivar provisioning_state: The state of the ExpressRoute Circuit Authorization provisioning. - Known values are: "Succeeded", "Failed", "Updating", and "Canceled". + Known values are: "Succeeded", "Failed", "Canceled", and "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.GlobalReachConnectionProvisioningState :ivar address_prefix: The network used for global reach carved out from the original network - block provided for the private cloud. + block + provided for the private cloud. :vartype address_prefix: str :ivar authorization_key: Authorization key from the peer express route used for the global - reach connection. + reach + connection. :vartype authorization_key: str :ivar circuit_connection_status: The connection status of the global reach connection. Known values are: "Connected", "Connecting", and "Disconnected". :vartype circuit_connection_status: str or ~azure.mgmt.avs.models.GlobalReachConnectionStatus :ivar peer_express_route_circuit: Identifier of the ExpressRoute Circuit to peer with in the - global reach connection. + global reach + connection. :vartype peer_express_route_circuit: str :ivar express_route_id: The ID of the Private Cloud's ExpressRoute Circuit that is - participating in the global reach connection. + participating in the + global reach connection. :vartype express_route_id: str """ @@ -1242,6 +1326,7 @@ class GlobalReachConnection(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "provisioning_state": {"readonly": True}, "address_prefix": {"readonly": True}, "circuit_connection_status": {"readonly": True}, @@ -1251,6 +1336,7 @@ class GlobalReachConnection(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "address_prefix": {"key": "properties.addressPrefix", "type": "str"}, "authorization_key": {"key": "properties.authorizationKey", "type": "str"}, @@ -1269,13 +1355,16 @@ def __init__( ) -> None: """ :keyword authorization_key: Authorization key from the peer express route used for the global - reach connection. + reach + connection. :paramtype authorization_key: str :keyword peer_express_route_circuit: Identifier of the ExpressRoute Circuit to peer with in the - global reach connection. + global reach + connection. :paramtype peer_express_route_circuit: str :keyword express_route_id: The ID of the Private Cloud's ExpressRoute Circuit that is - participating in the global reach connection. + participating in the + global reach connection. :paramtype express_route_id: str """ super().__init__(**kwargs) @@ -1288,19 +1377,18 @@ def __init__( class GlobalReachConnectionList(_serialization.Model): - """A paged list of global reach connections. + """The response of a GlobalReachConnection list operation. - 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 server. - :ivar value: The items on a page. + :ivar value: The GlobalReachConnection items on this page. Required. :vartype value: list[~azure.mgmt.avs.models.GlobalReachConnection] - :ivar next_link: URL to get the next page if any. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -1308,24 +1396,39 @@ class GlobalReachConnectionList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, *, value: List["_models.GlobalReachConnection"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The GlobalReachConnection items on this page. Required. + :paramtype value: list[~azure.mgmt.avs.models.GlobalReachConnection] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ super().__init__(**kwargs) - self.value = None - self.next_link = None + self.value = value + self.next_link = next_link -class HcxEnterpriseSite(Resource): +class HcxEnterpriseSite(ProxyResource): """An HCX Enterprise Site resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.avs.models.SystemData + :ivar provisioning_state: The provisioning state of the resource. Known values are: + "Succeeded", "Failed", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.HcxEnterpriseSiteProvisioningState :ivar activation_key: The activation key. :vartype activation_key: str :ivar status: The status of the HCX Enterprise Site. Known values are: "Available", "Consumed", @@ -1337,6 +1440,8 @@ class HcxEnterpriseSite(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, "activation_key": {"readonly": True}, "status": {"readonly": True}, } @@ -1345,6 +1450,8 @@ class HcxEnterpriseSite(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "activation_key": {"key": "properties.activationKey", "type": "str"}, "status": {"key": "properties.status", "type": "str"}, } @@ -1352,24 +1459,24 @@ class HcxEnterpriseSite(Resource): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) + self.provisioning_state = None self.activation_key = None self.status = None class HcxEnterpriseSiteList(_serialization.Model): - """A paged list of HCX Enterprise Sites. + """The response of a HcxEnterpriseSite list operation. - 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 server. - :ivar value: The items on a page. + :ivar value: The HcxEnterpriseSite items on this page. Required. :vartype value: list[~azure.mgmt.avs.models.HcxEnterpriseSite] - :ivar next_link: URL to get the next page if any. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -1377,11 +1484,18 @@ class HcxEnterpriseSiteList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, *, value: List["_models.HcxEnterpriseSite"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The HcxEnterpriseSite items on this page. Required. + :paramtype value: list[~azure.mgmt.avs.models.HcxEnterpriseSite] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ super().__init__(**kwargs) - self.value = None - self.next_link = None + self.value = value + self.next_link = next_link class IdentitySource(_serialization.Model): @@ -1459,10 +1573,12 @@ def __init__( "Enabled" and "Disabled". :paramtype ssl: str or ~azure.mgmt.avs.models.SslEnum :keyword username: The ID of an Active Directory user with a minimum of read-only access to - Base DN for users and group. + Base + DN for users and group. :paramtype username: str :keyword password: The password of the Active Directory user with a minimum of read-only access - to Base DN for users and groups. + to + Base DN for users and groups. :paramtype password: str """ super().__init__(**kwargs) @@ -1478,46 +1594,89 @@ def __init__( self.password = password -class LogSpecification(_serialization.Model): - """Specifications of the Log for Azure Monitoring. +class IscsiPath(ProxyResource): + """An iSCSI path resource. + + Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: Name of the log. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. :vartype name: str - :ivar display_name: Localized friendly display name of the log. - :vartype display_name: str - :ivar blob_duration: Blob duration of the log. - :vartype blob_duration: 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.avs.models.SystemData + :ivar provisioning_state: The state of the iSCSI path provisioning. Known values are: + "Succeeded", "Failed", "Canceled", "Pending", "Building", "Deleting", and "Updating". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.IscsiPathProvisioningState + :ivar network_block: CIDR Block for iSCSI path. + :vartype network_block: str """ + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + _attribute_map = { + "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "blob_duration": {"key": "blobDuration", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "network_block": {"key": "properties.networkBlock", "type": "str"}, } - def __init__( - self, - *, - name: Optional[str] = None, - display_name: Optional[str] = None, - blob_duration: Optional[str] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, network_block: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword name: Name of the log. - :paramtype name: str - :keyword display_name: Localized friendly display name of the log. - :paramtype display_name: str - :keyword blob_duration: Blob duration of the log. - :paramtype blob_duration: str + :keyword network_block: CIDR Block for iSCSI path. + :paramtype network_block: str """ super().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.blob_duration = blob_duration + self.provisioning_state = None + self.network_block = network_block + + +class IscsiPathListResult(_serialization.Model): + """The response of a IscsiPath list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The IscsiPath items on this page. Required. + :vartype value: list[~azure.mgmt.avs.models.IscsiPath] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[IscsiPath]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + def __init__(self, *, value: List["_models.IscsiPath"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The IscsiPath items on this page. Required. + :paramtype value: list[~azure.mgmt.avs.models.IscsiPath] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link -class ManagementCluster(CommonClusterProperties): + +class ManagementCluster(_serialization.Model): """The properties of a management cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -1525,12 +1684,14 @@ class ManagementCluster(CommonClusterProperties): :ivar cluster_size: The cluster size. :vartype cluster_size: int :ivar provisioning_state: The state of the cluster provisioning. Known values are: "Succeeded", - "Failed", "Cancelled", "Deleting", "Updating", and "Canceled". + "Failed", "Canceled", "Cancelled", "Deleting", and "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.ClusterProvisioningState :ivar cluster_id: The identity. :vartype cluster_id: int :ivar hosts: The hosts. :vartype hosts: list[str] + :ivar vsan_datastore_name: Name of the vsan datastore associated with the cluster. + :vartype vsan_datastore_name: str """ _validation = { @@ -1543,186 +1704,37 @@ class ManagementCluster(CommonClusterProperties): "provisioning_state": {"key": "provisioningState", "type": "str"}, "cluster_id": {"key": "clusterId", "type": "int"}, "hosts": {"key": "hosts", "type": "[str]"}, + "vsan_datastore_name": {"key": "vsanDatastoreName", "type": "str"}, } - def __init__(self, *, cluster_size: Optional[int] = None, hosts: Optional[List[str]] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + cluster_size: Optional[int] = None, + hosts: Optional[List[str]] = None, + vsan_datastore_name: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword cluster_size: The cluster size. :paramtype cluster_size: int :keyword hosts: The hosts. :paramtype hosts: list[str] - """ - super().__init__(cluster_size=cluster_size, hosts=hosts, **kwargs) - - -class MetricDimension(_serialization.Model): - """Specifications of the Dimension of metrics. - - :ivar name: Name of the dimension. - :vartype name: str - :ivar display_name: Localized friendly display name of the dimension. - :vartype display_name: str - :ivar internal_name: Name of the dimension as it appears in MDM. - :vartype internal_name: str - :ivar to_be_exported_for_shoebox: A boolean flag indicating whether this dimension should be - included for the shoebox export scenario. - :vartype to_be_exported_for_shoebox: bool - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "internal_name": {"key": "internalName", "type": "str"}, - "to_be_exported_for_shoebox": {"key": "toBeExportedForShoebox", "type": "bool"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - display_name: Optional[str] = None, - internal_name: Optional[str] = None, - to_be_exported_for_shoebox: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Name of the dimension. - :paramtype name: str - :keyword display_name: Localized friendly display name of the dimension. - :paramtype display_name: str - :keyword internal_name: Name of the dimension as it appears in MDM. - :paramtype internal_name: str - :keyword to_be_exported_for_shoebox: A boolean flag indicating whether this dimension should be - included for the shoebox export scenario. - :paramtype to_be_exported_for_shoebox: bool + :keyword vsan_datastore_name: Name of the vsan datastore associated with the cluster. + :paramtype vsan_datastore_name: str """ super().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.internal_name = internal_name - self.to_be_exported_for_shoebox = to_be_exported_for_shoebox - - -class MetricSpecification(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Specifications of the Metrics for Azure Monitoring. - - :ivar name: Name of the metric. - :vartype name: str - :ivar display_name: Localized friendly display name of the metric. - :vartype display_name: str - :ivar display_description: Localized friendly description of the metric. - :vartype display_description: str - :ivar unit: Unit that makes sense for the metric. - :vartype unit: str - :ivar category: Name of the metric category that the metric belongs to. A metric can only - belong to a single category. - :vartype category: str - :ivar aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, - Maximum, Total, Count. - :vartype aggregation_type: str - :ivar supported_aggregation_types: Supported aggregation types. - :vartype supported_aggregation_types: list[str] - :ivar supported_time_grain_types: Supported time grain types. - :vartype supported_time_grain_types: list[str] - :ivar fill_gap_with_zero: Optional. If set to true, then zero will be returned for time - duration where no metric is emitted/published. - :vartype fill_gap_with_zero: bool - :ivar dimensions: Dimensions of the metric. - :vartype dimensions: list[~azure.mgmt.avs.models.MetricDimension] - :ivar enable_regional_mdm_account: Whether or not the service is using regional MDM accounts. - :vartype enable_regional_mdm_account: str - :ivar source_mdm_account: The name of the MDM account. - :vartype source_mdm_account: str - :ivar source_mdm_namespace: The name of the MDM namespace. - :vartype source_mdm_namespace: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "display_description": {"key": "displayDescription", "type": "str"}, - "unit": {"key": "unit", "type": "str"}, - "category": {"key": "category", "type": "str"}, - "aggregation_type": {"key": "aggregationType", "type": "str"}, - "supported_aggregation_types": {"key": "supportedAggregationTypes", "type": "[str]"}, - "supported_time_grain_types": {"key": "supportedTimeGrainTypes", "type": "[str]"}, - "fill_gap_with_zero": {"key": "fillGapWithZero", "type": "bool"}, - "dimensions": {"key": "dimensions", "type": "[MetricDimension]"}, - "enable_regional_mdm_account": {"key": "enableRegionalMdmAccount", "type": "str"}, - "source_mdm_account": {"key": "sourceMdmAccount", "type": "str"}, - "source_mdm_namespace": {"key": "sourceMdmNamespace", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - display_name: Optional[str] = None, - display_description: Optional[str] = None, - unit: Optional[str] = None, - category: Optional[str] = None, - aggregation_type: Optional[str] = None, - supported_aggregation_types: Optional[List[str]] = None, - supported_time_grain_types: Optional[List[str]] = None, - fill_gap_with_zero: Optional[bool] = None, - dimensions: Optional[List["_models.MetricDimension"]] = None, - enable_regional_mdm_account: Optional[str] = None, - source_mdm_account: Optional[str] = None, - source_mdm_namespace: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Name of the metric. - :paramtype name: str - :keyword display_name: Localized friendly display name of the metric. - :paramtype display_name: str - :keyword display_description: Localized friendly description of the metric. - :paramtype display_description: str - :keyword unit: Unit that makes sense for the metric. - :paramtype unit: str - :keyword category: Name of the metric category that the metric belongs to. A metric can only - belong to a single category. - :paramtype category: str - :keyword aggregation_type: Only provide one value for this field. Valid values: Average, - Minimum, Maximum, Total, Count. - :paramtype aggregation_type: str - :keyword supported_aggregation_types: Supported aggregation types. - :paramtype supported_aggregation_types: list[str] - :keyword supported_time_grain_types: Supported time grain types. - :paramtype supported_time_grain_types: list[str] - :keyword fill_gap_with_zero: Optional. If set to true, then zero will be returned for time - duration where no metric is emitted/published. - :paramtype fill_gap_with_zero: bool - :keyword dimensions: Dimensions of the metric. - :paramtype dimensions: list[~azure.mgmt.avs.models.MetricDimension] - :keyword enable_regional_mdm_account: Whether or not the service is using regional MDM - accounts. - :paramtype enable_regional_mdm_account: str - :keyword source_mdm_account: The name of the MDM account. - :paramtype source_mdm_account: str - :keyword source_mdm_namespace: The name of the MDM namespace. - :paramtype source_mdm_namespace: str - """ - super().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.display_description = display_description - self.unit = unit - self.category = category - self.aggregation_type = aggregation_type - self.supported_aggregation_types = supported_aggregation_types - self.supported_time_grain_types = supported_time_grain_types - self.fill_gap_with_zero = fill_gap_with_zero - self.dimensions = dimensions - self.enable_regional_mdm_account = enable_regional_mdm_account - self.source_mdm_account = source_mdm_account - self.source_mdm_namespace = source_mdm_namespace + self.cluster_size = cluster_size + self.provisioning_state = None + self.cluster_id = None + self.hosts = hosts + self.vsan_datastore_name = vsan_datastore_name class NetAppVolume(_serialization.Model): """An Azure NetApp Files volume from Microsoft.NetApp provider. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Azure resource ID of the NetApp volume. Required. :vartype id: str @@ -1746,73 +1758,71 @@ def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefi class Operation(_serialization.Model): - """A REST API operation. + """Details of a REST API operation, returned from the Resource Provider Operations API. Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: Name of the operation being performed on this object. + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". :vartype name: str - :ivar display: Contains the localized display information for this operation. - :vartype display: ~azure.mgmt.avs.models.OperationDisplay - :ivar is_data_action: Gets or sets a value indicating whether the operation is a data action or - not. + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for + data-plane operations and "false" for ARM/control-plane operations. :vartype is_data_action: bool - :ivar origin: Origin of the operation. - :vartype origin: str - :ivar properties: Properties of the operation. - :vartype properties: ~azure.mgmt.avs.models.OperationProperties + :ivar display: Localized display information for this particular operation. + :vartype display: ~azure.mgmt.avs.models.OperationDisplay + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", + and "user,system". + :vartype origin: str or ~azure.mgmt.avs.models.Origin + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. "Internal" + :vartype action_type: str or ~azure.mgmt.avs.models.ActionType """ _validation = { "name": {"readonly": True}, - "display": {"readonly": True}, + "is_data_action": {"readonly": True}, + "origin": {"readonly": True}, + "action_type": {"readonly": True}, } _attribute_map = { "name": {"key": "name", "type": "str"}, - "display": {"key": "display", "type": "OperationDisplay"}, "is_data_action": {"key": "isDataAction", "type": "bool"}, + "display": {"key": "display", "type": "OperationDisplay"}, "origin": {"key": "origin", "type": "str"}, - "properties": {"key": "properties", "type": "OperationProperties"}, + "action_type": {"key": "actionType", "type": "str"}, } - def __init__( - self, - *, - is_data_action: Optional[bool] = None, - origin: Optional[str] = None, - properties: Optional["_models.OperationProperties"] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ - :keyword is_data_action: Gets or sets a value indicating whether the operation is a data action - or not. - :paramtype is_data_action: bool - :keyword origin: Origin of the operation. - :paramtype origin: str - :keyword properties: Properties of the operation. - :paramtype properties: ~azure.mgmt.avs.models.OperationProperties + :keyword display: Localized display information for this particular operation. + :paramtype display: ~azure.mgmt.avs.models.OperationDisplay """ super().__init__(**kwargs) self.name = None - self.display = None - self.is_data_action = is_data_action - self.origin = origin - self.properties = properties + self.is_data_action = None + self.display = display + self.origin = None + self.action_type = None class OperationDisplay(_serialization.Model): - """Contains the localized display information for this operation. + """Localized display information for this particular operation. Variables are only populated by the server, and will be ignored when sending a request. - :ivar provider: Localized friendly form of the resource provider name. + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". :vartype provider: str - :ivar resource: Localized friendly form of the resource type related to this operation. + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". :vartype resource: str - :ivar operation: Localized friendly name for the operation. + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". :vartype operation: str - :ivar description: Localized friendly description for the operation. + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. :vartype description: str """ @@ -1839,14 +1849,15 @@ def __init__(self, **kwargs: Any) -> None: self.description = None -class OperationList(_serialization.Model): - """Pageable list of operations. +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. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: List of operations. + :ivar value: List of operations supported by the resource provider. :vartype value: list[~azure.mgmt.avs.models.Operation] - :ivar next_link: URL to get the next page if any. + :ivar next_link: URL to get the next set of operation list results (if there are any). :vartype next_link: str """ @@ -1867,42 +1878,19 @@ def __init__(self, **kwargs: Any) -> None: self.next_link = None -class OperationProperties(_serialization.Model): - """Extra Operation properties. - - :ivar service_specification: Service specifications of the operation. - :vartype service_specification: ~azure.mgmt.avs.models.ServiceSpecification - """ - - _attribute_map = { - "service_specification": {"key": "serviceSpecification", "type": "ServiceSpecification"}, - } - - def __init__( - self, *, service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs: Any - ) -> None: - """ - :keyword service_specification: Service specifications of the operation. - :paramtype service_specification: ~azure.mgmt.avs.models.ServiceSpecification - """ - super().__init__(**kwargs) - self.service_specification = service_specification - - class PlacementPoliciesList(_serialization.Model): - """Represents list of placement policies. + """The response of a PlacementPolicy list operation. - 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 server. - :ivar value: The items on the page. + :ivar value: The PlacementPolicy items on this page. Required. :vartype value: list[~azure.mgmt.avs.models.PlacementPolicy] - :ivar next_link: URL to get the next page if any. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -1910,25 +1898,37 @@ class PlacementPoliciesList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, *, value: List["_models.PlacementPolicy"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The PlacementPolicy items on this page. Required. + :paramtype value: list[~azure.mgmt.avs.models.PlacementPolicy] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ super().__init__(**kwargs) - self.value = None - self.next_link = None + self.value = value + self.next_link = next_link -class PlacementPolicy(Resource): +class PlacementPolicy(ProxyResource): """A vSphere Distributed Resource Scheduler (DRS) placement policy. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :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 properties: placement policy properties. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.avs.models.SystemData + :ivar properties: The resource-specific properties for this resource. :vartype properties: ~azure.mgmt.avs.models.PlacementPolicyProperties """ @@ -1936,18 +1936,20 @@ class PlacementPolicy(Resource): "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"}, "properties": {"key": "properties", "type": "PlacementPolicyProperties"}, } def __init__(self, *, properties: Optional["_models.PlacementPolicyProperties"] = None, **kwargs: Any) -> None: """ - :keyword properties: placement policy properties. + :keyword properties: The resource-specific properties for this resource. :paramtype properties: ~azure.mgmt.avs.models.PlacementPolicyProperties """ super().__init__(**kwargs) @@ -1962,9 +1964,9 @@ class PlacementPolicyProperties(_serialization.Model): 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. + All required parameters must be populated in order to send to server. - :ivar type: placement policy type. Required. Known values are: "VmVm" and "VmHost". + :ivar type: Placement Policy type. Required. Known values are: "VmVm" and "VmHost". :vartype type: str or ~azure.mgmt.avs.models.PlacementPolicyType :ivar state: Whether the placement policy is enabled or disabled. Known values are: "Enabled" and "Disabled". @@ -1972,7 +1974,7 @@ class PlacementPolicyProperties(_serialization.Model): :ivar display_name: Display name of the placement policy. :vartype display_name: str :ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed", - "Building", "Deleting", "Updating", and "Canceled". + "Canceled", "Building", "Deleting", and "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.PlacementPolicyProvisioningState """ @@ -2071,46 +2073,57 @@ def __init__( class TrackedResource(Resource): - """The resource model definition for a ARM tracked top level resource. + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :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: Resource location. - :vartype location: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.avs.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, } - def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ - :keyword location: Resource location. - :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str """ super().__init__(**kwargs) - self.location = location self.tags = tags + self.location = location class PrivateCloud(TrackedResource): # pylint: disable=too-many-instance-attributes @@ -2118,21 +2131,26 @@ class PrivateCloud(TrackedResource): # pylint: disable=too-many-instance-attrib 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. + All required parameters must be populated in order to send to server. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :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: Resource location. - :vartype location: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.avs.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar sku: The private cloud SKU. Required. + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar sku: The SKU (Stock Keeping Unit) assigned to this resource. Required. :vartype sku: ~azure.mgmt.avs.models.Sku - :ivar identity: The identity of the private cloud, if configured. + :ivar identity: The managed service identities assigned to this resource. :vartype identity: ~azure.mgmt.avs.models.PrivateCloudIdentity :ivar management_cluster: The default cluster used for management. :vartype management_cluster: ~azure.mgmt.avs.models.ManagementCluster @@ -2147,19 +2165,22 @@ class PrivateCloud(TrackedResource): # pylint: disable=too-many-instance-attrib :ivar encryption: Customer managed key encryption, can be enabled or disabled. :vartype encryption: ~azure.mgmt.avs.models.Encryption :ivar extended_network_blocks: Array of additional networks noncontiguous with networkBlock. - Networks must be unique and non-overlapping across VNet in your subscription, on-premise, and - this privateCloud networkBlock attribute. Make sure the CIDR format conforms to (A.B.C.D/X). + Networks must be + unique and non-overlapping across VNet in your subscription, on-premise, and + this privateCloud networkBlock attribute. Make sure the CIDR format conforms to + (A.B.C.D/X). :vartype extended_network_blocks: list[str] :ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed", - "Cancelled", "Pending", "Building", "Deleting", "Updating", and "Canceled". + "Canceled", "Cancelled", "Pending", "Building", "Deleting", and "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.PrivateCloudProvisioningState :ivar circuit: An ExpressRoute Circuit. :vartype circuit: ~azure.mgmt.avs.models.Circuit :ivar endpoints: The endpoints. :vartype endpoints: ~azure.mgmt.avs.models.Endpoints :ivar network_block: The block of addresses should be unique across VNet in your subscription - as well as on-premise. Make sure the CIDR format is conformed to (A.B.C.D/X) where A,B,C,D are - between 0 and 255, and X is between 0 and 22. + as + well as on-premise. Make sure the CIDR format is conformed to (A.B.C.D/X) where + A,B,C,D are between 0 and 255, and X is between 0 and 22. :vartype network_block: str :ivar management_network: Network used to access vCenter Server and NSX-T Manager. :vartype management_network: str @@ -2184,15 +2205,21 @@ class PrivateCloud(TrackedResource): # pylint: disable=too-many-instance-attrib stretched private cloud. :vartype secondary_circuit: ~azure.mgmt.avs.models.Circuit :ivar nsx_public_ip_quota_raised: Flag to indicate whether the private cloud has the quota for - provisioned NSX Public IP count raised from 64 to 1024. Known values are: "Enabled" and - "Disabled". + provisioned NSX + Public IP count raised from 64 to 1024. Known values are: "Enabled" and "Disabled". :vartype nsx_public_ip_quota_raised: str or ~azure.mgmt.avs.models.NsxPublicIpQuotaRaisedEnum + :ivar virtual_network_id: Azure resource ID of the virtual network. + :vartype virtual_network_id: str + :ivar dns_zone_type: The type of DNS zone to use. Known values are: "Public" and "Private". + :vartype dns_zone_type: str or ~azure.mgmt.avs.models.DnsZoneType """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, "sku": {"required": True}, "provisioning_state": {"readonly": True}, "endpoints": {"readonly": True}, @@ -2209,8 +2236,9 @@ class PrivateCloud(TrackedResource): # pylint: disable=too-many-instance-attrib "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, "sku": {"key": "sku", "type": "Sku"}, "identity": {"key": "identity", "type": "PrivateCloudIdentity"}, "management_cluster": {"key": "properties.managementCluster", "type": "ManagementCluster"}, @@ -2233,17 +2261,19 @@ class PrivateCloud(TrackedResource): # pylint: disable=too-many-instance-attrib "external_cloud_links": {"key": "properties.externalCloudLinks", "type": "[str]"}, "secondary_circuit": {"key": "properties.secondaryCircuit", "type": "Circuit"}, "nsx_public_ip_quota_raised": {"key": "properties.nsxPublicIpQuotaRaised", "type": "str"}, + "virtual_network_id": {"key": "properties.virtualNetworkId", "type": "str"}, + "dns_zone_type": {"key": "properties.dnsZoneType", "type": "str"}, } def __init__( # pylint: disable=too-many-locals self, *, + location: str, sku: "_models.Sku", - location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, identity: Optional["_models.PrivateCloudIdentity"] = None, management_cluster: Optional["_models.ManagementCluster"] = None, - internet: Union[str, "_models.InternetEnum"] = "Disabled", + internet: Optional[Union[str, "_models.InternetEnum"]] = None, identity_sources: Optional[List["_models.IdentitySource"]] = None, availability: Optional["_models.AvailabilityProperties"] = None, encryption: Optional["_models.Encryption"] = None, @@ -2253,16 +2283,18 @@ def __init__( # pylint: disable=too-many-locals vcenter_password: Optional[str] = None, nsxt_password: Optional[str] = None, secondary_circuit: Optional["_models.Circuit"] = None, + virtual_network_id: Optional[str] = None, + dns_zone_type: Optional[Union[str, "_models.DnsZoneType"]] = None, **kwargs: Any ) -> None: """ - :keyword location: Resource location. - :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword sku: The private cloud SKU. Required. + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword sku: The SKU (Stock Keeping Unit) assigned to this resource. Required. :paramtype sku: ~azure.mgmt.avs.models.Sku - :keyword identity: The identity of the private cloud, if configured. + :keyword identity: The managed service identities assigned to this resource. :paramtype identity: ~azure.mgmt.avs.models.PrivateCloudIdentity :keyword management_cluster: The default cluster used for management. :paramtype management_cluster: ~azure.mgmt.avs.models.ManagementCluster @@ -2277,13 +2309,16 @@ def __init__( # pylint: disable=too-many-locals :keyword encryption: Customer managed key encryption, can be enabled or disabled. :paramtype encryption: ~azure.mgmt.avs.models.Encryption :keyword extended_network_blocks: Array of additional networks noncontiguous with networkBlock. - Networks must be unique and non-overlapping across VNet in your subscription, on-premise, and - this privateCloud networkBlock attribute. Make sure the CIDR format conforms to (A.B.C.D/X). + Networks must be + unique and non-overlapping across VNet in your subscription, on-premise, and + this privateCloud networkBlock attribute. Make sure the CIDR format conforms to + (A.B.C.D/X). :paramtype extended_network_blocks: list[str] :keyword circuit: An ExpressRoute Circuit. :paramtype circuit: ~azure.mgmt.avs.models.Circuit :keyword network_block: The block of addresses should be unique across VNet in your - subscription as well as on-premise. Make sure the CIDR format is conformed to (A.B.C.D/X) where + subscription as + well as on-premise. Make sure the CIDR format is conformed to (A.B.C.D/X) where A,B,C,D are between 0 and 255, and X is between 0 and 22. :paramtype network_block: str :keyword vcenter_password: Optionally, set the vCenter admin password when the private cloud is @@ -2293,10 +2328,15 @@ def __init__( # pylint: disable=too-many-locals created. :paramtype nsxt_password: str :keyword secondary_circuit: A secondary expressRoute circuit from a separate AZ. Only present - in a stretched private cloud. + in a + stretched private cloud. :paramtype secondary_circuit: ~azure.mgmt.avs.models.Circuit + :keyword virtual_network_id: Azure resource ID of the virtual network. + :paramtype virtual_network_id: str + :keyword dns_zone_type: The type of DNS zone to use. Known values are: "Public" and "Private". + :paramtype dns_zone_type: str or ~azure.mgmt.avs.models.DnsZoneType """ - super().__init__(location=location, tags=tags, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.sku = sku self.identity = identity self.management_cluster = management_cluster @@ -2319,28 +2359,32 @@ def __init__( # pylint: disable=too-many-locals self.external_cloud_links = None self.secondary_circuit = secondary_circuit self.nsx_public_ip_quota_raised = None + self.virtual_network_id = virtual_network_id + self.dns_zone_type = dns_zone_type class PrivateCloudIdentity(_serialization.Model): - """Identity for the virtual machine. + """Managed service identity (either system assigned, or none). Variables are only populated by the server, and will be ignored when sending a request. - :ivar principal_id: The principal ID of private cloud identity. This property will only be - provided for a system assigned identity. + All required parameters must be populated in order to send to server. + + :ivar principal_id: The service principal ID of the system assigned identity. This property + will only be provided for a system assigned identity. :vartype principal_id: str - :ivar tenant_id: The tenant ID associated with the private cloud. This property will only be + :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. :vartype tenant_id: str - :ivar type: The type of identity used for the private cloud. The type 'SystemAssigned' refers - to an implicitly created identity. The type 'None' will remove any identities from the Private - Cloud. Known values are: "SystemAssigned" and "None". + :ivar type: Type of managed service identity (either system assigned, or none). Required. Known + values are: "None" and "SystemAssigned". :vartype type: str or ~azure.mgmt.avs.models.ResourceIdentityType """ _validation = { "principal_id": {"readonly": True}, "tenant_id": {"readonly": True}, + "type": {"required": True}, } _attribute_map = { @@ -2349,11 +2393,10 @@ class PrivateCloudIdentity(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, **kwargs: Any) -> None: + def __init__(self, *, type: Union[str, "_models.ResourceIdentityType"], **kwargs: Any) -> None: """ - :keyword type: The type of identity used for the private cloud. The type 'SystemAssigned' - refers to an implicitly created identity. The type 'None' will remove any identities from the - Private Cloud. Known values are: "SystemAssigned" and "None". + :keyword type: Type of managed service identity (either system assigned, or none). Required. + Known values are: "None" and "SystemAssigned". :paramtype type: str or ~azure.mgmt.avs.models.ResourceIdentityType """ super().__init__(**kwargs) @@ -2363,19 +2406,18 @@ def __init__(self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] class PrivateCloudList(_serialization.Model): - """A paged list of private clouds. + """The response of a PrivateCloud list operation. - 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 server. - :ivar value: The items on the page. + :ivar value: The PrivateCloud items on this page. Required. :vartype value: list[~azure.mgmt.avs.models.PrivateCloud] - :ivar next_link: URL to get the next page if any. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -2383,251 +2425,16 @@ class PrivateCloudList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - self.next_link = None - - -class PrivateCloudUpdateProperties(_serialization.Model): - """The properties of a private cloud resource that may be updated. - - :ivar management_cluster: The default cluster used for management. - :vartype management_cluster: ~azure.mgmt.avs.models.ManagementCluster - :ivar internet: Connectivity to internet is enabled or disabled. Known values are: "Enabled" - and "Disabled". - :vartype internet: str or ~azure.mgmt.avs.models.InternetEnum - :ivar identity_sources: vCenter Single Sign On Identity Sources. - :vartype identity_sources: list[~azure.mgmt.avs.models.IdentitySource] - :ivar availability: Properties describing how the cloud is distributed across availability - zones. - :vartype availability: ~azure.mgmt.avs.models.AvailabilityProperties - :ivar encryption: Customer managed key encryption, can be enabled or disabled. - :vartype encryption: ~azure.mgmt.avs.models.Encryption - :ivar extended_network_blocks: Array of additional networks noncontiguous with networkBlock. - Networks must be unique and non-overlapping across VNet in your subscription, on-premise, and - this privateCloud networkBlock attribute. Make sure the CIDR format conforms to (A.B.C.D/X). - :vartype extended_network_blocks: list[str] - """ - - _attribute_map = { - "management_cluster": {"key": "managementCluster", "type": "ManagementCluster"}, - "internet": {"key": "internet", "type": "str"}, - "identity_sources": {"key": "identitySources", "type": "[IdentitySource]"}, - "availability": {"key": "availability", "type": "AvailabilityProperties"}, - "encryption": {"key": "encryption", "type": "Encryption"}, - "extended_network_blocks": {"key": "extendedNetworkBlocks", "type": "[str]"}, - } - - def __init__( - self, - *, - management_cluster: Optional["_models.ManagementCluster"] = None, - internet: Union[str, "_models.InternetEnum"] = "Disabled", - identity_sources: Optional[List["_models.IdentitySource"]] = None, - availability: Optional["_models.AvailabilityProperties"] = None, - encryption: Optional["_models.Encryption"] = None, - extended_network_blocks: Optional[List[str]] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, value: List["_models.PrivateCloud"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword management_cluster: The default cluster used for management. - :paramtype management_cluster: ~azure.mgmt.avs.models.ManagementCluster - :keyword internet: Connectivity to internet is enabled or disabled. Known values are: "Enabled" - and "Disabled". - :paramtype internet: str or ~azure.mgmt.avs.models.InternetEnum - :keyword identity_sources: vCenter Single Sign On Identity Sources. - :paramtype identity_sources: list[~azure.mgmt.avs.models.IdentitySource] - :keyword availability: Properties describing how the cloud is distributed across availability - zones. - :paramtype availability: ~azure.mgmt.avs.models.AvailabilityProperties - :keyword encryption: Customer managed key encryption, can be enabled or disabled. - :paramtype encryption: ~azure.mgmt.avs.models.Encryption - :keyword extended_network_blocks: Array of additional networks noncontiguous with networkBlock. - Networks must be unique and non-overlapping across VNet in your subscription, on-premise, and - this privateCloud networkBlock attribute. Make sure the CIDR format conforms to (A.B.C.D/X). - :paramtype extended_network_blocks: list[str] + :keyword value: The PrivateCloud items on this page. Required. + :paramtype value: list[~azure.mgmt.avs.models.PrivateCloud] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str """ super().__init__(**kwargs) - self.management_cluster = management_cluster - self.internet = internet - self.identity_sources = identity_sources - self.availability = availability - self.encryption = encryption - self.extended_network_blocks = extended_network_blocks - - -class PrivateCloudProperties(PrivateCloudUpdateProperties): # pylint: disable=too-many-instance-attributes - """The properties of a private cloud resource. - - 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 management_cluster: The default cluster used for management. - :vartype management_cluster: ~azure.mgmt.avs.models.ManagementCluster - :ivar internet: Connectivity to internet is enabled or disabled. Known values are: "Enabled" - and "Disabled". - :vartype internet: str or ~azure.mgmt.avs.models.InternetEnum - :ivar identity_sources: vCenter Single Sign On Identity Sources. - :vartype identity_sources: list[~azure.mgmt.avs.models.IdentitySource] - :ivar availability: Properties describing how the cloud is distributed across availability - zones. - :vartype availability: ~azure.mgmt.avs.models.AvailabilityProperties - :ivar encryption: Customer managed key encryption, can be enabled or disabled. - :vartype encryption: ~azure.mgmt.avs.models.Encryption - :ivar extended_network_blocks: Array of additional networks noncontiguous with networkBlock. - Networks must be unique and non-overlapping across VNet in your subscription, on-premise, and - this privateCloud networkBlock attribute. Make sure the CIDR format conforms to (A.B.C.D/X). - :vartype extended_network_blocks: list[str] - :ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed", - "Cancelled", "Pending", "Building", "Deleting", "Updating", and "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.avs.models.PrivateCloudProvisioningState - :ivar circuit: An ExpressRoute Circuit. - :vartype circuit: ~azure.mgmt.avs.models.Circuit - :ivar endpoints: The endpoints. - :vartype endpoints: ~azure.mgmt.avs.models.Endpoints - :ivar network_block: The block of addresses should be unique across VNet in your subscription - as well as on-premise. Make sure the CIDR format is conformed to (A.B.C.D/X) where A,B,C,D are - between 0 and 255, and X is between 0 and 22. Required. - :vartype network_block: str - :ivar management_network: Network used to access vCenter Server and NSX-T Manager. - :vartype management_network: str - :ivar provisioning_network: Used for virtual machine cold migration, cloning, and snapshot - migration. - :vartype provisioning_network: str - :ivar vmotion_network: Used for live migration of virtual machines. - :vartype vmotion_network: str - :ivar vcenter_password: Optionally, set the vCenter admin password when the private cloud is - created. - :vartype vcenter_password: str - :ivar nsxt_password: Optionally, set the NSX-T Manager password when the private cloud is - created. - :vartype nsxt_password: str - :ivar vcenter_certificate_thumbprint: Thumbprint of the vCenter Server SSL certificate. - :vartype vcenter_certificate_thumbprint: str - :ivar nsxt_certificate_thumbprint: Thumbprint of the NSX-T Manager SSL certificate. - :vartype nsxt_certificate_thumbprint: str - :ivar external_cloud_links: Array of cloud link IDs from other clouds that connect to this one. - :vartype external_cloud_links: list[str] - :ivar secondary_circuit: A secondary expressRoute circuit from a separate AZ. Only present in a - stretched private cloud. - :vartype secondary_circuit: ~azure.mgmt.avs.models.Circuit - :ivar nsx_public_ip_quota_raised: Flag to indicate whether the private cloud has the quota for - provisioned NSX Public IP count raised from 64 to 1024. Known values are: "Enabled" and - "Disabled". - :vartype nsx_public_ip_quota_raised: str or ~azure.mgmt.avs.models.NsxPublicIpQuotaRaisedEnum - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "endpoints": {"readonly": True}, - "network_block": {"required": True}, - "management_network": {"readonly": True}, - "provisioning_network": {"readonly": True}, - "vmotion_network": {"readonly": True}, - "vcenter_certificate_thumbprint": {"readonly": True}, - "nsxt_certificate_thumbprint": {"readonly": True}, - "external_cloud_links": {"readonly": True}, - "nsx_public_ip_quota_raised": {"readonly": True}, - } - - _attribute_map = { - "management_cluster": {"key": "managementCluster", "type": "ManagementCluster"}, - "internet": {"key": "internet", "type": "str"}, - "identity_sources": {"key": "identitySources", "type": "[IdentitySource]"}, - "availability": {"key": "availability", "type": "AvailabilityProperties"}, - "encryption": {"key": "encryption", "type": "Encryption"}, - "extended_network_blocks": {"key": "extendedNetworkBlocks", "type": "[str]"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "circuit": {"key": "circuit", "type": "Circuit"}, - "endpoints": {"key": "endpoints", "type": "Endpoints"}, - "network_block": {"key": "networkBlock", "type": "str"}, - "management_network": {"key": "managementNetwork", "type": "str"}, - "provisioning_network": {"key": "provisioningNetwork", "type": "str"}, - "vmotion_network": {"key": "vmotionNetwork", "type": "str"}, - "vcenter_password": {"key": "vcenterPassword", "type": "str"}, - "nsxt_password": {"key": "nsxtPassword", "type": "str"}, - "vcenter_certificate_thumbprint": {"key": "vcenterCertificateThumbprint", "type": "str"}, - "nsxt_certificate_thumbprint": {"key": "nsxtCertificateThumbprint", "type": "str"}, - "external_cloud_links": {"key": "externalCloudLinks", "type": "[str]"}, - "secondary_circuit": {"key": "secondaryCircuit", "type": "Circuit"}, - "nsx_public_ip_quota_raised": {"key": "nsxPublicIpQuotaRaised", "type": "str"}, - } - - def __init__( - self, - *, - network_block: str, - management_cluster: Optional["_models.ManagementCluster"] = None, - internet: Union[str, "_models.InternetEnum"] = "Disabled", - identity_sources: Optional[List["_models.IdentitySource"]] = None, - availability: Optional["_models.AvailabilityProperties"] = None, - encryption: Optional["_models.Encryption"] = None, - extended_network_blocks: Optional[List[str]] = None, - circuit: Optional["_models.Circuit"] = None, - vcenter_password: Optional[str] = None, - nsxt_password: Optional[str] = None, - secondary_circuit: Optional["_models.Circuit"] = None, - **kwargs: Any - ) -> None: - """ - :keyword management_cluster: The default cluster used for management. - :paramtype management_cluster: ~azure.mgmt.avs.models.ManagementCluster - :keyword internet: Connectivity to internet is enabled or disabled. Known values are: "Enabled" - and "Disabled". - :paramtype internet: str or ~azure.mgmt.avs.models.InternetEnum - :keyword identity_sources: vCenter Single Sign On Identity Sources. - :paramtype identity_sources: list[~azure.mgmt.avs.models.IdentitySource] - :keyword availability: Properties describing how the cloud is distributed across availability - zones. - :paramtype availability: ~azure.mgmt.avs.models.AvailabilityProperties - :keyword encryption: Customer managed key encryption, can be enabled or disabled. - :paramtype encryption: ~azure.mgmt.avs.models.Encryption - :keyword extended_network_blocks: Array of additional networks noncontiguous with networkBlock. - Networks must be unique and non-overlapping across VNet in your subscription, on-premise, and - this privateCloud networkBlock attribute. Make sure the CIDR format conforms to (A.B.C.D/X). - :paramtype extended_network_blocks: list[str] - :keyword circuit: An ExpressRoute Circuit. - :paramtype circuit: ~azure.mgmt.avs.models.Circuit - :keyword network_block: The block of addresses should be unique across VNet in your - subscription as well as on-premise. Make sure the CIDR format is conformed to (A.B.C.D/X) where - A,B,C,D are between 0 and 255, and X is between 0 and 22. Required. - :paramtype network_block: str - :keyword vcenter_password: Optionally, set the vCenter admin password when the private cloud is - created. - :paramtype vcenter_password: str - :keyword nsxt_password: Optionally, set the NSX-T Manager password when the private cloud is - created. - :paramtype nsxt_password: str - :keyword secondary_circuit: A secondary expressRoute circuit from a separate AZ. Only present - in a stretched private cloud. - :paramtype secondary_circuit: ~azure.mgmt.avs.models.Circuit - """ - super().__init__( - management_cluster=management_cluster, - internet=internet, - identity_sources=identity_sources, - availability=availability, - encryption=encryption, - extended_network_blocks=extended_network_blocks, - **kwargs - ) - self.provisioning_state = None - self.circuit = circuit - self.endpoints = None - self.network_block = network_block - self.management_network = None - self.provisioning_network = None - self.vmotion_network = None - self.vcenter_password = vcenter_password - self.nsxt_password = nsxt_password - self.vcenter_certificate_thumbprint = None - self.nsxt_certificate_thumbprint = None - self.external_cloud_links = None - self.secondary_circuit = secondary_circuit - self.nsx_public_ip_quota_raised = None + self.value = value + self.next_link = next_link class PrivateCloudUpdate(_serialization.Model): @@ -2635,7 +2442,9 @@ class PrivateCloudUpdate(_serialization.Model): :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar identity: The identity of the private cloud, if configured. + :ivar sku: The SKU (Stock Keeping Unit) assigned to this resource. + :vartype sku: ~azure.mgmt.avs.models.Sku + :ivar identity: The managed service identities assigned to this resource. :vartype identity: ~azure.mgmt.avs.models.PrivateCloudIdentity :ivar management_cluster: The default cluster used for management. :vartype management_cluster: ~azure.mgmt.avs.models.ManagementCluster @@ -2650,13 +2459,18 @@ class PrivateCloudUpdate(_serialization.Model): :ivar encryption: Customer managed key encryption, can be enabled or disabled. :vartype encryption: ~azure.mgmt.avs.models.Encryption :ivar extended_network_blocks: Array of additional networks noncontiguous with networkBlock. - Networks must be unique and non-overlapping across VNet in your subscription, on-premise, and - this privateCloud networkBlock attribute. Make sure the CIDR format conforms to (A.B.C.D/X). + Networks must be + unique and non-overlapping across VNet in your subscription, on-premise, and + this privateCloud networkBlock attribute. Make sure the CIDR format conforms to + (A.B.C.D/X). :vartype extended_network_blocks: list[str] + :ivar dns_zone_type: The type of DNS zone to use. Known values are: "Public" and "Private". + :vartype dns_zone_type: str or ~azure.mgmt.avs.models.DnsZoneType """ _attribute_map = { "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "Sku"}, "identity": {"key": "identity", "type": "PrivateCloudIdentity"}, "management_cluster": {"key": "properties.managementCluster", "type": "ManagementCluster"}, "internet": {"key": "properties.internet", "type": "str"}, @@ -2664,25 +2478,30 @@ class PrivateCloudUpdate(_serialization.Model): "availability": {"key": "properties.availability", "type": "AvailabilityProperties"}, "encryption": {"key": "properties.encryption", "type": "Encryption"}, "extended_network_blocks": {"key": "properties.extendedNetworkBlocks", "type": "[str]"}, + "dns_zone_type": {"key": "properties.dnsZoneType", "type": "str"}, } def __init__( self, *, tags: Optional[Dict[str, str]] = None, + sku: Optional["_models.Sku"] = None, identity: Optional["_models.PrivateCloudIdentity"] = None, management_cluster: Optional["_models.ManagementCluster"] = None, - internet: Union[str, "_models.InternetEnum"] = "Disabled", + internet: Optional[Union[str, "_models.InternetEnum"]] = None, identity_sources: Optional[List["_models.IdentitySource"]] = None, availability: Optional["_models.AvailabilityProperties"] = None, encryption: Optional["_models.Encryption"] = None, extended_network_blocks: Optional[List[str]] = None, + dns_zone_type: Optional[Union[str, "_models.DnsZoneType"]] = None, **kwargs: Any ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword identity: The identity of the private cloud, if configured. + :keyword sku: The SKU (Stock Keeping Unit) assigned to this resource. + :paramtype sku: ~azure.mgmt.avs.models.Sku + :keyword identity: The managed service identities assigned to this resource. :paramtype identity: ~azure.mgmt.avs.models.PrivateCloudIdentity :keyword management_cluster: The default cluster used for management. :paramtype management_cluster: ~azure.mgmt.avs.models.ManagementCluster @@ -2697,49 +2516,25 @@ def __init__( :keyword encryption: Customer managed key encryption, can be enabled or disabled. :paramtype encryption: ~azure.mgmt.avs.models.Encryption :keyword extended_network_blocks: Array of additional networks noncontiguous with networkBlock. - Networks must be unique and non-overlapping across VNet in your subscription, on-premise, and - this privateCloud networkBlock attribute. Make sure the CIDR format conforms to (A.B.C.D/X). + Networks must be + unique and non-overlapping across VNet in your subscription, on-premise, and + this privateCloud networkBlock attribute. Make sure the CIDR format conforms to + (A.B.C.D/X). :paramtype extended_network_blocks: list[str] + :keyword dns_zone_type: The type of DNS zone to use. Known values are: "Public" and "Private". + :paramtype dns_zone_type: str or ~azure.mgmt.avs.models.DnsZoneType """ super().__init__(**kwargs) - self.tags = tags - self.identity = identity - self.management_cluster = management_cluster - self.internet = internet - self.identity_sources = identity_sources - self.availability = availability - self.encryption = encryption - self.extended_network_blocks = extended_network_blocks - - -class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) + self.tags = tags + self.sku = sku + self.identity = identity + self.management_cluster = management_cluster + self.internet = internet + self.identity_sources = identity_sources + self.availability = availability + self.encryption = encryption + self.extended_network_blocks = extended_network_blocks + self.dns_zone_type = dns_zone_type class ScriptExecutionParameter(_serialization.Model): @@ -2749,23 +2544,23 @@ class ScriptExecutionParameter(_serialization.Model): PSCredentialExecutionParameter, ScriptSecureStringExecutionParameter, ScriptStringExecutionParameter - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar name: The parameter name. Required. - :vartype name: str - :ivar type: The type of execution parameter. Required. Known values are: "Value", + :ivar type: script execution parameter type. Required. Known values are: "Value", "SecureValue", and "Credential". :vartype type: str or ~azure.mgmt.avs.models.ScriptExecutionParameterType + :ivar name: The parameter name. Required. + :vartype name: str """ _validation = { - "name": {"required": True}, "type": {"required": True}, + "name": {"required": True}, } _attribute_map = { - "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "name": {"key": "name", "type": "str"}, } _subtype_map = { @@ -2782,20 +2577,20 @@ def __init__(self, *, name: str, **kwargs: Any) -> None: :paramtype name: str """ super().__init__(**kwargs) - self.name = name self.type: Optional[str] = None + self.name = name class PSCredentialExecutionParameter(ScriptExecutionParameter): """a powershell credential object. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar name: The parameter name. Required. - :vartype name: str - :ivar type: The type of execution parameter. Required. Known values are: "Value", + :ivar type: script execution parameter type. Required. Known values are: "Value", "SecureValue", and "Credential". :vartype type: str or ~azure.mgmt.avs.models.ScriptExecutionParameterType + :ivar name: The parameter name. Required. + :vartype name: str :ivar username: username for login. :vartype username: str :ivar password: password for login. @@ -2803,13 +2598,13 @@ class PSCredentialExecutionParameter(ScriptExecutionParameter): """ _validation = { - "name": {"required": True}, "type": {"required": True}, + "name": {"required": True}, } _attribute_map = { - "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "name": {"key": "name", "type": "str"}, "username": {"key": "username", "type": "str"}, "password": {"key": "password", "type": "str"}, } @@ -2865,16 +2660,27 @@ class ScriptCmdlet(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.avs.models.SystemData + :ivar provisioning_state: The provisioning state of the resource. Known values are: + "Succeeded", "Failed", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.ScriptCmdletProvisioningState :ivar description: Description of the scripts functionality. :vartype description: str :ivar timeout: Recommended time limit for execution. :vartype timeout: str + :ivar audience: Specifies whether a script cmdlet is intended to be invoked only through + automation or visible to customers. Known values are: "Automation" and "Any". + :vartype audience: str or ~azure.mgmt.avs.models.ScriptCmdletAudience :ivar parameters: Parameters the script will accept. :vartype parameters: list[~azure.mgmt.avs.models.ScriptParameter] """ @@ -2883,8 +2689,11 @@ class ScriptCmdlet(ProxyResource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, "description": {"readonly": True}, "timeout": {"readonly": True}, + "audience": {"readonly": True}, "parameters": {"readonly": True}, } @@ -2892,33 +2701,37 @@ class ScriptCmdlet(ProxyResource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "description": {"key": "properties.description", "type": "str"}, "timeout": {"key": "properties.timeout", "type": "str"}, + "audience": {"key": "properties.audience", "type": "str"}, "parameters": {"key": "properties.parameters", "type": "[ScriptParameter]"}, } def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) + self.provisioning_state = None self.description = None self.timeout = None + self.audience = None self.parameters = None class ScriptCmdletsList(_serialization.Model): - """Pageable list of scripts/cmdlets. + """The response of a ScriptCmdlet list operation. - 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 server. - :ivar value: List of scripts. + :ivar value: The ScriptCmdlet items on this page. Required. :vartype value: list[~azure.mgmt.avs.models.ScriptCmdlet] - :ivar next_link: URL to get the next page if any. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -2926,11 +2739,16 @@ class ScriptCmdletsList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__(self, *, value: List["_models.ScriptCmdlet"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The ScriptCmdlet items on this page. Required. + :paramtype value: list[~azure.mgmt.avs.models.ScriptCmdlet] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ super().__init__(**kwargs) - self.value = None - self.next_link = None + self.value = value + self.next_link = next_link class ScriptExecution(ProxyResource): # pylint: disable=too-many-instance-attributes @@ -2938,19 +2756,25 @@ class ScriptExecution(ProxyResource): # pylint: disable=too-many-instance-attri Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.avs.models.SystemData :ivar script_cmdlet_id: A reference to the script cmdlet resource if user is running a AVS script. :vartype script_cmdlet_id: str :ivar parameters: Parameters the script will accept. :vartype parameters: list[~azure.mgmt.avs.models.ScriptExecutionParameter] :ivar hidden_parameters: Parameters that will be hidden/not visible to ARM, such as passwords - and credentials. + and + credentials. :vartype hidden_parameters: list[~azure.mgmt.avs.models.ScriptExecutionParameter] :ivar failure_reason: Error message if the script was able to run, but if the script itself had errors or powershell threw an exception. @@ -2966,8 +2790,8 @@ class ScriptExecution(ProxyResource): # pylint: disable=too-many-instance-attri :ivar finished_at: Time the script execution was finished. :vartype finished_at: ~datetime.datetime :ivar provisioning_state: The state of the script execution resource. Known values are: - "Pending", "Running", "Succeeded", "Failed", "Cancelling", "Cancelled", "Deleting", and - "Canceled". + "Succeeded", "Failed", "Canceled", "Pending", "Running", "Cancelling", "Cancelled", and + "Deleting". :vartype provisioning_state: str or ~azure.mgmt.avs.models.ScriptExecutionProvisioningState :ivar output: Standard output stream from the powershell execution. :vartype output: list[str] @@ -2985,6 +2809,7 @@ class ScriptExecution(ProxyResource): # pylint: disable=too-many-instance-attri "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "submitted_at": {"readonly": True}, "started_at": {"readonly": True}, "finished_at": {"readonly": True}, @@ -2998,6 +2823,7 @@ class ScriptExecution(ProxyResource): # 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"}, "script_cmdlet_id": {"key": "properties.scriptCmdletId", "type": "str"}, "parameters": {"key": "properties.parameters", "type": "[ScriptExecutionParameter]"}, "hidden_parameters": {"key": "properties.hiddenParameters", "type": "[ScriptExecutionParameter]"}, @@ -3035,10 +2861,12 @@ def __init__( :keyword parameters: Parameters the script will accept. :paramtype parameters: list[~azure.mgmt.avs.models.ScriptExecutionParameter] :keyword hidden_parameters: Parameters that will be hidden/not visible to ARM, such as - passwords and credentials. + passwords and + credentials. :paramtype hidden_parameters: list[~azure.mgmt.avs.models.ScriptExecutionParameter] :keyword failure_reason: Error message if the script was able to run, but if the script itself - had errors or powershell threw an exception. + had + errors or powershell threw an exception. :paramtype failure_reason: str :keyword timeout: Time limit for execution. :paramtype timeout: str @@ -3069,19 +2897,18 @@ def __init__( class ScriptExecutionsList(_serialization.Model): - """Pageable list of script executions. + """The response of a ScriptExecution list operation. - 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 server. - :ivar value: List of scripts. + :ivar value: The ScriptExecution items on this page. Required. :vartype value: list[~azure.mgmt.avs.models.ScriptExecution] - :ivar next_link: URL to get the next page if any. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -3089,11 +2916,18 @@ class ScriptExecutionsList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, *, value: List["_models.ScriptExecution"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The ScriptExecution items on this page. Required. + :paramtype value: list[~azure.mgmt.avs.models.ScriptExecution] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ super().__init__(**kwargs) - self.value = None - self.next_link = None + self.value = value + self.next_link = next_link class ScriptPackage(ProxyResource): @@ -3101,12 +2935,20 @@ class ScriptPackage(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.avs.models.SystemData + :ivar provisioning_state: The provisioning state of the resource. Known values are: + "Succeeded", "Failed", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.ScriptPackageProvisioningState :ivar description: User friendly description of the package. :vartype description: str :ivar version: Module version. @@ -3121,6 +2963,8 @@ class ScriptPackage(ProxyResource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, "description": {"readonly": True}, "version": {"readonly": True}, "company": {"readonly": True}, @@ -3131,6 +2975,8 @@ class ScriptPackage(ProxyResource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "description": {"key": "properties.description", "type": "str"}, "version": {"key": "properties.version", "type": "str"}, "company": {"key": "properties.company", "type": "str"}, @@ -3140,6 +2986,7 @@ class ScriptPackage(ProxyResource): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) + self.provisioning_state = None self.description = None self.version = None self.company = None @@ -3147,19 +2994,18 @@ def __init__(self, **kwargs: Any) -> None: class ScriptPackagesList(_serialization.Model): - """A list of the available script packages. + """The response of a ScriptPackage list operation. - 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 server. - :ivar value: List of script package resources. + :ivar value: The ScriptPackage items on this page. Required. :vartype value: list[~azure.mgmt.avs.models.ScriptPackage] - :ivar next_link: URL to get the next page if any. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -3167,11 +3013,16 @@ class ScriptPackagesList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__(self, *, value: List["_models.ScriptPackage"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The ScriptPackage items on this page. Required. + :paramtype value: list[~azure.mgmt.avs.models.ScriptPackage] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ super().__init__(**kwargs) - self.value = None - self.next_link = None + self.value = value + self.next_link = next_link class ScriptParameter(_serialization.Model): @@ -3226,25 +3077,25 @@ def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: class ScriptSecureStringExecutionParameter(ScriptExecutionParameter): """a plain text value execution parameter. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar name: The parameter name. Required. - :vartype name: str - :ivar type: The type of execution parameter. Required. Known values are: "Value", + :ivar type: script execution parameter type. Required. Known values are: "Value", "SecureValue", and "Credential". :vartype type: str or ~azure.mgmt.avs.models.ScriptExecutionParameterType + :ivar name: The parameter name. Required. + :vartype name: str :ivar secure_value: A secure value for the passed parameter, not to be stored in logs. :vartype secure_value: str """ _validation = { - "name": {"required": True}, "type": {"required": True}, + "name": {"required": True}, } _attribute_map = { - "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "name": {"key": "name", "type": "str"}, "secure_value": {"key": "secureValue", "type": "str"}, } @@ -3263,25 +3114,25 @@ def __init__(self, *, name: str, secure_value: Optional[str] = None, **kwargs: A class ScriptStringExecutionParameter(ScriptExecutionParameter): """a plain text value execution parameter. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar name: The parameter name. Required. - :vartype name: str - :ivar type: The type of execution parameter. Required. Known values are: "Value", + :ivar type: script execution parameter type. Required. Known values are: "Value", "SecureValue", and "Credential". :vartype type: str or ~azure.mgmt.avs.models.ScriptExecutionParameterType + :ivar name: The parameter name. Required. + :vartype name: str :ivar value: The value for the passed parameter. :vartype value: str """ _validation = { - "name": {"required": True}, "type": {"required": True}, + "name": {"required": True}, } _attribute_map = { - "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "name": {"key": "name", "type": "str"}, "value": {"key": "value", "type": "str"}, } @@ -3297,62 +3148,137 @@ def __init__(self, *, name: str, value: Optional[str] = None, **kwargs: Any) -> self.value = value -class ServiceSpecification(_serialization.Model): - """Service specification payload. +class Sku(_serialization.Model): + """The resource model definition representing SKU. + + All required parameters must be populated in order to send to server. - :ivar log_specifications: Specifications of the Log for Azure Monitoring. - :vartype log_specifications: list[~azure.mgmt.avs.models.LogSpecification] - :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. - :vartype metric_specifications: list[~azure.mgmt.avs.models.MetricSpecification] + :ivar name: The name of the SKU. E.g. P3. It is typically a letter+number code. Required. + :vartype name: str + :ivar tier: This field is required to be implemented by the Resource Provider if the service + has more than one tier, but is not required on a PUT. Known values are: "Free", "Basic", + "Standard", and "Premium". + :vartype tier: str or ~azure.mgmt.avs.models.SkuTier + :ivar size: The SKU size. When the name field is the combination of tier and some other value, + this would be the standalone code. + :vartype size: str + :ivar family: If the service has different generations of hardware, for the same SKU, then that + can be captured here. + :vartype family: str + :ivar capacity: If the SKU supports scale out/in then the capacity integer should be included. + If scale out/in is not possible for the resource this may be omitted. + :vartype capacity: int """ + _validation = { + "name": {"required": True}, + } + _attribute_map = { - "log_specifications": {"key": "logSpecifications", "type": "[LogSpecification]"}, - "metric_specifications": {"key": "metricSpecifications", "type": "[MetricSpecification]"}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, + "size": {"key": "size", "type": "str"}, + "family": {"key": "family", "type": "str"}, + "capacity": {"key": "capacity", "type": "int"}, } def __init__( self, *, - log_specifications: Optional[List["_models.LogSpecification"]] = None, - metric_specifications: Optional[List["_models.MetricSpecification"]] = None, + name: str, + tier: Optional[Union[str, "_models.SkuTier"]] = None, + size: Optional[str] = None, + family: Optional[str] = None, + capacity: Optional[int] = None, **kwargs: Any ) -> None: """ - :keyword log_specifications: Specifications of the Log for Azure Monitoring. - :paramtype log_specifications: list[~azure.mgmt.avs.models.LogSpecification] - :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. - :paramtype metric_specifications: list[~azure.mgmt.avs.models.MetricSpecification] + :keyword name: The name of the SKU. E.g. P3. It is typically a letter+number code. Required. + :paramtype name: str + :keyword tier: This field is required to be implemented by the Resource Provider if the service + has more than one tier, but is not required on a PUT. Known values are: "Free", "Basic", + "Standard", and "Premium". + :paramtype tier: str or ~azure.mgmt.avs.models.SkuTier + :keyword size: The SKU size. When the name field is the combination of tier and some other + value, this would be the standalone code. + :paramtype size: str + :keyword family: If the service has different generations of hardware, for the same SKU, then + that can be captured here. + :paramtype family: str + :keyword capacity: If the SKU supports scale out/in then the capacity integer should be + included. If scale out/in is not possible for the resource this may be omitted. + :paramtype capacity: int """ super().__init__(**kwargs) - self.log_specifications = log_specifications - self.metric_specifications = metric_specifications - - -class Sku(_serialization.Model): - """The resource model definition representing SKU. - - All required parameters must be populated in order to send to Azure. - - :ivar name: The name of the SKU. Required. - :vartype name: str + self.name = name + self.tier = tier + self.size = size + self.family = family + self.capacity = capacity + + +class SystemData(_serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :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.avs.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.avs.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ - _validation = { - "name": {"required": True}, - } - _attribute_map = { - "name": {"key": "name", "type": "str"}, + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, } - def __init__(self, *, name: str, **kwargs: Any) -> None: + 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: Any + ) -> None: """ - :keyword name: The name of the SKU. Required. - :paramtype name: str + :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.avs.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.avs.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime """ super().__init__(**kwargs) - self.name = name + 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 Trial(_serialization.Model): @@ -3389,12 +3315,20 @@ class VirtualMachine(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.avs.models.SystemData + :ivar provisioning_state: The provisioning state of the resource. Known values are: + "Succeeded", "Failed", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.VirtualMachineProvisioningState :ivar display_name: Display name of the VM. :vartype display_name: str :ivar mo_ref_id: Virtual machine managed object reference id. @@ -3411,6 +3345,8 @@ class VirtualMachine(ProxyResource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, "display_name": {"readonly": True}, "mo_ref_id": {"readonly": True}, "folder_path": {"readonly": True}, @@ -3421,6 +3357,8 @@ class VirtualMachine(ProxyResource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "display_name": {"key": "properties.displayName", "type": "str"}, "mo_ref_id": {"key": "properties.moRefId", "type": "str"}, "folder_path": {"key": "properties.folderPath", "type": "str"}, @@ -3430,6 +3368,7 @@ class VirtualMachine(ProxyResource): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) + self.provisioning_state = None self.display_name = None self.mo_ref_id = None self.folder_path = None @@ -3464,19 +3403,18 @@ def __init__( class VirtualMachinesList(_serialization.Model): - """A list of Virtual Machines. + """The response of a VirtualMachine list operation. - 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 server. - :ivar value: The items to be displayed on the page. + :ivar value: The VirtualMachine items on this page. Required. :vartype value: list[~azure.mgmt.avs.models.VirtualMachine] - :ivar next_link: URL to get the next page if any. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -3484,11 +3422,18 @@ class VirtualMachinesList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, *, value: List["_models.VirtualMachine"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The VirtualMachine items on this page. Required. + :paramtype value: list[~azure.mgmt.avs.models.VirtualMachine] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ super().__init__(**kwargs) - self.value = None - self.next_link = None + self.value = value + self.next_link = next_link class VmHostPlacementPolicyProperties(PlacementPolicyProperties): @@ -3496,9 +3441,9 @@ class VmHostPlacementPolicyProperties(PlacementPolicyProperties): 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. + All required parameters must be populated in order to send to server. - :ivar type: placement policy type. Required. Known values are: "VmVm" and "VmHost". + :ivar type: Placement Policy type. Required. Known values are: "VmVm" and "VmHost". :vartype type: str or ~azure.mgmt.avs.models.PlacementPolicyType :ivar state: Whether the placement policy is enabled or disabled. Known values are: "Enabled" and "Disabled". @@ -3506,7 +3451,7 @@ class VmHostPlacementPolicyProperties(PlacementPolicyProperties): :ivar display_name: Display name of the placement policy. :vartype display_name: str :ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed", - "Building", "Deleting", "Updating", and "Canceled". + "Canceled", "Building", "Deleting", and "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.PlacementPolicyProvisioningState :ivar vm_members: Virtual machine members list. Required. :vartype vm_members: list[str] @@ -3589,9 +3534,9 @@ class VmPlacementPolicyProperties(PlacementPolicyProperties): 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. + All required parameters must be populated in order to send to server. - :ivar type: placement policy type. Required. Known values are: "VmVm" and "VmHost". + :ivar type: Placement Policy type. Required. Known values are: "VmVm" and "VmHost". :vartype type: str or ~azure.mgmt.avs.models.PlacementPolicyType :ivar state: Whether the placement policy is enabled or disabled. Known values are: "Enabled" and "Disabled". @@ -3599,7 +3544,7 @@ class VmPlacementPolicyProperties(PlacementPolicyProperties): :ivar display_name: Display name of the placement policy. :vartype display_name: str :ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed", - "Building", "Deleting", "Updating", and "Canceled". + "Canceled", "Building", "Deleting", and "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.PlacementPolicyProvisioningState :ivar vm_members: Virtual machine members list. Required. :vartype vm_members: list[str] @@ -3656,29 +3601,42 @@ class WorkloadNetwork(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.avs.models.SystemData + :ivar provisioning_state: The provisioning state of the resource. Known values are: + "Succeeded", "Failed", "Canceled", "Building", "Deleting", and "Updating". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.WorkloadNetworkProvisioningState """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, } def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) + self.provisioning_state = None class WorkloadNetworkDhcp(ProxyResource): @@ -3686,13 +3644,18 @@ class WorkloadNetworkDhcp(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :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 properties: DHCP properties. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.avs.models.SystemData + :ivar properties: The resource-specific properties for this resource. :vartype properties: ~azure.mgmt.avs.models.WorkloadNetworkDhcpEntity """ @@ -3700,18 +3663,20 @@ class WorkloadNetworkDhcp(ProxyResource): "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"}, "properties": {"key": "properties", "type": "WorkloadNetworkDhcpEntity"}, } def __init__(self, *, properties: Optional["_models.WorkloadNetworkDhcpEntity"] = None, **kwargs: Any) -> None: """ - :keyword properties: DHCP properties. + :keyword properties: The resource-specific properties for this resource. :paramtype properties: ~azure.mgmt.avs.models.WorkloadNetworkDhcpEntity """ super().__init__(**kwargs) @@ -3719,14 +3684,15 @@ def __init__(self, *, properties: Optional["_models.WorkloadNetworkDhcpEntity"] class WorkloadNetworkDhcpEntity(_serialization.Model): - """Base class for WorkloadNetworkDhcpServer and WorkloadNetworkDhcpRelay to inherit from. + """Base class for WorkloadNetworkDhcpServer and WorkloadNetworkDhcpRelay to + inherit from. You probably want to use the sub-classes and not this class directly. Known sub-classes are: WorkloadNetworkDhcpRelay, WorkloadNetworkDhcpServer 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. + All required parameters must be populated in order to send to server. :ivar dhcp_type: Type of DHCP: SERVER or RELAY. Required. Known values are: "SERVER" and "RELAY". @@ -3736,7 +3702,7 @@ class WorkloadNetworkDhcpEntity(_serialization.Model): :ivar segments: NSX Segments consuming DHCP. :vartype segments: list[str] :ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed", - "Building", "Deleting", "Updating", and "Canceled". + "Canceled", "Building", "Deleting", and "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.WorkloadNetworkDhcpProvisioningState :ivar revision: NSX revision number. :vartype revision: int @@ -3774,19 +3740,18 @@ def __init__(self, *, display_name: Optional[str] = None, revision: Optional[int class WorkloadNetworkDhcpList(_serialization.Model): - """A list of NSX dhcp entities. + """The response of a WorkloadNetworkDhcp list operation. - 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 server. - :ivar value: The items on the page. + :ivar value: The WorkloadNetworkDhcp items on this page. Required. :vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkDhcp] - :ivar next_link: URL to get the next page if any. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -3794,11 +3759,18 @@ class WorkloadNetworkDhcpList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, *, value: List["_models.WorkloadNetworkDhcp"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The WorkloadNetworkDhcp items on this page. Required. + :paramtype value: list[~azure.mgmt.avs.models.WorkloadNetworkDhcp] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ super().__init__(**kwargs) - self.value = None - self.next_link = None + self.value = value + self.next_link = next_link class WorkloadNetworkDhcpRelay(WorkloadNetworkDhcpEntity): @@ -3806,7 +3778,7 @@ class WorkloadNetworkDhcpRelay(WorkloadNetworkDhcpEntity): 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. + All required parameters must be populated in order to send to server. :ivar dhcp_type: Type of DHCP: SERVER or RELAY. Required. Known values are: "SERVER" and "RELAY". @@ -3816,7 +3788,7 @@ class WorkloadNetworkDhcpRelay(WorkloadNetworkDhcpEntity): :ivar segments: NSX Segments consuming DHCP. :vartype segments: list[str] :ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed", - "Building", "Deleting", "Updating", and "Canceled". + "Canceled", "Building", "Deleting", and "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.WorkloadNetworkDhcpProvisioningState :ivar revision: NSX revision number. :vartype revision: int @@ -3866,7 +3838,7 @@ class WorkloadNetworkDhcpServer(WorkloadNetworkDhcpEntity): 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. + All required parameters must be populated in order to send to server. :ivar dhcp_type: Type of DHCP: SERVER or RELAY. Required. Known values are: "SERVER" and "RELAY". @@ -3876,7 +3848,7 @@ class WorkloadNetworkDhcpServer(WorkloadNetworkDhcpEntity): :ivar segments: NSX Segments consuming DHCP. :vartype segments: list[str] :ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed", - "Building", "Deleting", "Updating", and "Canceled". + "Canceled", "Building", "Deleting", and "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.WorkloadNetworkDhcpProvisioningState :ivar revision: NSX revision number. :vartype revision: int @@ -3932,12 +3904,17 @@ class WorkloadNetworkDnsService(ProxyResource): # pylint: disable=too-many-inst Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.avs.models.SystemData :ivar display_name: Display name of the DNS Service. :vartype display_name: str :ivar dns_service_ip: DNS service IP of the DNS Service. @@ -3952,7 +3929,7 @@ class WorkloadNetworkDnsService(ProxyResource): # pylint: disable=too-many-inst :ivar status: DNS Service status. Known values are: "SUCCESS" and "FAILURE". :vartype status: str or ~azure.mgmt.avs.models.DnsServiceStatusEnum :ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed", - "Building", "Deleting", "Updating", and "Canceled". + "Canceled", "Building", "Deleting", and "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.WorkloadNetworkDnsServiceProvisioningState :ivar revision: NSX revision number. @@ -3963,6 +3940,7 @@ class WorkloadNetworkDnsService(ProxyResource): # pylint: disable=too-many-inst "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "status": {"readonly": True}, "provisioning_state": {"readonly": True}, } @@ -3971,6 +3949,7 @@ class WorkloadNetworkDnsService(ProxyResource): # pylint: disable=too-many-inst "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "display_name": {"key": "properties.displayName", "type": "str"}, "dns_service_ip": {"key": "properties.dnsServiceIp", "type": "str"}, "default_dns_zone": {"key": "properties.defaultDnsZone", "type": "str"}, @@ -4019,19 +3998,18 @@ def __init__( class WorkloadNetworkDnsServicesList(_serialization.Model): - """A list of NSX DNS Services. + """The response of a WorkloadNetworkDnsService list operation. - 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 server. - :ivar value: The items on the page. + :ivar value: The WorkloadNetworkDnsService items on this page. Required. :vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkDnsService] - :ivar next_link: URL to get the next page if any. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -4039,24 +4017,36 @@ class WorkloadNetworkDnsServicesList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, *, value: List["_models.WorkloadNetworkDnsService"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The WorkloadNetworkDnsService items on this page. Required. + :paramtype value: list[~azure.mgmt.avs.models.WorkloadNetworkDnsService] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ super().__init__(**kwargs) - self.value = None - self.next_link = None + self.value = value + self.next_link = next_link -class WorkloadNetworkDnsZone(ProxyResource): +class WorkloadNetworkDnsZone(ProxyResource): # pylint: disable=too-many-instance-attributes """NSX DNS Zone. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.avs.models.SystemData :ivar display_name: Display name of the DNS Zone. :vartype display_name: str :ivar domain: Domain names of the DNS Zone. @@ -4068,7 +4058,7 @@ class WorkloadNetworkDnsZone(ProxyResource): :ivar dns_services: Number of DNS Services using the DNS zone. :vartype dns_services: int :ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed", - "Building", "Deleting", "Updating", and "Canceled". + "Canceled", "Building", "Deleting", and "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.WorkloadNetworkDnsZoneProvisioningState :ivar revision: NSX revision number. @@ -4079,6 +4069,7 @@ class WorkloadNetworkDnsZone(ProxyResource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "provisioning_state": {"readonly": True}, } @@ -4086,6 +4077,7 @@ class WorkloadNetworkDnsZone(ProxyResource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "display_name": {"key": "properties.displayName", "type": "str"}, "domain": {"key": "properties.domain", "type": "[str]"}, "dns_server_ips": {"key": "properties.dnsServerIps", "type": "[str]"}, @@ -4131,19 +4123,18 @@ def __init__( class WorkloadNetworkDnsZonesList(_serialization.Model): - """A list of NSX DNS Zones. + """The response of a WorkloadNetworkDnsZone list operation. - 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 server. - :ivar value: The items on the page. + :ivar value: The WorkloadNetworkDnsZone items on this page. Required. :vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] - :ivar next_link: URL to get the next page if any. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -4151,11 +4142,18 @@ class WorkloadNetworkDnsZonesList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, *, value: List["_models.WorkloadNetworkDnsZone"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The WorkloadNetworkDnsZone items on this page. Required. + :paramtype value: list[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ super().__init__(**kwargs) - self.value = None - self.next_link = None + self.value = value + self.next_link = next_link class WorkloadNetworkGateway(ProxyResource): @@ -4163,12 +4161,20 @@ class WorkloadNetworkGateway(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.avs.models.SystemData + :ivar provisioning_state: The provisioning state of the resource. Known values are: + "Succeeded", "Failed", "Canceled", "Building", "Deleting", and "Updating". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.WorkloadNetworkProvisioningState :ivar display_name: Display name of the DHCP entity. :vartype display_name: str :ivar path: NSX Gateway Path. @@ -4179,6 +4185,8 @@ class WorkloadNetworkGateway(ProxyResource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, "path": {"readonly": True}, } @@ -4186,6 +4194,8 @@ class WorkloadNetworkGateway(ProxyResource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "display_name": {"key": "properties.displayName", "type": "str"}, "path": {"key": "properties.path", "type": "str"}, } @@ -4196,24 +4206,24 @@ def __init__(self, *, display_name: Optional[str] = None, **kwargs: Any) -> None :paramtype display_name: str """ super().__init__(**kwargs) + self.provisioning_state = None self.display_name = display_name self.path = None class WorkloadNetworkGatewayList(_serialization.Model): - """A list of NSX Gateways. + """The response of a WorkloadNetworkGateway list operation. - 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 server. - :ivar value: The items on the page. + :ivar value: The WorkloadNetworkGateway items on this page. Required. :vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkGateway] - :ivar next_link: URL to get the next page if any. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -4221,27 +4231,33 @@ class WorkloadNetworkGatewayList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, *, value: List["_models.WorkloadNetworkGateway"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The WorkloadNetworkGateway items on this page. Required. + :paramtype value: list[~azure.mgmt.avs.models.WorkloadNetworkGateway] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ super().__init__(**kwargs) - self.value = None - self.next_link = None + self.value = value + self.next_link = next_link class WorkloadNetworkList(_serialization.Model): - """A list of workload networks. + """The response of a WorkloadNetwork list operation. - 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 server. - :ivar value: The items on the page. + :ivar value: The WorkloadNetwork items on this page. Required. :vartype value: list[~azure.mgmt.avs.models.WorkloadNetwork] - :ivar next_link: URL to get the next page if any. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -4249,24 +4265,36 @@ class WorkloadNetworkList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, *, value: List["_models.WorkloadNetwork"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The WorkloadNetwork items on this page. Required. + :paramtype value: list[~azure.mgmt.avs.models.WorkloadNetwork] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ super().__init__(**kwargs) - self.value = None - self.next_link = None + self.value = value + self.next_link = next_link -class WorkloadNetworkPortMirroring(ProxyResource): +class WorkloadNetworkPortMirroring(ProxyResource): # pylint: disable=too-many-instance-attributes """NSX Port Mirroring. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.avs.models.SystemData :ivar display_name: Display name of the port mirroring profile. :vartype display_name: str :ivar direction: Direction of port mirroring profile. Known values are: "INGRESS", "EGRESS", @@ -4279,7 +4307,7 @@ class WorkloadNetworkPortMirroring(ProxyResource): :ivar status: Port Mirroring Status. Known values are: "SUCCESS" and "FAILURE". :vartype status: str or ~azure.mgmt.avs.models.PortMirroringStatusEnum :ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed", - "Building", "Deleting", "Updating", and "Canceled". + "Canceled", "Building", "Deleting", and "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.WorkloadNetworkPortMirroringProvisioningState :ivar revision: NSX revision number. @@ -4290,6 +4318,7 @@ class WorkloadNetworkPortMirroring(ProxyResource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "status": {"readonly": True}, "provisioning_state": {"readonly": True}, } @@ -4298,6 +4327,7 @@ class WorkloadNetworkPortMirroring(ProxyResource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "display_name": {"key": "properties.displayName", "type": "str"}, "direction": {"key": "properties.direction", "type": "str"}, "source": {"key": "properties.source", "type": "str"}, @@ -4341,19 +4371,18 @@ def __init__( class WorkloadNetworkPortMirroringList(_serialization.Model): - """A list of NSX Port Mirroring. + """The response of a WorkloadNetworkPortMirroring list operation. - 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 server. - :ivar value: The items on the page. + :ivar value: The WorkloadNetworkPortMirroring items on this page. Required. :vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] - :ivar next_link: URL to get the next page if any. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -4361,11 +4390,18 @@ class WorkloadNetworkPortMirroringList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, *, value: List["_models.WorkloadNetworkPortMirroring"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The WorkloadNetworkPortMirroring items on this page. Required. + :paramtype value: list[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ super().__init__(**kwargs) - self.value = None - self.next_link = None + self.value = value + self.next_link = next_link class WorkloadNetworkPublicIP(ProxyResource): @@ -4373,12 +4409,17 @@ class WorkloadNetworkPublicIP(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.avs.models.SystemData :ivar display_name: Display name of the Public IP Block. :vartype display_name: str :ivar number_of_public_i_ps: Number of Public IPs requested. @@ -4386,7 +4427,7 @@ class WorkloadNetworkPublicIP(ProxyResource): :ivar public_ip_block: CIDR Block of the Public IP Block. :vartype public_ip_block: str :ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed", - "Building", "Deleting", "Updating", and "Canceled". + "Canceled", "Building", "Deleting", and "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.WorkloadNetworkPublicIPProvisioningState """ @@ -4395,6 +4436,7 @@ class WorkloadNetworkPublicIP(ProxyResource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "public_ip_block": {"readonly": True}, "provisioning_state": {"readonly": True}, } @@ -4403,6 +4445,7 @@ class WorkloadNetworkPublicIP(ProxyResource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "display_name": {"key": "properties.displayName", "type": "str"}, "number_of_public_i_ps": {"key": "properties.numberOfPublicIPs", "type": "int"}, "public_ip_block": {"key": "properties.publicIPBlock", "type": "str"}, @@ -4426,19 +4469,18 @@ def __init__( class WorkloadNetworkPublicIPsList(_serialization.Model): - """A list of NSX Public IP Blocks. + """The response of a WorkloadNetworkPublicIP list operation. - 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 server. - :ivar value: The items on the page. + :ivar value: The WorkloadNetworkPublicIP items on this page. Required. :vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkPublicIP] - :ivar next_link: URL to get the next page if any. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -4446,24 +4488,36 @@ class WorkloadNetworkPublicIPsList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, *, value: List["_models.WorkloadNetworkPublicIP"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The WorkloadNetworkPublicIP items on this page. Required. + :paramtype value: list[~azure.mgmt.avs.models.WorkloadNetworkPublicIP] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ super().__init__(**kwargs) - self.value = None - self.next_link = None + self.value = value + self.next_link = next_link -class WorkloadNetworkSegment(ProxyResource): +class WorkloadNetworkSegment(ProxyResource): # pylint: disable=too-many-instance-attributes """NSX Segment. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.avs.models.SystemData :ivar display_name: Display name of the segment. :vartype display_name: str :ivar connected_gateway: Gateway which to connect segment to. @@ -4475,7 +4529,7 @@ class WorkloadNetworkSegment(ProxyResource): :ivar status: Segment status. Known values are: "SUCCESS" and "FAILURE". :vartype status: str or ~azure.mgmt.avs.models.SegmentStatusEnum :ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed", - "Building", "Deleting", "Updating", and "Canceled". + "Canceled", "Building", "Deleting", and "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.WorkloadNetworkSegmentProvisioningState :ivar revision: NSX revision number. @@ -4486,6 +4540,7 @@ class WorkloadNetworkSegment(ProxyResource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "port_vif": {"readonly": True}, "status": {"readonly": True}, "provisioning_state": {"readonly": True}, @@ -4495,6 +4550,7 @@ class WorkloadNetworkSegment(ProxyResource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "display_name": {"key": "properties.displayName", "type": "str"}, "connected_gateway": {"key": "properties.connectedGateway", "type": "str"}, "subnet": {"key": "properties.subnet", "type": "WorkloadNetworkSegmentSubnet"}, @@ -4554,19 +4610,18 @@ def __init__(self, *, port_name: Optional[str] = None, **kwargs: Any) -> None: class WorkloadNetworkSegmentsList(_serialization.Model): - """A list of NSX Segments. + """The response of a WorkloadNetworkSegment list operation. - 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 server. - :ivar value: The items on the page. + :ivar value: The WorkloadNetworkSegment items on this page. Required. :vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkSegment] - :ivar next_link: URL to get the next page if any. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -4574,11 +4629,18 @@ class WorkloadNetworkSegmentsList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, *, value: List["_models.WorkloadNetworkSegment"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The WorkloadNetworkSegment items on this page. Required. + :paramtype value: list[~azure.mgmt.avs.models.WorkloadNetworkSegment] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ super().__init__(**kwargs) - self.value = None - self.next_link = None + self.value = value + self.next_link = next_link class WorkloadNetworkSegmentSubnet(_serialization.Model): @@ -4614,12 +4676,20 @@ class WorkloadNetworkVirtualMachine(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.avs.models.SystemData + :ivar provisioning_state: The provisioning state of the resource. Known values are: + "Succeeded", "Failed", "Canceled", "Building", "Deleting", and "Updating". + :vartype provisioning_state: str or ~azure.mgmt.avs.models.WorkloadNetworkProvisioningState :ivar display_name: Display name of the VM. :vartype display_name: str :ivar vm_type: Virtual machine type. Known values are: "REGULAR", "EDGE", and "SERVICE". @@ -4630,6 +4700,8 @@ class WorkloadNetworkVirtualMachine(ProxyResource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, "vm_type": {"readonly": True}, } @@ -4637,6 +4709,8 @@ class WorkloadNetworkVirtualMachine(ProxyResource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "display_name": {"key": "properties.displayName", "type": "str"}, "vm_type": {"key": "properties.vmType", "type": "str"}, } @@ -4647,24 +4721,24 @@ def __init__(self, *, display_name: Optional[str] = None, **kwargs: Any) -> None :paramtype display_name: str """ super().__init__(**kwargs) + self.provisioning_state = None self.display_name = display_name self.vm_type = None class WorkloadNetworkVirtualMachinesList(_serialization.Model): - """A list of NSX Virtual Machines. + """The response of a WorkloadNetworkVirtualMachine list operation. - 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 server. - :ivar value: The items on the page. + :ivar value: The WorkloadNetworkVirtualMachine items on this page. Required. :vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkVirtualMachine] - :ivar next_link: URL to get the next page if any. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -4672,11 +4746,18 @@ class WorkloadNetworkVirtualMachinesList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, *, value: List["_models.WorkloadNetworkVirtualMachine"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The WorkloadNetworkVirtualMachine items on this page. Required. + :paramtype value: list[~azure.mgmt.avs.models.WorkloadNetworkVirtualMachine] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ super().__init__(**kwargs) - self.value = None - self.next_link = None + self.value = value + self.next_link = next_link class WorkloadNetworkVMGroup(ProxyResource): @@ -4684,12 +4765,17 @@ class WorkloadNetworkVMGroup(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.avs.models.SystemData :ivar display_name: Display name of the VM group. :vartype display_name: str :ivar members: Virtual machine members of this group. @@ -4697,7 +4783,7 @@ class WorkloadNetworkVMGroup(ProxyResource): :ivar status: VM Group status. Known values are: "SUCCESS" and "FAILURE". :vartype status: str or ~azure.mgmt.avs.models.VMGroupStatusEnum :ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed", - "Building", "Deleting", "Updating", and "Canceled". + "Canceled", "Building", "Deleting", and "Updating". :vartype provisioning_state: str or ~azure.mgmt.avs.models.WorkloadNetworkVMGroupProvisioningState :ivar revision: NSX revision number. @@ -4708,6 +4794,7 @@ class WorkloadNetworkVMGroup(ProxyResource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "status": {"readonly": True}, "provisioning_state": {"readonly": True}, } @@ -4716,6 +4803,7 @@ class WorkloadNetworkVMGroup(ProxyResource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "display_name": {"key": "properties.displayName", "type": "str"}, "members": {"key": "properties.members", "type": "[str]"}, "status": {"key": "properties.status", "type": "str"}, @@ -4748,19 +4836,18 @@ def __init__( class WorkloadNetworkVMGroupsList(_serialization.Model): - """A list of NSX VM Groups. + """The response of a WorkloadNetworkVMGroup list operation. - 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 server. - :ivar value: The items on the page. + :ivar value: The WorkloadNetworkVMGroup items on this page. Required. :vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] - :ivar next_link: URL to get the next page if any. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -4768,8 +4855,15 @@ class WorkloadNetworkVMGroupsList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, *, value: List["_models.WorkloadNetworkVMGroup"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The WorkloadNetworkVMGroup items on this page. Required. + :paramtype value: list[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ super().__init__(**kwargs) - self.value = None - self.next_link = None + self.value = value + self.next_link = next_link diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/__init__.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/__init__.py index 7aa1e85f55b7..e6a84c5d03a3 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/__init__.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/__init__.py @@ -9,19 +9,20 @@ from ._operations import Operations from ._locations_operations import LocationsOperations from ._private_clouds_operations import PrivateCloudsOperations -from ._clusters_operations import ClustersOperations -from ._datastores_operations import DatastoresOperations -from ._hcx_enterprise_sites_operations import HcxEnterpriseSitesOperations +from ._addons_operations import AddonsOperations from ._authorizations_operations import AuthorizationsOperations -from ._global_reach_connections_operations import GlobalReachConnectionsOperations -from ._workload_networks_operations import WorkloadNetworksOperations from ._cloud_links_operations import CloudLinksOperations -from ._addons_operations import AddonsOperations -from ._virtual_machines_operations import VirtualMachinesOperations +from ._clusters_operations import ClustersOperations +from ._datastores_operations import DatastoresOperations from ._placement_policies_operations import PlacementPoliciesOperations +from ._virtual_machines_operations import VirtualMachinesOperations +from ._global_reach_connections_operations import GlobalReachConnectionsOperations +from ._hcx_enterprise_sites_operations import HcxEnterpriseSitesOperations +from ._iscsi_paths_operations import IscsiPathsOperations +from ._script_executions_operations import ScriptExecutionsOperations from ._script_packages_operations import ScriptPackagesOperations from ._script_cmdlets_operations import ScriptCmdletsOperations -from ._script_executions_operations import ScriptExecutionsOperations +from ._workload_networks_operations import WorkloadNetworksOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -31,19 +32,20 @@ "Operations", "LocationsOperations", "PrivateCloudsOperations", - "ClustersOperations", - "DatastoresOperations", - "HcxEnterpriseSitesOperations", + "AddonsOperations", "AuthorizationsOperations", - "GlobalReachConnectionsOperations", - "WorkloadNetworksOperations", "CloudLinksOperations", - "AddonsOperations", - "VirtualMachinesOperations", + "ClustersOperations", + "DatastoresOperations", "PlacementPoliciesOperations", + "VirtualMachinesOperations", + "GlobalReachConnectionsOperations", + "HcxEnterpriseSitesOperations", + "IscsiPathsOperations", + "ScriptExecutionsOperations", "ScriptPackagesOperations", "ScriptCmdletsOperations", - "ScriptExecutionsOperations", + "WorkloadNetworksOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_addons_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_addons_operations.py index 9b6fa93d92a4..39f6d9244dfe 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_addons_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_addons_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +59,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -78,7 +83,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +92,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -112,7 +117,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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") @@ -122,11 +127,11 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str"), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), "addonName": _SERIALIZER.url("addon_name", addon_name, "str", pattern=r"^[-\w\._]+$"), } @@ -149,7 +154,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +163,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -198,16 +203,13 @@ def __init__(self, *args, **kwargs): @distributed_trace def list(self, resource_group_name: str, private_cloud_name: str, **kwargs: Any) -> Iterable["_models.Addon"]: - """List addons in a private cloud. - - List addons in a private cloud. + """List Addon resources by PrivateCloud. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Addon or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.Addon] :raises ~azure.core.exceptions.HttpResponseError: @@ -218,7 +220,7 @@ def list(self, resource_group_name: str, private_cloud_name: str, **kwargs: Any) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AddonList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -229,17 +231,16 @@ def list(self, resource_group_name: str, private_cloud_name: str, **kwargs: Any) def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -251,13 +252,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("AddonList", pipeline_response) @@ -267,11 +268,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -284,29 +285,22 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons" - } - @distributed_trace def get(self, resource_group_name: str, private_cloud_name: str, addon_name: str, **kwargs: Any) -> _models.Addon: - """Get an addon by name in a private cloud. - - Get an addon by name in a private cloud. + """Get a Addon. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param addon_name: Name of the addon for the private cloud. Required. + :param addon_name: Name of the addon. Required. :type addon_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Addon or the result of cls(response) :rtype: ~azure.mgmt.avs.models.Addon :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -320,22 +314,21 @@ def get(self, resource_group_name: str, private_cloud_name: str, addon_name: str api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Addon] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, addon_name=addon_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -348,23 +341,19 @@ def get(self, resource_group_name: str, private_cloud_name: str, addon_name: str deserialized = self._deserialize("Addon", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, private_cloud_name: str, addon_name: str, - addon: Union[_models.Addon, IO], + addon: Union[_models.Addon, IO[bytes]], **kwargs: Any ) -> _models.Addon: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -387,7 +376,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(addon, "Addon") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, addon_name=addon_name, @@ -396,16 +385,15 @@ def _create_or_update_initial( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -415,21 +403,20 @@ def _create_or_update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("Addon", pipeline_response) if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = self._deserialize("Addon", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}" - } - @overload def begin_create_or_update( self, @@ -441,30 +428,20 @@ def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.Addon]: - """Create or update a addon in a private cloud. - - Create or update a addon in a private cloud. + """Create a Addon. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param addon_name: Name of the addon for the private cloud. Required. + :param addon_name: Name of the addon. Required. :type addon_name: str - :param addon: A addon in the private cloud. Required. + :param addon: Resource create parameters. Required. :type addon: ~azure.mgmt.avs.models.Addon :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 Addon or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Addon] :raises ~azure.core.exceptions.HttpResponseError: @@ -476,35 +453,25 @@ def begin_create_or_update( resource_group_name: str, private_cloud_name: str, addon_name: str, - addon: IO, + addon: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.Addon]: - """Create or update a addon in a private cloud. - - Create or update a addon in a private cloud. + """Create a Addon. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param addon_name: Name of the addon for the private cloud. Required. + :param addon_name: Name of the addon. Required. :type addon_name: str - :param addon: A addon in the private cloud. Required. - :type addon: IO + :param addon: Resource create parameters. Required. + :type addon: IO[bytes] :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 Addon or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Addon] :raises ~azure.core.exceptions.HttpResponseError: @@ -516,33 +483,20 @@ def begin_create_or_update( resource_group_name: str, private_cloud_name: str, addon_name: str, - addon: Union[_models.Addon, IO], + addon: Union[_models.Addon, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Addon]: - """Create or update a addon in a private cloud. - - Create or update a addon in a private cloud. + """Create a Addon. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param addon_name: Name of the addon for the private cloud. Required. + :param addon_name: Name of the addon. Required. :type addon_name: str - :param addon: A addon in the private cloud. Is either a Addon type or a IO type. Required. - :type addon: ~azure.mgmt.avs.models.Addon 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. + :param addon: Resource create parameters. Is either a Addon type or a IO[bytes] type. Required. + :type addon: ~azure.mgmt.avs.models.Addon or IO[bytes] :return: An instance of LROPoller that returns either Addon or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Addon] :raises ~azure.core.exceptions.HttpResponseError: @@ -574,32 +528,32 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Addon", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.Addon].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.AVS/privateClouds/{privateCloudName}/addons/{addonName}" - } + return LROPoller[_models.Addon]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, private_cloud_name: str, addon_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -613,22 +567,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, addon_name=addon_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -638,36 +591,27 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, None, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace def begin_delete( self, resource_group_name: str, private_cloud_name: str, addon_name: str, **kwargs: Any ) -> LROPoller[None]: - """Delete a addon in a private cloud. - - Delete a addon in a private cloud. + """Delete a Addon. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param addon_name: Name of the addon for the private cloud. Required. + :param addon_name: Name of the addon. Required. :type addon_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: @@ -695,23 +639,21 @@ def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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.AVS/privateClouds/{privateCloudName}/addons/{addonName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_authorizations_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_authorizations_operations.py index 38688a5f3b7b..eee15601f133 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_authorizations_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_authorizations_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +59,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -78,7 +83,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +92,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -112,7 +117,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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") @@ -122,11 +127,11 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str"), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), "authorizationName": _SERIALIZER.url("authorization_name", authorization_name, "str", pattern=r"^[-\w\._]+$"), } @@ -149,7 +154,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +163,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -200,16 +205,13 @@ def __init__(self, *args, **kwargs): def list( self, resource_group_name: str, private_cloud_name: str, **kwargs: Any ) -> Iterable["_models.ExpressRouteAuthorization"]: - """List ExpressRoute Circuit Authorizations in a private cloud. - - List ExpressRoute Circuit Authorizations in a private cloud. + """List ExpressRouteAuthorization resources by PrivateCloud. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExpressRouteAuthorization or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.ExpressRouteAuthorization] @@ -221,7 +223,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ExpressRouteAuthorizationList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -232,17 +234,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -254,13 +255,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("ExpressRouteAuthorizationList", pipeline_response) @@ -270,11 +271,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -287,32 +288,24 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations" - } - @distributed_trace def get( self, resource_group_name: str, private_cloud_name: str, authorization_name: str, **kwargs: Any ) -> _models.ExpressRouteAuthorization: - """Get an ExpressRoute Circuit Authorization by name in a private cloud. - - Get an ExpressRoute Circuit Authorization by name in a private cloud. + """Get a ExpressRouteAuthorization. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param authorization_name: Name of the ExpressRoute Circuit Authorization in the private cloud. - Required. + :param authorization_name: Name of the ExpressRoute Circuit Authorization. Required. :type authorization_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ExpressRouteAuthorization or the result of cls(response) :rtype: ~azure.mgmt.avs.models.ExpressRouteAuthorization :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -326,22 +319,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ExpressRouteAuthorization] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, authorization_name=authorization_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -354,23 +346,19 @@ def get( deserialized = self._deserialize("ExpressRouteAuthorization", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, private_cloud_name: str, authorization_name: str, - authorization: Union[_models.ExpressRouteAuthorization, IO], + authorization: Union[_models.ExpressRouteAuthorization, IO[bytes]], **kwargs: Any ) -> _models.ExpressRouteAuthorization: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -393,7 +381,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(authorization, "ExpressRouteAuthorization") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, authorization_name=authorization_name, @@ -402,16 +390,15 @@ def _create_or_update_initial( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -421,21 +408,20 @@ def _create_or_update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ExpressRouteAuthorization", pipeline_response) if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = self._deserialize("ExpressRouteAuthorization", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}" - } - @overload def begin_create_or_update( self, @@ -447,31 +433,20 @@ def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ExpressRouteAuthorization]: - """Create or update an ExpressRoute Circuit Authorization in a private cloud. - - Create or update an ExpressRoute Circuit Authorization in a private cloud. + """Create a ExpressRouteAuthorization. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param authorization_name: Name of the ExpressRoute Circuit Authorization in the private cloud. - Required. + :param authorization_name: Name of the ExpressRoute Circuit Authorization. Required. :type authorization_name: str - :param authorization: An ExpressRoute Circuit Authorization. Required. + :param authorization: Resource create parameters. Required. :type authorization: ~azure.mgmt.avs.models.ExpressRouteAuthorization :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 ExpressRouteAuthorization or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.ExpressRouteAuthorization] @@ -484,36 +459,25 @@ def begin_create_or_update( resource_group_name: str, private_cloud_name: str, authorization_name: str, - authorization: IO, + authorization: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ExpressRouteAuthorization]: - """Create or update an ExpressRoute Circuit Authorization in a private cloud. - - Create or update an ExpressRoute Circuit Authorization in a private cloud. + """Create a ExpressRouteAuthorization. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param authorization_name: Name of the ExpressRoute Circuit Authorization in the private cloud. - Required. + :param authorization_name: Name of the ExpressRoute Circuit Authorization. Required. :type authorization_name: str - :param authorization: An ExpressRoute Circuit Authorization. Required. - :type authorization: IO + :param authorization: Resource create parameters. Required. + :type authorization: IO[bytes] :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 ExpressRouteAuthorization or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.ExpressRouteAuthorization] @@ -526,35 +490,21 @@ def begin_create_or_update( resource_group_name: str, private_cloud_name: str, authorization_name: str, - authorization: Union[_models.ExpressRouteAuthorization, IO], + authorization: Union[_models.ExpressRouteAuthorization, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.ExpressRouteAuthorization]: - """Create or update an ExpressRoute Circuit Authorization in a private cloud. - - Create or update an ExpressRoute Circuit Authorization in a private cloud. + """Create a ExpressRouteAuthorization. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param authorization_name: Name of the ExpressRoute Circuit Authorization in the private cloud. - Required. + :param authorization_name: Name of the ExpressRoute Circuit Authorization. Required. :type authorization_name: str - :param authorization: An ExpressRoute Circuit Authorization. Is either a - ExpressRouteAuthorization type or a IO type. Required. - :type authorization: ~azure.mgmt.avs.models.ExpressRouteAuthorization 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. + :param authorization: Resource create parameters. Is either a ExpressRouteAuthorization type or + a IO[bytes] type. Required. + :type authorization: ~azure.mgmt.avs.models.ExpressRouteAuthorization or IO[bytes] :return: An instance of LROPoller that returns either ExpressRouteAuthorization or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.ExpressRouteAuthorization] @@ -587,32 +537,32 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ExpressRouteAuthorization", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ExpressRouteAuthorization].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.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}" - } + return LROPoller[_models.ExpressRouteAuthorization]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, private_cloud_name: str, authorization_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -626,22 +576,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, authorization_name=authorization_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -651,37 +600,27 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, None, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace def begin_delete( self, resource_group_name: str, private_cloud_name: str, authorization_name: str, **kwargs: Any ) -> LROPoller[None]: - """Delete an ExpressRoute Circuit Authorization in a private cloud. - - Delete an ExpressRoute Circuit Authorization in a private cloud. + """Delete a ExpressRouteAuthorization. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param authorization_name: Name of the ExpressRoute Circuit Authorization in the private cloud. - Required. + :param authorization_name: Name of the ExpressRoute Circuit Authorization. Required. :type authorization_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: @@ -709,23 +648,21 @@ def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_cloud_links_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_cloud_links_operations.py index d2781997659e..4c6a2c0ad2ef 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_cloud_links_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_cloud_links_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +59,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -78,7 +83,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +92,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -112,7 +117,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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") @@ -122,11 +127,11 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str"), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), "cloudLinkName": _SERIALIZER.url("cloud_link_name", cloud_link_name, "str", pattern=r"^[-\w\._]+$"), } @@ -149,7 +154,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +163,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -198,16 +203,13 @@ def __init__(self, *args, **kwargs): @distributed_trace def list(self, resource_group_name: str, private_cloud_name: str, **kwargs: Any) -> Iterable["_models.CloudLink"]: - """List cloud link in a private cloud. - - List cloud link in a private cloud. + """List CloudLink resources by PrivateCloud. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either CloudLink or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.CloudLink] :raises ~azure.core.exceptions.HttpResponseError: @@ -218,7 +220,7 @@ def list(self, resource_group_name: str, private_cloud_name: str, **kwargs: Any) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CloudLinkList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -229,17 +231,16 @@ def list(self, resource_group_name: str, private_cloud_name: str, **kwargs: Any) def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -251,13 +252,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("CloudLinkList", pipeline_response) @@ -267,11 +268,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -284,31 +285,24 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks" - } - @distributed_trace def get( self, resource_group_name: str, private_cloud_name: str, cloud_link_name: str, **kwargs: Any ) -> _models.CloudLink: - """Get an cloud link by name in a private cloud. - - Get an cloud link by name in a private cloud. + """Get a CloudLink. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cloud_link_name: Name of the cloud link resource. Required. + :param cloud_link_name: Name of the cloud link. Required. :type cloud_link_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CloudLink or the result of cls(response) :rtype: ~azure.mgmt.avs.models.CloudLink :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -322,22 +316,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CloudLink] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cloud_link_name=cloud_link_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -350,23 +343,19 @@ def get( deserialized = self._deserialize("CloudLink", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, private_cloud_name: str, cloud_link_name: str, - cloud_link: Union[_models.CloudLink, IO], + cloud_link: Union[_models.CloudLink, IO[bytes]], **kwargs: Any ) -> _models.CloudLink: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -389,7 +378,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(cloud_link, "CloudLink") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cloud_link_name=cloud_link_name, @@ -398,16 +387,15 @@ def _create_or_update_initial( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -417,21 +405,20 @@ def _create_or_update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("CloudLink", pipeline_response) if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = self._deserialize("CloudLink", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}" - } - @overload def begin_create_or_update( self, @@ -443,30 +430,20 @@ def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.CloudLink]: - """Create or update a cloud link in a private cloud. - - Create or update a cloud link in a private cloud. + """Create a CloudLink. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cloud_link_name: Name of the cloud link resource. Required. + :param cloud_link_name: Name of the cloud link. Required. :type cloud_link_name: str - :param cloud_link: A cloud link in the private cloud. Required. + :param cloud_link: Resource create parameters. Required. :type cloud_link: ~azure.mgmt.avs.models.CloudLink :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 CloudLink or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.CloudLink] :raises ~azure.core.exceptions.HttpResponseError: @@ -478,35 +455,25 @@ def begin_create_or_update( resource_group_name: str, private_cloud_name: str, cloud_link_name: str, - cloud_link: IO, + cloud_link: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.CloudLink]: - """Create or update a cloud link in a private cloud. - - Create or update a cloud link in a private cloud. + """Create a CloudLink. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cloud_link_name: Name of the cloud link resource. Required. + :param cloud_link_name: Name of the cloud link. Required. :type cloud_link_name: str - :param cloud_link: A cloud link in the private cloud. Required. - :type cloud_link: IO + :param cloud_link: Resource create parameters. Required. + :type cloud_link: IO[bytes] :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 CloudLink or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.CloudLink] :raises ~azure.core.exceptions.HttpResponseError: @@ -518,34 +485,21 @@ def begin_create_or_update( resource_group_name: str, private_cloud_name: str, cloud_link_name: str, - cloud_link: Union[_models.CloudLink, IO], + cloud_link: Union[_models.CloudLink, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.CloudLink]: - """Create or update a cloud link in a private cloud. - - Create or update a cloud link in a private cloud. + """Create a CloudLink. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cloud_link_name: Name of the cloud link resource. Required. + :param cloud_link_name: Name of the cloud link. Required. :type cloud_link_name: str - :param cloud_link: A cloud link in the private cloud. Is either a CloudLink type or a IO type. + :param cloud_link: Resource create parameters. Is either a CloudLink type or a IO[bytes] type. Required. - :type cloud_link: ~azure.mgmt.avs.models.CloudLink 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. + :type cloud_link: ~azure.mgmt.avs.models.CloudLink or IO[bytes] :return: An instance of LROPoller that returns either CloudLink or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.CloudLink] :raises ~azure.core.exceptions.HttpResponseError: @@ -577,32 +531,32 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("CloudLink", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.CloudLink].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.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}" - } + return LROPoller[_models.CloudLink]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, private_cloud_name: str, cloud_link_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -616,22 +570,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cloud_link_name=cloud_link_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -641,36 +594,27 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, None, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace def begin_delete( self, resource_group_name: str, private_cloud_name: str, cloud_link_name: str, **kwargs: Any ) -> LROPoller[None]: - """Delete a cloud link in a private cloud. - - Delete a cloud link in a private cloud. + """Delete a CloudLink. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cloud_link_name: Name of the cloud link resource. Required. + :param cloud_link_name: Name of the cloud link. Required. :type cloud_link_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: @@ -698,23 +642,21 @@ def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_clusters_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_clusters_operations.py index 91c553f20b9a..a2d66be2f141 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_clusters_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_clusters_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +59,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -78,7 +83,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +92,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -112,7 +117,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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") @@ -122,11 +127,11 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str"), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"), } @@ -149,7 +154,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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") @@ -159,7 +164,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -186,7 +191,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -195,7 +200,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -220,7 +225,7 @@ def build_list_zones_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -229,7 +234,7 @@ def build_list_zones_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/listZones", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -269,16 +274,13 @@ def __init__(self, *args, **kwargs): @distributed_trace def list(self, resource_group_name: str, private_cloud_name: str, **kwargs: Any) -> Iterable["_models.Cluster"]: - """List clusters in a private cloud. - - List clusters in a private cloud. + """List Cluster resources by PrivateCloud. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_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.avs.models.Cluster] :raises ~azure.core.exceptions.HttpResponseError: @@ -289,7 +291,7 @@ def list(self, resource_group_name: str, private_cloud_name: str, **kwargs: Any) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClusterList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -300,17 +302,16 @@ def list(self, resource_group_name: str, private_cloud_name: str, **kwargs: Any) def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -322,13 +323,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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) @@ -338,11 +339,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -355,31 +356,24 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters" - } - @distributed_trace def get( self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any ) -> _models.Cluster: - """Get a cluster by name in a private cloud. - - Get a cluster by name in a private cloud. + """Get a Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: 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.avs.models.Cluster :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -393,22 +387,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Cluster] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -421,23 +414,19 @@ def get( deserialized = self._deserialize("Cluster", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, private_cloud_name: str, cluster_name: str, - cluster: Union[_models.Cluster, IO], + cluster: Union[_models.Cluster, IO[bytes]], **kwargs: Any ) -> _models.Cluster: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -460,7 +449,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(cluster, "Cluster") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cluster_name=cluster_name, @@ -469,16 +458,15 @@ def _create_or_update_initial( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -488,21 +476,20 @@ def _create_or_update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("Cluster", pipeline_response) if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = self._deserialize("Cluster", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}" - } - @overload def begin_create_or_update( self, @@ -514,30 +501,20 @@ def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.Cluster]: - """Create or update a cluster in a private cloud. - - Create or update a cluster in a private cloud. + """Create a Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param cluster: A cluster in the private cloud. Required. + :param cluster: Resource create parameters. Required. :type cluster: ~azure.mgmt.avs.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 - :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 Cluster or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Cluster] :raises ~azure.core.exceptions.HttpResponseError: @@ -549,35 +526,25 @@ def begin_create_or_update( resource_group_name: str, private_cloud_name: str, cluster_name: str, - cluster: IO, + cluster: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.Cluster]: - """Create or update a cluster in a private cloud. - - Create or update a cluster in a private cloud. + """Create a Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param cluster: A cluster in the private cloud. Required. - :type cluster: IO + :param cluster: Resource create parameters. Required. + :type cluster: IO[bytes] :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 Cluster or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Cluster] :raises ~azure.core.exceptions.HttpResponseError: @@ -589,34 +556,21 @@ def begin_create_or_update( resource_group_name: str, private_cloud_name: str, cluster_name: str, - cluster: Union[_models.Cluster, IO], + cluster: Union[_models.Cluster, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Cluster]: - """Create or update a cluster in a private cloud. - - Create or update a cluster in a private cloud. + """Create a Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param cluster: A cluster in the private cloud. Is either a Cluster type or a IO type. + :param cluster: Resource create parameters. Is either a Cluster type or a IO[bytes] type. Required. - :type cluster: ~azure.mgmt.avs.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 - :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. + :type cluster: ~azure.mgmt.avs.models.Cluster or IO[bytes] :return: An instance of LROPoller that returns either Cluster or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Cluster] :raises ~azure.core.exceptions.HttpResponseError: @@ -648,37 +602,37 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Cluster", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.Cluster].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.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}" - } + return LROPoller[_models.Cluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _update_initial( self, resource_group_name: str, private_cloud_name: str, cluster_name: str, - cluster_update: Union[_models.ClusterUpdate, IO], + cluster_update: Union[_models.ClusterUpdate, IO[bytes]], **kwargs: Any ) -> _models.Cluster: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -701,7 +655,7 @@ def _update_initial( else: _json = self._serialize.body(cluster_update, "ClusterUpdate") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cluster_name=cluster_name, @@ -710,16 +664,15 @@ def _update_initial( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -729,21 +682,21 @@ def _update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("Cluster", pipeline_response) if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = self._deserialize("Cluster", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}" - } - @overload def begin_update( self, @@ -755,30 +708,20 @@ def begin_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.Cluster]: - """Update a cluster in a private cloud. - - Update a cluster in a private cloud. + """Update a Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str :param cluster_update: The cluster properties to be updated. Required. :type cluster_update: ~azure.mgmt.avs.models.ClusterUpdate :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 Cluster or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Cluster] :raises ~azure.core.exceptions.HttpResponseError: @@ -790,35 +733,25 @@ def begin_update( resource_group_name: str, private_cloud_name: str, cluster_name: str, - cluster_update: IO, + cluster_update: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.Cluster]: - """Update a cluster in a private cloud. - - Update a cluster in a private cloud. + """Update a Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str :param cluster_update: The cluster properties to be updated. Required. - :type cluster_update: IO + :type cluster_update: IO[bytes] :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 Cluster or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Cluster] :raises ~azure.core.exceptions.HttpResponseError: @@ -830,34 +763,21 @@ def begin_update( resource_group_name: str, private_cloud_name: str, cluster_name: str, - cluster_update: Union[_models.ClusterUpdate, IO], + cluster_update: Union[_models.ClusterUpdate, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Cluster]: - """Update a cluster in a private cloud. - - Update a cluster in a private cloud. + """Update a Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str :param cluster_update: The cluster properties to be updated. Is either a ClusterUpdate type or - a IO type. Required. - :type cluster_update: ~azure.mgmt.avs.models.ClusterUpdate 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. + a IO[bytes] type. Required. + :type cluster_update: ~azure.mgmt.avs.models.ClusterUpdate or IO[bytes] :return: An instance of LROPoller that returns either Cluster or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Cluster] :raises ~azure.core.exceptions.HttpResponseError: @@ -889,32 +809,32 @@ def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Cluster", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.Cluster].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.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}" - } + return LROPoller[_models.Cluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -928,22 +848,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cluster_name=cluster_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -953,36 +872,27 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, None, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace def begin_delete( self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any ) -> LROPoller[None]: - """Delete a cluster in a private cloud. - - Delete a cluster in a private cloud. + """Delete a Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_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: @@ -1010,26 +920,24 @@ def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def list_zones( @@ -1037,21 +945,18 @@ def list_zones( ) -> _models.ClusterZoneList: """List hosts by zone in a cluster. - List hosts by zone in a cluster. - :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: 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: ClusterZoneList or the result of cls(response) :rtype: ~azure.mgmt.avs.models.ClusterZoneList :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1065,22 +970,21 @@ def list_zones( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClusterZoneList] = kwargs.pop("cls", None) - request = build_list_zones_request( + _request = build_list_zones_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_zones.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1093,10 +997,6 @@ def list_zones( deserialized = self._deserialize("ClusterZoneList", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_zones.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/listZones" - } + return deserialized # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_datastores_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_datastores_operations.py index 934635530870..b79c32312420 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_datastores_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_datastores_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +59,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -84,7 +89,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +98,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -124,7 +129,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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") @@ -134,7 +139,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -167,7 +172,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -176,7 +181,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -219,18 +224,15 @@ def __init__(self, *args, **kwargs): def list( self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any ) -> Iterable["_models.Datastore"]: - """List datastores in a private cloud cluster. - - List datastores in a private cloud cluster. + """List Datastore resources by Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: 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 Datastore or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.Datastore] :raises ~azure.core.exceptions.HttpResponseError: @@ -241,7 +243,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DatastoreList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -252,18 +254,17 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cluster_name=cluster_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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -275,13 +276,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("DatastoreList", pipeline_response) @@ -291,11 +292,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -308,33 +309,26 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores" - } - @distributed_trace def get( self, resource_group_name: str, private_cloud_name: str, cluster_name: str, datastore_name: str, **kwargs: Any ) -> _models.Datastore: - """Get a datastore in a private cloud cluster. - - Get a datastore in a private cloud cluster. + """Get a Datastore. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param datastore_name: Name of the datastore in the private cloud cluster. Required. + :param datastore_name: Name of the datastore. Required. :type datastore_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Datastore or the result of cls(response) :rtype: ~azure.mgmt.avs.models.Datastore :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -348,23 +342,22 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Datastore] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cluster_name=cluster_name, datastore_name=datastore_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -377,13 +370,9 @@ def get( deserialized = self._deserialize("Datastore", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, @@ -391,10 +380,10 @@ def _create_or_update_initial( private_cloud_name: str, cluster_name: str, datastore_name: str, - datastore: Union[_models.Datastore, IO], + datastore: Union[_models.Datastore, IO[bytes]], **kwargs: Any ) -> _models.Datastore: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -417,7 +406,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(datastore, "Datastore") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cluster_name=cluster_name, @@ -427,16 +416,15 @@ def _create_or_update_initial( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -446,21 +434,20 @@ def _create_or_update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("Datastore", pipeline_response) if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = self._deserialize("Datastore", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}" - } - @overload def begin_create_or_update( self, @@ -473,32 +460,22 @@ def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.Datastore]: - """Create or update a datastore in a private cloud cluster. - - Create or update a datastore in a private cloud cluster. + """Create a Datastore. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param datastore_name: Name of the datastore in the private cloud cluster. Required. + :param datastore_name: Name of the datastore. Required. :type datastore_name: str - :param datastore: A datastore in a private cloud cluster. Required. + :param datastore: Resource create parameters. Required. :type datastore: ~azure.mgmt.avs.models.Datastore :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 Datastore or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Datastore] :raises ~azure.core.exceptions.HttpResponseError: @@ -511,37 +488,27 @@ def begin_create_or_update( private_cloud_name: str, cluster_name: str, datastore_name: str, - datastore: IO, + datastore: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.Datastore]: - """Create or update a datastore in a private cloud cluster. - - Create or update a datastore in a private cloud cluster. + """Create a Datastore. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param datastore_name: Name of the datastore in the private cloud cluster. Required. + :param datastore_name: Name of the datastore. Required. :type datastore_name: str - :param datastore: A datastore in a private cloud cluster. Required. - :type datastore: IO + :param datastore: Resource create parameters. Required. + :type datastore: IO[bytes] :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 Datastore or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Datastore] :raises ~azure.core.exceptions.HttpResponseError: @@ -554,36 +521,23 @@ def begin_create_or_update( private_cloud_name: str, cluster_name: str, datastore_name: str, - datastore: Union[_models.Datastore, IO], + datastore: Union[_models.Datastore, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Datastore]: - """Create or update a datastore in a private cloud cluster. - - Create or update a datastore in a private cloud cluster. + """Create a Datastore. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param datastore_name: Name of the datastore in the private cloud cluster. Required. + :param datastore_name: Name of the datastore. Required. :type datastore_name: str - :param datastore: A datastore in a private cloud cluster. Is either a Datastore type or a IO - type. Required. - :type datastore: ~azure.mgmt.avs.models.Datastore 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. + :param datastore: Resource create parameters. Is either a Datastore type or a IO[bytes] type. + Required. + :type datastore: ~azure.mgmt.avs.models.Datastore or IO[bytes] :return: An instance of LROPoller that returns either Datastore or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Datastore] :raises ~azure.core.exceptions.HttpResponseError: @@ -616,32 +570,32 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Datastore", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.Datastore].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.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}" - } + return LROPoller[_models.Datastore]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, private_cloud_name: str, cluster_name: str, datastore_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -655,23 +609,22 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cluster_name=cluster_name, datastore_name=datastore_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -681,38 +634,29 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, None, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace def begin_delete( self, resource_group_name: str, private_cloud_name: str, cluster_name: str, datastore_name: str, **kwargs: Any ) -> LROPoller[None]: - """Delete a datastore in a private cloud cluster. - - Delete a datastore in a private cloud cluster. + """Delete a Datastore. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param datastore_name: Name of the datastore in the private cloud cluster. Required. + :param datastore_name: Name of the datastore. Required. :type datastore_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: @@ -741,23 +685,21 @@ def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_global_reach_connections_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_global_reach_connections_operations.py index bb0d3b96cfb6..cf06826bc998 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_global_reach_connections_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_global_reach_connections_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +59,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -82,7 +87,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,7 +96,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -122,7 +127,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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") @@ -132,11 +137,11 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str"), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), "globalReachConnectionName": _SERIALIZER.url( "global_reach_connection_name", global_reach_connection_name, "str", pattern=r"^[-\w\._]+$" ), @@ -165,7 +170,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -174,7 +179,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -218,16 +223,13 @@ def __init__(self, *args, **kwargs): def list( self, resource_group_name: str, private_cloud_name: str, **kwargs: Any ) -> Iterable["_models.GlobalReachConnection"]: - """List global reach connections in a private cloud. - - List global reach connections in a private cloud. + """List GlobalReachConnection resources by PrivateCloud. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GlobalReachConnection or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.GlobalReachConnection] @@ -239,7 +241,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GlobalReachConnectionList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -250,17 +252,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -272,13 +273,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("GlobalReachConnectionList", pipeline_response) @@ -288,11 +289,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -305,32 +306,24 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections" - } - @distributed_trace def get( self, resource_group_name: str, private_cloud_name: str, global_reach_connection_name: str, **kwargs: Any ) -> _models.GlobalReachConnection: - """Get a global reach connection by name in a private cloud. - - Get a global reach connection by name in a private cloud. + """Get a GlobalReachConnection. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param global_reach_connection_name: Name of the global reach connection in the private cloud. - Required. + :param global_reach_connection_name: Name of the global reach connection. Required. :type global_reach_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GlobalReachConnection or the result of cls(response) :rtype: ~azure.mgmt.avs.models.GlobalReachConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -344,22 +337,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GlobalReachConnection] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, global_reach_connection_name=global_reach_connection_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -372,23 +364,19 @@ def get( deserialized = self._deserialize("GlobalReachConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, private_cloud_name: str, global_reach_connection_name: str, - global_reach_connection: Union[_models.GlobalReachConnection, IO], + global_reach_connection: Union[_models.GlobalReachConnection, IO[bytes]], **kwargs: Any ) -> _models.GlobalReachConnection: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -411,7 +399,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(global_reach_connection, "GlobalReachConnection") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, global_reach_connection_name=global_reach_connection_name, @@ -420,16 +408,15 @@ def _create_or_update_initial( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -439,21 +426,20 @@ def _create_or_update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("GlobalReachConnection", pipeline_response) if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = self._deserialize("GlobalReachConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}" - } - @overload def begin_create_or_update( self, @@ -465,31 +451,20 @@ def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GlobalReachConnection]: - """Create or update a global reach connection in a private cloud. - - Create or update a global reach connection in a private cloud. + """Create a GlobalReachConnection. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param global_reach_connection_name: Name of the global reach connection in the private cloud. - Required. + :param global_reach_connection_name: Name of the global reach connection. Required. :type global_reach_connection_name: str - :param global_reach_connection: A global reach connection in the private cloud. Required. + :param global_reach_connection: Resource create parameters. Required. :type global_reach_connection: ~azure.mgmt.avs.models.GlobalReachConnection :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 GlobalReachConnection or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.GlobalReachConnection] @@ -502,36 +477,25 @@ def begin_create_or_update( resource_group_name: str, private_cloud_name: str, global_reach_connection_name: str, - global_reach_connection: IO, + global_reach_connection: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GlobalReachConnection]: - """Create or update a global reach connection in a private cloud. - - Create or update a global reach connection in a private cloud. + """Create a GlobalReachConnection. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param global_reach_connection_name: Name of the global reach connection in the private cloud. - Required. + :param global_reach_connection_name: Name of the global reach connection. Required. :type global_reach_connection_name: str - :param global_reach_connection: A global reach connection in the private cloud. Required. - :type global_reach_connection: IO + :param global_reach_connection: Resource create parameters. Required. + :type global_reach_connection: IO[bytes] :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 GlobalReachConnection or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.GlobalReachConnection] @@ -544,35 +508,21 @@ def begin_create_or_update( resource_group_name: str, private_cloud_name: str, global_reach_connection_name: str, - global_reach_connection: Union[_models.GlobalReachConnection, IO], + global_reach_connection: Union[_models.GlobalReachConnection, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GlobalReachConnection]: - """Create or update a global reach connection in a private cloud. - - Create or update a global reach connection in a private cloud. + """Create a GlobalReachConnection. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param global_reach_connection_name: Name of the global reach connection in the private cloud. - Required. + :param global_reach_connection_name: Name of the global reach connection. Required. :type global_reach_connection_name: str - :param global_reach_connection: A global reach connection in the private cloud. Is either a - GlobalReachConnection type or a IO type. Required. - :type global_reach_connection: ~azure.mgmt.avs.models.GlobalReachConnection 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. + :param global_reach_connection: Resource create parameters. Is either a GlobalReachConnection + type or a IO[bytes] type. Required. + :type global_reach_connection: ~azure.mgmt.avs.models.GlobalReachConnection or IO[bytes] :return: An instance of LROPoller that returns either GlobalReachConnection or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.GlobalReachConnection] @@ -605,32 +555,32 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("GlobalReachConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.GlobalReachConnection].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.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}" - } + return LROPoller[_models.GlobalReachConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, private_cloud_name: str, global_reach_connection_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -644,22 +594,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, global_reach_connection_name=global_reach_connection_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -669,37 +618,27 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, None, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace def begin_delete( self, resource_group_name: str, private_cloud_name: str, global_reach_connection_name: str, **kwargs: Any ) -> LROPoller[None]: - """Delete a global reach connection in a private cloud. - - Delete a global reach connection in a private cloud. + """Delete a GlobalReachConnection. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param global_reach_connection_name: Name of the global reach connection in the private cloud. - Required. + :param global_reach_connection_name: Name of the global reach connection. Required. :type global_reach_connection_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: @@ -727,23 +666,21 @@ def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_hcx_enterprise_sites_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_hcx_enterprise_sites_operations.py index 0f458c3d69f8..e115b4cff556 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_hcx_enterprise_sites_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_hcx_enterprise_sites_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +48,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +57,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -80,7 +85,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,7 +94,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -120,7 +125,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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") @@ -130,11 +135,11 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str"), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), "hcxEnterpriseSiteName": _SERIALIZER.url( "hcx_enterprise_site_name", hcx_enterprise_site_name, "str", pattern=r"^[-\w\._]+$" ), @@ -163,7 +168,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,7 +177,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -216,16 +221,13 @@ def __init__(self, *args, **kwargs): def list( self, resource_group_name: str, private_cloud_name: str, **kwargs: Any ) -> Iterable["_models.HcxEnterpriseSite"]: - """List HCX on-premises key in a private cloud. - - List HCX on-premises key in a private cloud. + """List HcxEnterpriseSite resources by PrivateCloud. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either HcxEnterpriseSite or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.HcxEnterpriseSite] :raises ~azure.core.exceptions.HttpResponseError: @@ -236,7 +238,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HcxEnterpriseSiteList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -247,17 +249,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -269,13 +270,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("HcxEnterpriseSiteList", pipeline_response) @@ -285,11 +286,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -302,32 +303,24 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites" - } - @distributed_trace def get( self, resource_group_name: str, private_cloud_name: str, hcx_enterprise_site_name: str, **kwargs: Any ) -> _models.HcxEnterpriseSite: - """Get an HCX on-premises key by name in a private cloud. - - Get an HCX on-premises key by name in a private cloud. + """Get a HcxEnterpriseSite. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param hcx_enterprise_site_name: Name of the HCX Enterprise Site in the private cloud. - Required. + :param hcx_enterprise_site_name: Name of the HCX Enterprise Site. Required. :type hcx_enterprise_site_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: HcxEnterpriseSite or the result of cls(response) :rtype: ~azure.mgmt.avs.models.HcxEnterpriseSite :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -341,22 +334,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HcxEnterpriseSite] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, hcx_enterprise_site_name=hcx_enterprise_site_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -369,13 +361,9 @@ def get( deserialized = self._deserialize("HcxEnterpriseSite", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -388,24 +376,20 @@ def create_or_update( content_type: str = "application/json", **kwargs: Any ) -> _models.HcxEnterpriseSite: - """Create or update an activation key for on-premises HCX site. - - Create or update an activation key for on-premises HCX site. + """Create a HcxEnterpriseSite. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param hcx_enterprise_site_name: Name of the HCX Enterprise Site in the private cloud. - Required. + :param hcx_enterprise_site_name: Name of the HCX Enterprise Site. Required. :type hcx_enterprise_site_name: str - :param hcx_enterprise_site: The HCX Enterprise Site. Required. + :param hcx_enterprise_site: Resource create parameters. Required. :type hcx_enterprise_site: ~azure.mgmt.avs.models.HcxEnterpriseSite :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: HcxEnterpriseSite or the result of cls(response) :rtype: ~azure.mgmt.avs.models.HcxEnterpriseSite :raises ~azure.core.exceptions.HttpResponseError: @@ -417,29 +401,25 @@ def create_or_update( resource_group_name: str, private_cloud_name: str, hcx_enterprise_site_name: str, - hcx_enterprise_site: IO, + hcx_enterprise_site: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.HcxEnterpriseSite: - """Create or update an activation key for on-premises HCX site. - - Create or update an activation key for on-premises HCX site. + """Create a HcxEnterpriseSite. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param hcx_enterprise_site_name: Name of the HCX Enterprise Site in the private cloud. - Required. + :param hcx_enterprise_site_name: Name of the HCX Enterprise Site. Required. :type hcx_enterprise_site_name: str - :param hcx_enterprise_site: The HCX Enterprise Site. Required. - :type hcx_enterprise_site: IO + :param hcx_enterprise_site: Resource create parameters. Required. + :type hcx_enterprise_site: IO[bytes] :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: HcxEnterpriseSite or the result of cls(response) :rtype: ~azure.mgmt.avs.models.HcxEnterpriseSite :raises ~azure.core.exceptions.HttpResponseError: @@ -451,33 +431,26 @@ def create_or_update( resource_group_name: str, private_cloud_name: str, hcx_enterprise_site_name: str, - hcx_enterprise_site: Union[_models.HcxEnterpriseSite, IO], + hcx_enterprise_site: Union[_models.HcxEnterpriseSite, IO[bytes]], **kwargs: Any ) -> _models.HcxEnterpriseSite: - """Create or update an activation key for on-premises HCX site. - - Create or update an activation key for on-premises HCX site. + """Create a HcxEnterpriseSite. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param hcx_enterprise_site_name: Name of the HCX Enterprise Site in the private cloud. - Required. + :param hcx_enterprise_site_name: Name of the HCX Enterprise Site. Required. :type hcx_enterprise_site_name: str - :param hcx_enterprise_site: The HCX Enterprise Site. Is either a HcxEnterpriseSite type or a IO - type. Required. - :type hcx_enterprise_site: ~azure.mgmt.avs.models.HcxEnterpriseSite 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 + :param hcx_enterprise_site: Resource create parameters. Is either a HcxEnterpriseSite type or a + IO[bytes] type. Required. + :type hcx_enterprise_site: ~azure.mgmt.avs.models.HcxEnterpriseSite or IO[bytes] :return: HcxEnterpriseSite or the result of cls(response) :rtype: ~azure.mgmt.avs.models.HcxEnterpriseSite :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -500,7 +473,7 @@ def create_or_update( else: _json = self._serialize.body(hcx_enterprise_site, "HcxEnterpriseSite") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, hcx_enterprise_site_name=hcx_enterprise_site_name, @@ -509,16 +482,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -539,32 +511,24 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, private_cloud_name: str, hcx_enterprise_site_name: str, **kwargs: Any ) -> None: - """Delete HCX on-premises key in a private cloud. - - Delete HCX on-premises key in a private cloud. + """Delete a HcxEnterpriseSite. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param hcx_enterprise_site_name: Name of the HCX Enterprise Site in the private cloud. - Required. + :param hcx_enterprise_site_name: Name of the HCX Enterprise Site. Required. :type hcx_enterprise_site_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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -578,22 +542,21 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, hcx_enterprise_site_name=hcx_enterprise_site_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -604,8 +567,4 @@ def delete( # pylint: disable=inconsistent-return-statements 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.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_iscsi_paths_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_iscsi_paths_operations.py new file mode 100644 index 000000000000..3dc98978c32a --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_iscsi_paths_operations.py @@ -0,0 +1,638 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, 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 + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # 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_private_cloud_request( + resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/iscsiPaths", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), + } + + _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_get_request( + resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/iscsiPaths/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), + } + + _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_create_or_update_request( + resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "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.AVS/privateClouds/{privateCloudName}/iscsiPaths/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/iscsiPaths/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class IscsiPathsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.avs.AVSClient`'s + :attr:`iscsi_paths` 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_private_cloud( + self, resource_group_name: str, private_cloud_name: str, **kwargs: Any + ) -> Iterable["_models.IscsiPath"]: + """List IscsiPath resources by PrivateCloud. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. Required. + :type private_cloud_name: str + :return: An iterator like instance of either IscsiPath or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.IscsiPath] + :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.IscsiPathListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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_private_cloud_request( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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("IscsiPathListResult", 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) + + @distributed_trace + def get(self, resource_group_name: str, private_cloud_name: str, **kwargs: Any) -> _models.IscsiPath: + """Get a IscsiPath. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. Required. + :type private_cloud_name: str + :return: IscsiPath or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.IscsiPath + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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.IscsiPath] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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("IscsiPath", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + private_cloud_name: str, + resource: Union[_models.IscsiPath, IO[bytes]], + **kwargs: Any + ) -> _models.IscsiPath: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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.IscsiPath] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "IscsiPath") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("IscsiPath", pipeline_response) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("IscsiPath", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + private_cloud_name: str, + resource: _models.IscsiPath, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.IscsiPath]: + """Create a IscsiPath. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. Required. + :type private_cloud_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.avs.models.IscsiPath + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either IscsiPath or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.IscsiPath] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + private_cloud_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.IscsiPath]: + """Create a IscsiPath. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. Required. + :type private_cloud_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either IscsiPath or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.IscsiPath] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + private_cloud_name: str, + resource: Union[_models.IscsiPath, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.IscsiPath]: + """Create a IscsiPath. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. Required. + :type private_cloud_name: str + :param resource: Resource create parameters. Is either a IscsiPath type or a IO[bytes] type. + Required. + :type resource: ~azure.mgmt.avs.models.IscsiPath or IO[bytes] + :return: An instance of LROPoller that returns either IscsiPath or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.IscsiPath] + :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.IscsiPath] = 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, + private_cloud_name=private_cloud_name, + resource=resource, + 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("IscsiPath", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.IscsiPath].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.IscsiPath]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, private_cloud_name: str, **kwargs: Any + ) -> None: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + private_cloud_name=private_cloud_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, private_cloud_name: str, **kwargs: Any) -> LROPoller[None]: + """Delete a IscsiPath. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. Required. + :type private_cloud_name: str + :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, + private_cloud_name=private_cloud_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, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_locations_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_locations_operations.py index f078668e4ffa..d89efd055526 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_locations_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_locations_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -35,22 +40,21 @@ _SERIALIZER.client_side_validation = False -def build_check_trial_availability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_check_quota_availability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) - 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}/providers/Microsoft.AVS/locations/{location}/checkTrialAvailability", + "/subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkQuotaAvailability", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str", min_length=1), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -59,28 +63,27 @@ def build_check_trial_availability_request(location: str, subscription_id: str, _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_check_quota_availability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_check_trial_availability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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}/providers/Microsoft.AVS/locations/{location}/checkQuotaAvailability", + "/subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkTrialAvailability", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str", min_length=1), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -89,6 +92,8 @@ def build_check_quota_availability_request(location: str, subscription_id: str, _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) @@ -113,20 +118,72 @@ 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 check_quota_availability(self, location: str, **kwargs: Any) -> _models.Quota: + """Return quota for subscription by region. + + :param location: The name of the Azure region. Required. + :type location: str + :return: Quota or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.Quota + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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.Quota] = kwargs.pop("cls", None) + + _request = build_check_quota_availability_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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("Quota", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + @overload def check_trial_availability( self, location: str, sku: Optional[_models.Sku] = None, *, content_type: str = "application/json", **kwargs: Any ) -> _models.Trial: """Return trial status for subscription by region. - :param location: Azure region. Required. + :param location: The name of the Azure region. Required. :type location: str - :param sku: The sku to check for trial availability. Default value is None. + :param sku: Optionally, check for a specific SKU. Default value is None. :type sku: ~azure.mgmt.avs.models.Sku :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: Trial or the result of cls(response) :rtype: ~azure.mgmt.avs.models.Trial :raises ~azure.core.exceptions.HttpResponseError: @@ -134,18 +191,17 @@ def check_trial_availability( @overload def check_trial_availability( - self, location: str, sku: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any + self, location: str, sku: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any ) -> _models.Trial: """Return trial status for subscription by region. - :param location: Azure region. Required. + :param location: The name of the Azure region. Required. :type location: str - :param sku: The sku to check for trial availability. Default value is None. - :type sku: IO + :param sku: Optionally, check for a specific SKU. Default value is None. + :type sku: IO[bytes] :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: Trial or the result of cls(response) :rtype: ~azure.mgmt.avs.models.Trial :raises ~azure.core.exceptions.HttpResponseError: @@ -153,24 +209,20 @@ def check_trial_availability( @distributed_trace def check_trial_availability( - self, location: str, sku: Optional[Union[_models.Sku, IO]] = None, **kwargs: Any + self, location: str, sku: Optional[Union[_models.Sku, IO[bytes]]] = None, **kwargs: Any ) -> _models.Trial: """Return trial status for subscription by region. - :param location: Azure region. Required. + :param location: The name of the Azure region. Required. :type location: str - :param sku: The sku to check for trial availability. Is either a Sku type or a IO type. Default - value is None. - :type sku: ~azure.mgmt.avs.models.Sku or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + :param sku: Optionally, check for a specific SKU. Is either a Sku type or a IO[bytes] type. Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :type sku: ~azure.mgmt.avs.models.Sku or IO[bytes] :return: Trial or the result of cls(response) :rtype: ~azure.mgmt.avs.models.Trial :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -196,23 +248,22 @@ def check_trial_availability( else: _json = None - request = build_check_trial_availability_request( + _request = build_check_trial_availability_request( location=location, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.check_trial_availability.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -225,69 +276,6 @@ def check_trial_availability( deserialized = self._deserialize("Trial", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - check_trial_availability.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkTrialAvailability" - } - - @distributed_trace - def check_quota_availability(self, location: str, **kwargs: Any) -> _models.Quota: - """Return quota for subscription by region. - - :param location: Azure region. Required. - :type location: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Quota or the result of cls(response) - :rtype: ~azure.mgmt.avs.models.Quota - :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.Quota] = kwargs.pop("cls", None) - - request = build_check_quota_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.check_quota_availability.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("Quota", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - check_quota_availability.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkQuotaAvailability" - } + return deserialized # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_operations.py index a0be57989bf7..179d53141e25 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,9 +81,8 @@ def __init__(self, *args, **kwargs): @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: - """Lists all of the available operations. + """List the operations for the provider. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Operation or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: @@ -87,9 +91,9 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _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.OperationList] = kwargs.pop("cls", None) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -100,14 +104,13 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _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) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -119,27 +122,27 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("OperationList", 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) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,5 +154,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.AVS/operations"} diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_placement_policies_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_placement_policies_operations.py index 8e3da3e88436..7d89028431e6 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_placement_policies_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_placement_policies_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +59,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -84,7 +89,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +98,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -126,7 +131,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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") @@ -136,7 +141,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -171,7 +176,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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") @@ -181,7 +186,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -216,7 +221,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -225,7 +230,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -270,18 +275,15 @@ def __init__(self, *args, **kwargs): def list( self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any ) -> Iterable["_models.PlacementPolicy"]: - """List placement policies in a private cloud cluster. - - List placement policies in a private cloud cluster. + """List PlacementPolicy resources by Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: 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 PlacementPolicy or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.PlacementPolicy] :raises ~azure.core.exceptions.HttpResponseError: @@ -292,7 +294,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PlacementPoliciesList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -303,18 +305,17 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cluster_name=cluster_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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -326,13 +327,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("PlacementPoliciesList", pipeline_response) @@ -342,11 +343,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -359,10 +360,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies" - } - @distributed_trace def get( self, @@ -372,26 +369,22 @@ def get( placement_policy_name: str, **kwargs: Any ) -> _models.PlacementPolicy: - """Get a placement policy by name in a private cloud cluster. - - Get a placement policy by name in a private cloud cluster. + """Get a PlacementPolicy. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS) - placement policy. Required. + :param placement_policy_name: Name of the placement policy. Required. :type placement_policy_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PlacementPolicy or the result of cls(response) :rtype: ~azure.mgmt.avs.models.PlacementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -405,23 +398,22 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PlacementPolicy] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cluster_name=cluster_name, placement_policy_name=placement_policy_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -434,13 +426,9 @@ def get( deserialized = self._deserialize("PlacementPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, @@ -448,10 +436,10 @@ def _create_or_update_initial( private_cloud_name: str, cluster_name: str, placement_policy_name: str, - placement_policy: Union[_models.PlacementPolicy, IO], + placement_policy: Union[_models.PlacementPolicy, IO[bytes]], **kwargs: Any ) -> _models.PlacementPolicy: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -474,7 +462,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(placement_policy, "PlacementPolicy") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cluster_name=cluster_name, @@ -484,16 +472,15 @@ def _create_or_update_initial( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -503,21 +490,20 @@ def _create_or_update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("PlacementPolicy", pipeline_response) if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = self._deserialize("PlacementPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}" - } - @overload def begin_create_or_update( self, @@ -530,33 +516,22 @@ def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.PlacementPolicy]: - """Create or update a placement policy in a private cloud cluster. - - Create or update a placement policy in a private cloud cluster. + """Create a PlacementPolicy. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS) - placement policy. Required. + :param placement_policy_name: Name of the placement policy. Required. :type placement_policy_name: str - :param placement_policy: A placement policy in the private cloud cluster. Required. + :param placement_policy: Resource create parameters. Required. :type placement_policy: ~azure.mgmt.avs.models.PlacementPolicy :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 PlacementPolicy or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PlacementPolicy] @@ -570,38 +545,27 @@ def begin_create_or_update( private_cloud_name: str, cluster_name: str, placement_policy_name: str, - placement_policy: IO, + placement_policy: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.PlacementPolicy]: - """Create or update a placement policy in a private cloud cluster. - - Create or update a placement policy in a private cloud cluster. + """Create a PlacementPolicy. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS) - placement policy. Required. + :param placement_policy_name: Name of the placement policy. Required. :type placement_policy_name: str - :param placement_policy: A placement policy in the private cloud cluster. Required. - :type placement_policy: IO + :param placement_policy: Resource create parameters. Required. + :type placement_policy: IO[bytes] :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 PlacementPolicy or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PlacementPolicy] @@ -615,37 +579,23 @@ def begin_create_or_update( private_cloud_name: str, cluster_name: str, placement_policy_name: str, - placement_policy: Union[_models.PlacementPolicy, IO], + placement_policy: Union[_models.PlacementPolicy, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.PlacementPolicy]: - """Create or update a placement policy in a private cloud cluster. - - Create or update a placement policy in a private cloud cluster. + """Create a PlacementPolicy. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS) - placement policy. Required. + :param placement_policy_name: Name of the placement policy. Required. :type placement_policy_name: str - :param placement_policy: A placement policy in the private cloud cluster. Is either a - PlacementPolicy type or a IO type. Required. - :type placement_policy: ~azure.mgmt.avs.models.PlacementPolicy 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. + :param placement_policy: Resource create parameters. Is either a PlacementPolicy type or a + IO[bytes] type. Required. + :type placement_policy: ~azure.mgmt.avs.models.PlacementPolicy or IO[bytes] :return: An instance of LROPoller that returns either PlacementPolicy or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PlacementPolicy] @@ -679,27 +629,27 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("PlacementPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.PlacementPolicy].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.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}" - } + return LROPoller[_models.PlacementPolicy]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _update_initial( self, @@ -707,10 +657,10 @@ def _update_initial( private_cloud_name: str, cluster_name: str, placement_policy_name: str, - placement_policy_update: Union[_models.PlacementPolicyUpdate, IO], + placement_policy_update: Union[_models.PlacementPolicyUpdate, IO[bytes]], **kwargs: Any ) -> _models.PlacementPolicy: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -733,7 +683,7 @@ def _update_initial( else: _json = self._serialize.body(placement_policy_update, "PlacementPolicyUpdate") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cluster_name=cluster_name, @@ -743,16 +693,15 @@ def _update_initial( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -762,21 +711,21 @@ def _update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("PlacementPolicy", pipeline_response) if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = self._deserialize("PlacementPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}" - } - @overload def begin_update( self, @@ -789,33 +738,22 @@ def begin_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.PlacementPolicy]: - """Update a placement policy in a private cloud cluster. - - Update a placement policy in a private cloud cluster. + """Update a PlacementPolicy. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS) - placement policy. Required. + :param placement_policy_name: Name of the placement policy. Required. :type placement_policy_name: str - :param placement_policy_update: The placement policy properties that may be updated. Required. + :param placement_policy_update: The placement policy properties to be updated. Required. :type placement_policy_update: ~azure.mgmt.avs.models.PlacementPolicyUpdate :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 PlacementPolicy or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PlacementPolicy] @@ -829,38 +767,27 @@ def begin_update( private_cloud_name: str, cluster_name: str, placement_policy_name: str, - placement_policy_update: IO, + placement_policy_update: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.PlacementPolicy]: - """Update a placement policy in a private cloud cluster. - - Update a placement policy in a private cloud cluster. + """Update a PlacementPolicy. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS) - placement policy. Required. + :param placement_policy_name: Name of the placement policy. Required. :type placement_policy_name: str - :param placement_policy_update: The placement policy properties that may be updated. Required. - :type placement_policy_update: IO + :param placement_policy_update: The placement policy properties to be updated. Required. + :type placement_policy_update: IO[bytes] :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 PlacementPolicy or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PlacementPolicy] @@ -874,37 +801,23 @@ def begin_update( private_cloud_name: str, cluster_name: str, placement_policy_name: str, - placement_policy_update: Union[_models.PlacementPolicyUpdate, IO], + placement_policy_update: Union[_models.PlacementPolicyUpdate, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.PlacementPolicy]: - """Update a placement policy in a private cloud cluster. - - Update a placement policy in a private cloud cluster. + """Update a PlacementPolicy. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS) - placement policy. Required. + :param placement_policy_name: Name of the placement policy. Required. :type placement_policy_name: str - :param placement_policy_update: The placement policy properties that may be updated. Is either - a PlacementPolicyUpdate type or a IO type. Required. - :type placement_policy_update: ~azure.mgmt.avs.models.PlacementPolicyUpdate 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. + :param placement_policy_update: The placement policy properties to be updated. Is either a + PlacementPolicyUpdate type or a IO[bytes] type. Required. + :type placement_policy_update: ~azure.mgmt.avs.models.PlacementPolicyUpdate or IO[bytes] :return: An instance of LROPoller that returns either PlacementPolicy or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PlacementPolicy] @@ -938,27 +851,27 @@ def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("PlacementPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.PlacementPolicy].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.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}" - } + return LROPoller[_models.PlacementPolicy]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -968,7 +881,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements placement_policy_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -982,23 +895,22 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cluster_name=cluster_name, placement_policy_name=placement_policy_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1008,12 +920,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, None, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace def begin_delete( @@ -1024,28 +937,17 @@ def begin_delete( placement_policy_name: str, **kwargs: Any ) -> LROPoller[None]: - """Delete a placement policy in a private cloud cluster. - - Delete a placement policy in a private cloud cluster. + """Delete a PlacementPolicy. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS) - placement policy. Required. + :param placement_policy_name: Name of the placement policy. Required. :type placement_policy_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: @@ -1074,23 +976,21 @@ def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_private_clouds_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_private_clouds_operations.py index 6f351e0922f1..27d52b0badbf 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_private_clouds_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_private_clouds_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,23 +44,17 @@ _SERIALIZER.client_side_validation = False -def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_list_in_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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds", - ) # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AVS/privateClouds") 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 - ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -69,17 +68,23 @@ def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_in_subscription_request(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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds") + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -99,7 +104,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -108,7 +113,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -132,7 +137,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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") @@ -142,7 +147,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -168,7 +173,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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") @@ -178,7 +183,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -204,7 +209,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -213,7 +218,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -231,22 +236,22 @@ def build_delete_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_rotate_vcenter_password_request( +def build_list_admin_credentials_request( resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds/{privateCloudName}/rotateVcenterPassword", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/listAdminCredentials", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -270,7 +275,7 @@ def build_rotate_nsxt_password_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -279,7 +284,7 @@ def build_rotate_nsxt_password_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateNsxtPassword", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -297,22 +302,22 @@ def build_rotate_nsxt_password_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_admin_credentials_request( +def build_rotate_vcenter_password_request( resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds/{privateCloudName}/listAdminCredentials", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateVcenterPassword", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -350,15 +355,9 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.PrivateCloud"]: - """List private clouds in a resource group. - - List private clouds in a resource group. + def list_in_subscription(self, **kwargs: Any) -> Iterable["_models.PrivateCloud"]: + """List PrivateCloud resources by subscription ID. - :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 PrivateCloud or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.PrivateCloud] :raises ~azure.core.exceptions.HttpResponseError: @@ -369,7 +368,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Pri api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateCloudList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -380,16 +379,14 @@ def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Pri def prepare_request(next_link=None): if not next_link: - request = build_list_request( - resource_group_name=resource_group_name, + _request = build_list_in_subscription_request( 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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -401,13 +398,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("PrivateCloudList", pipeline_response) @@ -417,11 +414,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -434,17 +431,13 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds" - } - @distributed_trace - def list_in_subscription(self, **kwargs: Any) -> Iterable["_models.PrivateCloud"]: - """List private clouds in a subscription. - - List private clouds in a subscription. + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.PrivateCloud"]: + """List PrivateCloud resources by resource group. - :keyword callable cls: A custom type or function that will be passed the direct response + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str :return: An iterator like instance of either PrivateCloud or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.PrivateCloud] :raises ~azure.core.exceptions.HttpResponseError: @@ -455,7 +448,7 @@ def list_in_subscription(self, **kwargs: Any) -> Iterable["_models.PrivateCloud" api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateCloudList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -466,15 +459,15 @@ def list_in_subscription(self, **kwargs: Any) -> Iterable["_models.PrivateCloud" def prepare_request(next_link=None): if not next_link: - request = build_list_in_subscription_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_in_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -486,13 +479,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("PrivateCloudList", pipeline_response) @@ -502,11 +495,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -519,25 +512,20 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AVS/privateClouds"} - @distributed_trace def get(self, resource_group_name: str, private_cloud_name: str, **kwargs: Any) -> _models.PrivateCloud: - """Get a private cloud. - - Get a private cloud. + """Get a PrivateCloud. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateCloud or the result of cls(response) :rtype: ~azure.mgmt.avs.models.PrivateCloud :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -551,21 +539,20 @@ def get(self, resource_group_name: str, private_cloud_name: str, **kwargs: Any) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateCloud] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -578,22 +565,18 @@ def get(self, resource_group_name: str, private_cloud_name: str, **kwargs: Any) deserialized = self._deserialize("PrivateCloud", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, private_cloud_name: str, - private_cloud: Union[_models.PrivateCloud, IO], + private_cloud: Union[_models.PrivateCloud, IO[bytes]], **kwargs: Any ) -> _models.PrivateCloud: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -616,7 +599,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(private_cloud, "PrivateCloud") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, subscription_id=self._config.subscription_id, @@ -624,16 +607,15 @@ def _create_or_update_initial( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -643,21 +625,20 @@ def _create_or_update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("PrivateCloud", pipeline_response) if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = self._deserialize("PrivateCloud", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}" - } - @overload def begin_create_or_update( self, @@ -668,28 +649,18 @@ def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.PrivateCloud]: - """Create or update a private cloud. - - Create or update a private cloud. + """Create a PrivateCloud. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param private_cloud: The private cloud. Required. + :param private_cloud: Resource create parameters. Required. :type private_cloud: ~azure.mgmt.avs.models.PrivateCloud :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 PrivateCloud or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PrivateCloud] @@ -701,33 +672,23 @@ def begin_create_or_update( self, resource_group_name: str, private_cloud_name: str, - private_cloud: IO, + private_cloud: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.PrivateCloud]: - """Create or update a private cloud. - - Create or update a private cloud. + """Create a PrivateCloud. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param private_cloud: The private cloud. Required. - :type private_cloud: IO + :param private_cloud: Resource create parameters. Required. + :type private_cloud: IO[bytes] :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 PrivateCloud or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PrivateCloud] @@ -739,31 +700,19 @@ def begin_create_or_update( self, resource_group_name: str, private_cloud_name: str, - private_cloud: Union[_models.PrivateCloud, IO], + private_cloud: Union[_models.PrivateCloud, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.PrivateCloud]: - """Create or update a private cloud. - - Create or update a private cloud. + """Create a PrivateCloud. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param private_cloud: The private cloud. Is either a PrivateCloud type or a IO type. Required. - :type private_cloud: ~azure.mgmt.avs.models.PrivateCloud 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. + :param private_cloud: Resource create parameters. Is either a PrivateCloud type or a IO[bytes] + type. Required. + :type private_cloud: ~azure.mgmt.avs.models.PrivateCloud or IO[bytes] :return: An instance of LROPoller that returns either PrivateCloud or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PrivateCloud] @@ -795,36 +744,36 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("PrivateCloud", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.PrivateCloud].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.AVS/privateClouds/{privateCloudName}" - } + return LROPoller[_models.PrivateCloud]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _update_initial( self, resource_group_name: str, private_cloud_name: str, - private_cloud_update: Union[_models.PrivateCloudUpdate, IO], + private_cloud_update: Union[_models.PrivateCloudUpdate, IO[bytes]], **kwargs: Any ) -> _models.PrivateCloud: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -847,7 +796,7 @@ def _update_initial( else: _json = self._serialize.body(private_cloud_update, "PrivateCloudUpdate") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, subscription_id=self._config.subscription_id, @@ -855,16 +804,15 @@ def _update_initial( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -874,21 +822,21 @@ def _update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("PrivateCloud", pipeline_response) if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = self._deserialize("PrivateCloud", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}" - } - @overload def begin_update( self, @@ -899,9 +847,7 @@ def begin_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.PrivateCloud]: - """Update a private cloud. - - Update a private cloud. + """Update a PrivateCloud. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -913,14 +859,6 @@ def begin_update( :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 PrivateCloud or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PrivateCloud] @@ -932,14 +870,12 @@ def begin_update( self, resource_group_name: str, private_cloud_name: str, - private_cloud_update: IO, + private_cloud_update: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.PrivateCloud]: - """Update a private cloud. - - Update a private cloud. + """Update a PrivateCloud. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -947,18 +883,10 @@ def begin_update( :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str :param private_cloud_update: The private cloud properties to be updated. Required. - :type private_cloud_update: IO + :type private_cloud_update: IO[bytes] :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 PrivateCloud or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PrivateCloud] @@ -970,12 +898,10 @@ def begin_update( self, resource_group_name: str, private_cloud_name: str, - private_cloud_update: Union[_models.PrivateCloudUpdate, IO], + private_cloud_update: Union[_models.PrivateCloudUpdate, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.PrivateCloud]: - """Update a private cloud. - - Update a private cloud. + """Update a PrivateCloud. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -983,19 +909,8 @@ def begin_update( :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str :param private_cloud_update: The private cloud properties to be updated. Is either a - PrivateCloudUpdate type or a IO type. Required. - :type private_cloud_update: ~azure.mgmt.avs.models.PrivateCloudUpdate 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. + PrivateCloudUpdate type or a IO[bytes] type. Required. + :type private_cloud_update: ~azure.mgmt.avs.models.PrivateCloudUpdate or IO[bytes] :return: An instance of LROPoller that returns either PrivateCloud or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PrivateCloud] @@ -1027,32 +942,32 @@ def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("PrivateCloud", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.PrivateCloud].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.AVS/privateClouds/{privateCloudName}" - } + return LROPoller[_models.PrivateCloud]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, private_cloud_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1066,21 +981,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1090,32 +1004,23 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, None, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, private_cloud_name: str, **kwargs: Any) -> LROPoller[None]: - """Delete a private cloud. - - Delete a private cloud. + """Delete a PrivateCloud. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_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: @@ -1142,31 +1047,88 @@ def begin_delete(self, resource_group_name: str, private_cloud_name: str, **kwar def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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 + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}" - } + @distributed_trace + def list_admin_credentials( + self, resource_group_name: str, private_cloud_name: str, **kwargs: Any + ) -> _models.AdminCredentials: + """List the admin credentials for the private cloud. - def _rotate_vcenter_password_initial( # pylint: disable=inconsistent-return-statements + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. Required. + :type private_cloud_name: str + :return: AdminCredentials or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.AdminCredentials + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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.AdminCredentials] = kwargs.pop("cls", None) + + _request = build_list_admin_credentials_request( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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("AdminCredentials", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _rotate_nsxt_password_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, private_cloud_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1180,21 +1142,20 @@ def _rotate_vcenter_password_initial( # pylint: disable=inconsistent-return-sta api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_rotate_vcenter_password_request( + _request = build_rotate_nsxt_password_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_vcenter_password_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1204,34 +1165,25 @@ def _rotate_vcenter_password_initial( # pylint: disable=inconsistent-return-sta 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, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _rotate_vcenter_password_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateVcenterPassword" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace - def begin_rotate_vcenter_password( + def begin_rotate_nsxt_password( self, resource_group_name: str, private_cloud_name: str, **kwargs: Any ) -> LROPoller[None]: - """Rotate the vCenter password. - - Rotate the vCenter password. + """Rotate the NSX-T Manager password. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_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: @@ -1245,7 +1197,7 @@ def begin_rotate_vcenter_password( 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._rotate_vcenter_password_initial( # type: ignore + raw_result = self._rotate_nsxt_password_initial( # type: ignore resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, api_version=api_version, @@ -1258,31 +1210,29 @@ def begin_rotate_vcenter_password( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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_rotate_vcenter_password.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateVcenterPassword" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _rotate_nsxt_password_initial( # pylint: disable=inconsistent-return-statements + def _rotate_vcenter_password_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, private_cloud_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1296,21 +1246,20 @@ def _rotate_nsxt_password_initial( # pylint: disable=inconsistent-return-statem api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_rotate_nsxt_password_request( + _request = build_rotate_vcenter_password_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_nsxt_password_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1320,34 +1269,25 @@ def _rotate_nsxt_password_initial( # pylint: disable=inconsistent-return-statem 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, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _rotate_nsxt_password_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateNsxtPassword" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace - def begin_rotate_nsxt_password( + def begin_rotate_vcenter_password( self, resource_group_name: str, private_cloud_name: str, **kwargs: Any ) -> LROPoller[None]: - """Rotate the NSX-T Manager password. - - Rotate the NSX-T Manager password. + """Rotate the vCenter password. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_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: @@ -1361,7 +1301,7 @@ def begin_rotate_nsxt_password( 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._rotate_nsxt_password_initial( # type: ignore + raw_result = self._rotate_vcenter_password_initial( # type: ignore resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, api_version=api_version, @@ -1374,90 +1314,21 @@ def begin_rotate_nsxt_password( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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_rotate_nsxt_password.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateNsxtPassword" - } - - @distributed_trace - def list_admin_credentials( - self, resource_group_name: str, private_cloud_name: str, **kwargs: Any - ) -> _models.AdminCredentials: - """List the admin credentials for the private cloud. - - List the admin credentials for the private cloud. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param private_cloud_name: Name of the private cloud. Required. - :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AdminCredentials or the result of cls(response) - :rtype: ~azure.mgmt.avs.models.AdminCredentials - :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.AdminCredentials] = kwargs.pop("cls", None) - - request = build_list_admin_credentials_request( - resource_group_name=resource_group_name, - private_cloud_name=private_cloud_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_admin_credentials.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("AdminCredentials", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_admin_credentials.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/listAdminCredentials" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_script_cmdlets_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_script_cmdlets_operations.py index 204dbac22837..00de4fbd7dfa 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_script_cmdlets_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_script_cmdlets_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -51,7 +56,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}/scriptCmdlets", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -83,7 +88,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +97,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}/scriptCmdlets/{scriptCmdletName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -137,17 +142,15 @@ def __init__(self, *args, **kwargs): def list( self, resource_group_name: str, private_cloud_name: str, script_package_name: str, **kwargs: Any ) -> Iterable["_models.ScriptCmdlet"]: - """List script cmdlet resources available for a private cloud to create a script execution - resource on a private cloud. + """List ScriptCmdlet resources by ScriptPackage. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param script_package_name: Name of the script package in the private cloud. Required. + :param script_package_name: Name of the script package. Required. :type script_package_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScriptCmdlet or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.ScriptCmdlet] :raises ~azure.core.exceptions.HttpResponseError: @@ -158,7 +161,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScriptCmdletsList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -169,18 +172,17 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, script_package_name=script_package_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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -192,13 +194,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("ScriptCmdletsList", pipeline_response) @@ -208,11 +210,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -225,10 +227,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}/scriptCmdlets" - } - @distributed_trace def get( self, @@ -238,24 +236,22 @@ def get( script_cmdlet_name: str, **kwargs: Any ) -> _models.ScriptCmdlet: - """Return information about a script cmdlet resource in a specific package on a private cloud. + """Get a ScriptCmdlet. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param script_package_name: Name of the script package in the private cloud. Required. + :param script_package_name: Name of the script package. Required. :type script_package_name: str - :param script_cmdlet_name: Name of the script cmdlet resource in the script package in the - private cloud. Required. + :param script_cmdlet_name: Name of the script cmdlet. Required. :type script_cmdlet_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScriptCmdlet or the result of cls(response) :rtype: ~azure.mgmt.avs.models.ScriptCmdlet :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -269,23 +265,22 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScriptCmdlet] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, script_package_name=script_package_name, script_cmdlet_name=script_cmdlet_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -298,10 +293,6 @@ def get( deserialized = self._deserialize("ScriptCmdlet", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}/scriptCmdlets/{scriptCmdletName}" - } + return deserialized # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_script_executions_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_script_executions_operations.py index c1f4b16372a9..26c758241d23 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_script_executions_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_script_executions_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +59,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -78,7 +83,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +92,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -114,7 +119,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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") @@ -124,11 +129,11 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str"), + "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), "scriptExecutionName": _SERIALIZER.url( "script_execution_name", script_execution_name, "str", pattern=r"^[-\w\._]+$" ), @@ -153,7 +158,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +167,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -189,7 +194,7 @@ def build_get_execution_logs_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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") @@ -199,7 +204,7 @@ def build_get_execution_logs_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}/getExecutionLogs", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -245,16 +250,13 @@ def __init__(self, *args, **kwargs): def list( self, resource_group_name: str, private_cloud_name: str, **kwargs: Any ) -> Iterable["_models.ScriptExecution"]: - """List script executions in a private cloud. - - List script executions in a private cloud. + """List ScriptExecution resources by PrivateCloud. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScriptExecution or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.ScriptExecution] :raises ~azure.core.exceptions.HttpResponseError: @@ -265,7 +267,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScriptExecutionsList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -276,17 +278,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -298,13 +299,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("ScriptExecutionsList", pipeline_response) @@ -314,11 +315,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -331,31 +332,24 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions" - } - @distributed_trace def get( self, resource_group_name: str, private_cloud_name: str, script_execution_name: str, **kwargs: Any ) -> _models.ScriptExecution: - """Get an script execution by name in a private cloud. - - Get an script execution by name in a private cloud. + """Get a ScriptExecution. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param script_execution_name: Name of the user-invoked script execution resource. Required. + :param script_execution_name: Name of the script cmdlet. Required. :type script_execution_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScriptExecution or the result of cls(response) :rtype: ~azure.mgmt.avs.models.ScriptExecution :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -369,22 +363,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScriptExecution] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, script_execution_name=script_execution_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -397,23 +390,19 @@ def get( deserialized = self._deserialize("ScriptExecution", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, private_cloud_name: str, script_execution_name: str, - script_execution: Union[_models.ScriptExecution, IO], + script_execution: Union[_models.ScriptExecution, IO[bytes]], **kwargs: Any ) -> _models.ScriptExecution: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -436,7 +425,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(script_execution, "ScriptExecution") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, script_execution_name=script_execution_name, @@ -445,16 +434,15 @@ def _create_or_update_initial( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -464,21 +452,20 @@ def _create_or_update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ScriptExecution", pipeline_response) if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = self._deserialize("ScriptExecution", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}" - } - @overload def begin_create_or_update( self, @@ -490,30 +477,20 @@ def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ScriptExecution]: - """Create or update a script execution in a private cloud. - - Create or update a script execution in a private cloud. + """Create a ScriptExecution. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param script_execution_name: Name of the user-invoked script execution resource. Required. + :param script_execution_name: Name of the script cmdlet. Required. :type script_execution_name: str - :param script_execution: A script running in the private cloud. Required. + :param script_execution: Resource create parameters. Required. :type script_execution: ~azure.mgmt.avs.models.ScriptExecution :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 ScriptExecution or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.ScriptExecution] @@ -526,35 +503,25 @@ def begin_create_or_update( resource_group_name: str, private_cloud_name: str, script_execution_name: str, - script_execution: IO, + script_execution: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ScriptExecution]: - """Create or update a script execution in a private cloud. - - Create or update a script execution in a private cloud. + """Create a ScriptExecution. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param script_execution_name: Name of the user-invoked script execution resource. Required. + :param script_execution_name: Name of the script cmdlet. Required. :type script_execution_name: str - :param script_execution: A script running in the private cloud. Required. - :type script_execution: IO + :param script_execution: Resource create parameters. Required. + :type script_execution: IO[bytes] :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 ScriptExecution or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.ScriptExecution] @@ -567,34 +534,21 @@ def begin_create_or_update( resource_group_name: str, private_cloud_name: str, script_execution_name: str, - script_execution: Union[_models.ScriptExecution, IO], + script_execution: Union[_models.ScriptExecution, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.ScriptExecution]: - """Create or update a script execution in a private cloud. - - Create or update a script execution in a private cloud. + """Create a ScriptExecution. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param private_cloud_name: The name of the private cloud. Required. + :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param script_execution_name: Name of the user-invoked script execution resource. Required. + :param script_execution_name: Name of the script cmdlet. Required. :type script_execution_name: str - :param script_execution: A script running in the private cloud. Is either a ScriptExecution - type or a IO type. Required. - :type script_execution: ~azure.mgmt.avs.models.ScriptExecution 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. + :param script_execution: Resource create parameters. Is either a ScriptExecution type or a + IO[bytes] type. Required. + :type script_execution: ~azure.mgmt.avs.models.ScriptExecution or IO[bytes] :return: An instance of LROPoller that returns either ScriptExecution or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.ScriptExecution] @@ -627,32 +581,32 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ScriptExecution", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ScriptExecution].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.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}" - } + return LROPoller[_models.ScriptExecution]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, private_cloud_name: str, script_execution_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -666,22 +620,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, script_execution_name=script_execution_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -691,36 +644,27 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, None, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace def begin_delete( self, resource_group_name: str, private_cloud_name: str, script_execution_name: str, **kwargs: Any ) -> LROPoller[None]: - """Cancel a ScriptExecution in a private cloud. - - Cancel a ScriptExecution in a private cloud. + """Delete a ScriptExecution. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param script_execution_name: Name of the user-invoked script execution resource. Required. + :param script_execution_name: Name of the script cmdlet. Required. :type script_execution_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: @@ -748,26 +692,24 @@ def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @overload def get_execution_logs( @@ -787,7 +729,7 @@ def get_execution_logs( :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param script_execution_name: Name of the user-invoked script execution resource. Required. + :param script_execution_name: Name of the script cmdlet. Required. :type script_execution_name: str :param script_output_stream_type: Name of the desired output stream to return. If not provided, will return all. An empty array will return nothing. Default value is None. @@ -795,7 +737,6 @@ def get_execution_logs( :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: ScriptExecution or the result of cls(response) :rtype: ~azure.mgmt.avs.models.ScriptExecution :raises ~azure.core.exceptions.HttpResponseError: @@ -807,7 +748,7 @@ def get_execution_logs( resource_group_name: str, private_cloud_name: str, script_execution_name: str, - script_output_stream_type: Optional[IO] = None, + script_output_stream_type: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -819,15 +760,14 @@ def get_execution_logs( :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param script_execution_name: Name of the user-invoked script execution resource. Required. + :param script_execution_name: Name of the script cmdlet. Required. :type script_execution_name: str :param script_output_stream_type: Name of the desired output stream to return. If not provided, will return all. An empty array will return nothing. Default value is None. - :type script_output_stream_type: IO + :type script_output_stream_type: IO[bytes] :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: ScriptExecution or the result of cls(response) :rtype: ~azure.mgmt.avs.models.ScriptExecution :raises ~azure.core.exceptions.HttpResponseError: @@ -839,7 +779,7 @@ def get_execution_logs( resource_group_name: str, private_cloud_name: str, script_execution_name: str, - script_output_stream_type: Optional[Union[List[Union[str, _models.ScriptOutputStreamType]], IO]] = None, + script_output_stream_type: Optional[Union[List[Union[str, _models.ScriptOutputStreamType]], IO[bytes]]] = None, **kwargs: Any ) -> _models.ScriptExecution: """Return the logs for a script execution resource. @@ -849,22 +789,18 @@ def get_execution_logs( :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param script_execution_name: Name of the user-invoked script execution resource. Required. + :param script_execution_name: Name of the script cmdlet. Required. :type script_execution_name: str :param script_output_stream_type: Name of the desired output stream to return. If not provided, will return all. An empty array will return nothing. Is either a [Union[str, - "_models.ScriptOutputStreamType"]] type or a IO type. Default value is None. + "_models.ScriptOutputStreamType"]] type or a IO[bytes] type. Default value is None. :type script_output_stream_type: list[str or ~azure.mgmt.avs.models.ScriptOutputStreamType] 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 + IO[bytes] :return: ScriptExecution or the result of cls(response) :rtype: ~azure.mgmt.avs.models.ScriptExecution :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -890,7 +826,7 @@ def get_execution_logs( else: _json = None - request = build_get_execution_logs_request( + _request = build_get_execution_logs_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, script_execution_name=script_execution_name, @@ -899,16 +835,15 @@ def get_execution_logs( content_type=content_type, json=_json, content=_content, - template_url=self.get_execution_logs.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -921,10 +856,6 @@ def get_execution_logs( deserialized = self._deserialize("ScriptExecution", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_execution_logs.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}/getExecutionLogs" - } + return deserialized # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_script_packages_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_script_packages_operations.py index 04a89fc138ab..1167d9dae788 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_script_packages_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_script_packages_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -51,7 +56,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -75,7 +80,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -84,7 +89,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -128,14 +133,13 @@ def __init__(self, *args, **kwargs): def list( self, resource_group_name: str, private_cloud_name: str, **kwargs: Any ) -> Iterable["_models.ScriptPackage"]: - """List script packages available to run on the private cloud. + """List ScriptPackage resources by PrivateCloud. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScriptPackage or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.ScriptPackage] :raises ~azure.core.exceptions.HttpResponseError: @@ -146,7 +150,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScriptPackagesList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -157,17 +161,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -179,13 +182,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("ScriptPackagesList", pipeline_response) @@ -195,11 +198,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -212,29 +215,24 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages" - } - @distributed_trace def get( self, resource_group_name: str, private_cloud_name: str, script_package_name: str, **kwargs: Any ) -> _models.ScriptPackage: - """Get a script package available to run on a private cloud. + """Get a ScriptPackage. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param script_package_name: Name of the script package in the private cloud. Required. + :param script_package_name: Name of the script package. Required. :type script_package_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScriptPackage or the result of cls(response) :rtype: ~azure.mgmt.avs.models.ScriptPackage :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -248,22 +246,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScriptPackage] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, script_package_name=script_package_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -276,10 +273,6 @@ def get( deserialized = self._deserialize("ScriptPackage", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}" - } + return deserialized # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_virtual_machines_operations.py index 8105422455ca..c84f3c63f324 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_virtual_machines_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +59,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -84,7 +89,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,13 +98,13 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"), - "virtualMachineId": _SERIALIZER.url("virtual_machine_id", virtual_machine_id, "str"), + "virtualMachineId": _SERIALIZER.url("virtual_machine_id", virtual_machine_id, "str", pattern=r"^[-\w\._]+$"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -124,7 +129,7 @@ def build_restrict_movement_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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") @@ -134,13 +139,13 @@ def build_restrict_movement_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId}/restrictMovement", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"), - "virtualMachineId": _SERIALIZER.url("virtual_machine_id", virtual_machine_id, "str"), + "virtualMachineId": _SERIALIZER.url("virtual_machine_id", virtual_machine_id, "str", pattern=r"^[-\w\._]+$"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -179,18 +184,15 @@ def __init__(self, *args, **kwargs): def list( self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any ) -> Iterable["_models.VirtualMachine"]: - """List of virtual machines in a private cloud cluster. - - List of virtual machines in a private cloud cluster. + """List VirtualMachine resources by Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: 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 VirtualMachine or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.VirtualMachine] :raises ~azure.core.exceptions.HttpResponseError: @@ -201,7 +203,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachinesList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -212,18 +214,17 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cluster_name=cluster_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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -235,13 +236,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("VirtualMachinesList", pipeline_response) @@ -251,11 +252,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -268,10 +269,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines" - } - @distributed_trace def get( self, @@ -281,25 +278,22 @@ def get( virtual_machine_id: str, **kwargs: Any ) -> _models.VirtualMachine: - """Get a virtual machine by id in a private cloud cluster. - - Get a virtual machine by id in a private cloud cluster. + """Get a VirtualMachine. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param virtual_machine_id: Virtual Machine identifier. Required. + :param virtual_machine_id: ID of the virtual machine. Required. :type virtual_machine_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine or the result of cls(response) :rtype: ~azure.mgmt.avs.models.VirtualMachine :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -313,23 +307,22 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cluster_name=cluster_name, virtual_machine_id=virtual_machine_id, 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -342,13 +335,9 @@ def get( deserialized = self._deserialize("VirtualMachine", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId}" - } + return deserialized # type: ignore def _restrict_movement_initial( # pylint: disable=inconsistent-return-statements self, @@ -356,10 +345,10 @@ def _restrict_movement_initial( # pylint: disable=inconsistent-return-statement private_cloud_name: str, cluster_name: str, virtual_machine_id: str, - restrict_movement: Union[_models.VirtualMachineRestrictMovement, IO], + restrict_movement: Union[_models.VirtualMachineRestrictMovement, IO[bytes]], **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -382,7 +371,7 @@ def _restrict_movement_initial( # pylint: disable=inconsistent-return-statement else: _json = self._serialize.body(restrict_movement, "VirtualMachineRestrictMovement") - request = build_restrict_movement_request( + _request = build_restrict_movement_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, cluster_name=cluster_name, @@ -392,16 +381,15 @@ def _restrict_movement_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, content=_content, - template_url=self._restrict_movement_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -411,12 +399,12 @@ def _restrict_movement_initial( # pylint: disable=inconsistent-return-statement 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, {}) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _restrict_movement_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId}/restrictMovement" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @overload def begin_restrict_movement( @@ -432,31 +420,20 @@ def begin_restrict_movement( ) -> LROPoller[None]: """Enable or disable DRS-driven VM movement restriction. - Enable or disable DRS-driven VM movement restriction. - :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param virtual_machine_id: Virtual Machine identifier. Required. + :param virtual_machine_id: ID of the virtual machine. Required. :type virtual_machine_id: str - :param restrict_movement: Whether VM DRS-driven movement is restricted (Enabled) or not - (Disabled). Required. + :param restrict_movement: The body type of the operation request. Required. :type restrict_movement: ~azure.mgmt.avs.models.VirtualMachineRestrictMovement :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -469,38 +446,27 @@ def begin_restrict_movement( private_cloud_name: str, cluster_name: str, virtual_machine_id: str, - restrict_movement: IO, + restrict_movement: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Enable or disable DRS-driven VM movement restriction. - Enable or disable DRS-driven VM movement restriction. - :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param virtual_machine_id: Virtual Machine identifier. Required. + :param virtual_machine_id: ID of the virtual machine. Required. :type virtual_machine_id: str - :param restrict_movement: Whether VM DRS-driven movement is restricted (Enabled) or not - (Disabled). Required. - :type restrict_movement: IO + :param restrict_movement: The body type of the operation request. Required. + :type restrict_movement: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -513,36 +479,23 @@ def begin_restrict_movement( private_cloud_name: str, cluster_name: str, virtual_machine_id: str, - restrict_movement: Union[_models.VirtualMachineRestrictMovement, IO], + restrict_movement: Union[_models.VirtualMachineRestrictMovement, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Enable or disable DRS-driven VM movement restriction. - Enable or disable DRS-driven VM movement restriction. - :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param cluster_name: Name of the cluster in the private cloud. Required. + :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param virtual_machine_id: Virtual Machine identifier. Required. + :param virtual_machine_id: ID of the virtual machine. Required. :type virtual_machine_id: str - :param restrict_movement: Whether VM DRS-driven movement is restricted (Enabled) or not - (Disabled). Is either a VirtualMachineRestrictMovement type or a IO type. Required. - :type restrict_movement: ~azure.mgmt.avs.models.VirtualMachineRestrictMovement 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. + :param restrict_movement: The body type of the operation request. Is either a + VirtualMachineRestrictMovement type or a IO[bytes] type. Required. + :type restrict_movement: ~azure.mgmt.avs.models.VirtualMachineRestrictMovement or IO[bytes] :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: @@ -574,23 +527,21 @@ def begin_restrict_movement( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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_restrict_movement.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId}/restrictMovement" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_workload_networks_operations.py b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_workload_networks_operations.py index b13c4a90b99b..ea3e4b69e479 100644 --- a/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_workload_networks_operations.py +++ b/sdk/compute/azure-mgmt-avs/azure/mgmt/avs/operations/_workload_networks_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,31 +44,26 @@ _SERIALIZER.client_side_validation = False -def build_get_request( - resource_group_name: str, - private_cloud_name: str, - workload_network_name: Union[str, _models.WorkloadNetworkName], - subscription_id: str, - **kwargs: Any +def build_list_request( + resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/{workloadNetworkName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), - "workloadNetworkName": _SERIALIZER.url("workload_network_name", workload_network_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -77,22 +77,22 @@ def build_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( +def build_get_request( resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds/{privateCloudName}/workloadNetworks", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -110,22 +110,22 @@ def build_list_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_segments_request( +def build_list_dhcp_request( resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -143,27 +143,27 @@ def build_list_segments_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_segment_request( - resource_group_name: str, private_cloud_name: str, segment_id: str, subscription_id: str, **kwargs: Any +def build_get_dhcp_request( + resource_group_name: str, dhcp_id: str, private_cloud_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), + "dhcpId": _SERIALIZER.url("dhcp_id", dhcp_id, "str", pattern=r"^[-\w\._]+$"), "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), - "segmentId": _SERIALIZER.url("segment_id", segment_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -177,28 +177,28 @@ def build_get_segment_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_segments_request( - resource_group_name: str, private_cloud_name: str, segment_id: str, subscription_id: str, **kwargs: Any +def build_create_dhcp_request( + resource_group_name: str, private_cloud_name: str, dhcp_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), - "segmentId": _SERIALIZER.url("segment_id", segment_id, "str"), + "dhcpId": _SERIALIZER.url("dhcp_id", dhcp_id, "str", pattern=r"^[-\w\._]+$"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -214,28 +214,28 @@ def build_create_segments_request( return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_segments_request( - resource_group_name: str, private_cloud_name: str, segment_id: str, subscription_id: str, **kwargs: Any +def build_update_dhcp_request( + resource_group_name: str, private_cloud_name: str, dhcp_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), - "segmentId": _SERIALIZER.url("segment_id", segment_id, "str"), + "dhcpId": _SERIALIZER.url("dhcp_id", dhcp_id, "str", pattern=r"^[-\w\._]+$"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -251,27 +251,27 @@ def build_update_segments_request( return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_segment_request( - resource_group_name: str, private_cloud_name: str, segment_id: str, subscription_id: str, **kwargs: Any +def build_delete_dhcp_request( + resource_group_name: str, private_cloud_name: str, dhcp_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), - "segmentId": _SERIALIZER.url("segment_id", segment_id, "str"), + "dhcpId": _SERIALIZER.url("dhcp_id", dhcp_id, "str", pattern=r"^[-\w\._]+$"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -285,22 +285,22 @@ def build_delete_segment_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_dhcp_request( +def build_list_dns_services_request( resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -318,27 +318,27 @@ def build_list_dhcp_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_dhcp_request( - resource_group_name: str, dhcp_id: str, private_cloud_name: str, subscription_id: str, **kwargs: Any +def build_get_dns_service_request( + resource_group_name: str, private_cloud_name: str, dns_service_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "dhcpId": _SERIALIZER.url("dhcp_id", dhcp_id, "str"), "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), + "dnsServiceId": _SERIALIZER.url("dns_service_id", dns_service_id, "str", pattern=r"^[-\w\._]+$"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -352,28 +352,28 @@ def build_get_dhcp_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_dhcp_request( - resource_group_name: str, private_cloud_name: str, dhcp_id: str, subscription_id: str, **kwargs: Any +def build_create_dns_service_request( + resource_group_name: str, private_cloud_name: str, dns_service_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), - "dhcpId": _SERIALIZER.url("dhcp_id", dhcp_id, "str"), + "dnsServiceId": _SERIALIZER.url("dns_service_id", dns_service_id, "str", pattern=r"^[-\w\._]+$"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -389,28 +389,28 @@ def build_create_dhcp_request( return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_dhcp_request( - resource_group_name: str, private_cloud_name: str, dhcp_id: str, subscription_id: str, **kwargs: Any +def build_update_dns_service_request( + resource_group_name: str, private_cloud_name: str, dns_service_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), - "dhcpId": _SERIALIZER.url("dhcp_id", dhcp_id, "str"), + "dnsServiceId": _SERIALIZER.url("dns_service_id", dns_service_id, "str", pattern=r"^[-\w\._]+$"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -426,27 +426,27 @@ def build_update_dhcp_request( return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_dhcp_request( - resource_group_name: str, private_cloud_name: str, dhcp_id: str, subscription_id: str, **kwargs: Any +def build_delete_dns_service_request( + resource_group_name: str, dns_service_id: str, private_cloud_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), + "dnsServiceId": _SERIALIZER.url("dns_service_id", dns_service_id, "str", pattern=r"^[-\w\._]+$"), "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), - "dhcpId": _SERIALIZER.url("dhcp_id", dhcp_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -460,22 +460,22 @@ def build_delete_dhcp_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_gateways_request( +def build_list_dns_zones_request( resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -493,27 +493,27 @@ def build_list_gateways_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_gateway_request( - resource_group_name: str, private_cloud_name: str, gateway_id: str, subscription_id: str, **kwargs: Any +def build_get_dns_zone_request( + resource_group_name: str, private_cloud_name: str, dns_zone_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways/{gatewayId}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), - "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str"), + "dnsZoneId": _SERIALIZER.url("dns_zone_id", dns_zone_id, "str", pattern=r"^[-\w\._]+$"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -527,26 +527,28 @@ def build_get_gateway_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_port_mirroring_request( - resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any +def build_create_dns_zone_request( + resource_group_name: str, private_cloud_name: str, dns_zone_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), + "dnsZoneId": _SERIALIZER.url("dns_zone_id", dns_zone_id, "str", pattern=r"^[-\w\._]+$"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -555,32 +557,35 @@ def build_list_port_mirroring_request( _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_get_port_mirroring_request( - resource_group_name: str, private_cloud_name: str, port_mirroring_id: str, subscription_id: str, **kwargs: Any +def build_update_dns_zone_request( + resource_group_name: str, private_cloud_name: str, dns_zone_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), - "portMirroringId": _SERIALIZER.url("port_mirroring_id", port_mirroring_id, "str"), + "dnsZoneId": _SERIALIZER.url("dns_zone_id", dns_zone_id, "str", pattern=r"^[-\w\._]+$"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -589,33 +594,34 @@ def build_get_port_mirroring_request( _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_create_port_mirroring_request( - resource_group_name: str, private_cloud_name: str, port_mirroring_id: str, subscription_id: str, **kwargs: Any +def build_delete_dns_zone_request( + resource_group_name: str, dns_zone_id: str, private_cloud_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) - 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), + "dnsZoneId": _SERIALIZER.url("dns_zone_id", dns_zone_id, "str", pattern=r"^[-\w\._]+$"), "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), - "portMirroringId": _SERIALIZER.url("port_mirroring_id", port_mirroring_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -624,35 +630,31 @@ def build_create_port_mirroring_request( _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_port_mirroring_request( - resource_group_name: str, private_cloud_name: str, port_mirroring_id: str, subscription_id: str, **kwargs: Any +def build_list_gateways_request( + resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) - 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), - "portMirroringId": _SERIALIZER.url("port_mirroring_id", port_mirroring_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -661,34 +663,32 @@ def build_update_port_mirroring_request( _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) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_port_mirroring_request( - resource_group_name: str, port_mirroring_id: str, private_cloud_name: str, subscription_id: str, **kwargs: Any +def build_get_gateway_request( + resource_group_name: str, private_cloud_name: str, gateway_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways/{gatewayId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "portMirroringId": _SERIALIZER.url("port_mirroring_id", port_mirroring_id, "str"), "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), + "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", pattern=r"^[-\w\._]+$"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -699,25 +699,25 @@ def build_delete_port_mirroring_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) -def build_list_vm_groups_request( +def build_list_port_mirroring_request( resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -735,27 +735,27 @@ def build_list_vm_groups_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_vm_group_request( - resource_group_name: str, private_cloud_name: str, vm_group_id: str, subscription_id: str, **kwargs: Any +def build_get_port_mirroring_request( + resource_group_name: str, private_cloud_name: str, port_mirroring_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), - "vmGroupId": _SERIALIZER.url("vm_group_id", vm_group_id, "str"), + "portMirroringId": _SERIALIZER.url("port_mirroring_id", port_mirroring_id, "str", pattern=r"^[-\w\._]+$"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -769,28 +769,28 @@ def build_get_vm_group_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_vm_group_request( - resource_group_name: str, private_cloud_name: str, vm_group_id: str, subscription_id: str, **kwargs: Any +def build_create_port_mirroring_request( + resource_group_name: str, private_cloud_name: str, port_mirroring_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), - "vmGroupId": _SERIALIZER.url("vm_group_id", vm_group_id, "str"), + "portMirroringId": _SERIALIZER.url("port_mirroring_id", port_mirroring_id, "str", pattern=r"^[-\w\._]+$"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -806,28 +806,28 @@ def build_create_vm_group_request( return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_vm_group_request( - resource_group_name: str, private_cloud_name: str, vm_group_id: str, subscription_id: str, **kwargs: Any +def build_update_port_mirroring_request( + resource_group_name: str, private_cloud_name: str, port_mirroring_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), - "vmGroupId": _SERIALIZER.url("vm_group_id", vm_group_id, "str"), + "portMirroringId": _SERIALIZER.url("port_mirroring_id", port_mirroring_id, "str", pattern=r"^[-\w\._]+$"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -843,26 +843,26 @@ def build_update_vm_group_request( return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_vm_group_request( - resource_group_name: str, vm_group_id: str, private_cloud_name: str, subscription_id: str, **kwargs: Any +def build_delete_port_mirroring_request( + resource_group_name: str, port_mirroring_id: str, private_cloud_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "vmGroupId": _SERIALIZER.url("vm_group_id", vm_group_id, "str"), + "portMirroringId": _SERIALIZER.url("port_mirroring_id", port_mirroring_id, "str", pattern=r"^[-\w\._]+$"), "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), } @@ -877,22 +877,22 @@ def build_delete_vm_group_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_virtual_machines_request( +def build_list_public_i_ps_request( resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -910,27 +910,27 @@ def build_list_virtual_machines_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_virtual_machine_request( - resource_group_name: str, private_cloud_name: str, virtual_machine_id: str, subscription_id: str, **kwargs: Any +def build_get_public_ip_request( + resource_group_name: str, private_cloud_name: str, public_ip_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines/{virtualMachineId}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), - "virtualMachineId": _SERIALIZER.url("virtual_machine_id", virtual_machine_id, "str"), + "publicIPId": _SERIALIZER.url("public_ip_id", public_ip_id, "str", pattern=r"^[-\w\._]+$"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -944,26 +944,28 @@ def build_get_virtual_machine_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_dns_services_request( - resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any +def build_create_public_ip_request( + resource_group_name: str, private_cloud_name: str, public_ip_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), + "publicIPId": _SERIALIZER.url("public_ip_id", public_ip_id, "str", pattern=r"^[-\w\._]+$"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -972,32 +974,34 @@ def build_list_dns_services_request( _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_get_dns_service_request( - resource_group_name: str, private_cloud_name: str, dns_service_id: str, subscription_id: str, **kwargs: Any +def build_delete_public_ip_request( + resource_group_name: str, public_ip_id: str, private_cloud_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), + "publicIPId": _SERIALIZER.url("public_ip_id", public_ip_id, "str", pattern=r"^[-\w\._]+$"), "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), - "dnsServiceId": _SERIALIZER.url("dns_service_id", dns_service_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1008,31 +1012,29 @@ def build_get_dns_service_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_dns_service_request( - resource_group_name: str, private_cloud_name: str, dns_service_id: str, subscription_id: str, **kwargs: Any +def build_list_segments_request( + resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) - 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), - "dnsServiceId": _SERIALIZER.url("dns_service_id", dns_service_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1041,35 +1043,32 @@ def build_create_dns_service_request( _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_dns_service_request( - resource_group_name: str, private_cloud_name: str, dns_service_id: str, subscription_id: str, **kwargs: Any +def build_get_segment_request( + resource_group_name: str, private_cloud_name: str, segment_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) - 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), - "dnsServiceId": _SERIALIZER.url("dns_service_id", dns_service_id, "str"), + "segmentId": _SERIALIZER.url("segment_id", segment_id, "str", pattern=r"^[-\w\._]+$"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1078,34 +1077,33 @@ def build_update_dns_service_request( _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) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_dns_service_request( - resource_group_name: str, dns_service_id: str, private_cloud_name: str, subscription_id: str, **kwargs: Any +def build_create_segments_request( + resource_group_name: str, private_cloud_name: str, segment_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "dnsServiceId": _SERIALIZER.url("dns_service_id", dns_service_id, "str"), "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), + "segmentId": _SERIALIZER.url("segment_id", segment_id, "str", pattern=r"^[-\w\._]+$"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1114,31 +1112,35 @@ def build_delete_dns_service_request( _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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_dns_zones_request( - resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any +def build_update_segments_request( + resource_group_name: str, private_cloud_name: str, segment_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), + "segmentId": _SERIALIZER.url("segment_id", segment_id, "str", pattern=r"^[-\w\._]+$"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1147,32 +1149,34 @@ def build_list_dns_zones_request( _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_get_dns_zone_request( - resource_group_name: str, private_cloud_name: str, dns_zone_id: str, subscription_id: str, **kwargs: Any +def build_delete_segment_request( + resource_group_name: str, private_cloud_name: str, segment_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), - "dnsZoneId": _SERIALIZER.url("dns_zone_id", dns_zone_id, "str"), + "segmentId": _SERIALIZER.url("segment_id", segment_id, "str", pattern=r"^[-\w\._]+$"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1183,31 +1187,29 @@ def build_get_dns_zone_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_dns_zone_request( - resource_group_name: str, private_cloud_name: str, dns_zone_id: str, subscription_id: str, **kwargs: Any +def build_list_virtual_machines_request( + resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) - 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), - "dnsZoneId": _SERIALIZER.url("dns_zone_id", dns_zone_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1216,35 +1218,32 @@ def build_create_dns_zone_request( _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_dns_zone_request( - resource_group_name: str, private_cloud_name: str, dns_zone_id: str, subscription_id: str, **kwargs: Any +def build_get_virtual_machine_request( + resource_group_name: str, private_cloud_name: str, virtual_machine_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) - 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines/{virtualMachineId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), - "dnsZoneId": _SERIALIZER.url("dns_zone_id", dns_zone_id, "str"), + "virtualMachineId": _SERIALIZER.url("virtual_machine_id", virtual_machine_id, "str", pattern=r"^[-\w\._]+$"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1253,33 +1252,30 @@ def build_update_dns_zone_request( _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) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_dns_zone_request( - resource_group_name: str, dns_zone_id: str, private_cloud_name: str, subscription_id: str, **kwargs: Any +def build_list_vm_groups_request( + resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "dnsZoneId": _SERIALIZER.url("dns_zone_id", dns_zone_id, "str"), "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), } @@ -1291,29 +1287,30 @@ def build_delete_dns_zone_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) -def build_list_public_i_ps_request( - resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any +def build_get_vm_group_request( + resource_group_name: str, private_cloud_name: str, vm_group_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), + "vmGroupId": _SERIALIZER.url("vm_group_id", vm_group_id, "str", pattern=r"^[-\w\._]+$"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1327,27 +1324,28 @@ def build_list_public_i_ps_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_public_ip_request( - resource_group_name: str, private_cloud_name: str, public_ip_id: str, subscription_id: str, **kwargs: Any +def build_create_vm_group_request( + resource_group_name: str, private_cloud_name: str, vm_group_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), - "publicIPId": _SERIALIZER.url("public_ip_id", public_ip_id, "str"), + "vmGroupId": _SERIALIZER.url("vm_group_id", vm_group_id, "str", pattern=r"^[-\w\._]+$"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1356,33 +1354,35 @@ def build_get_public_ip_request( _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_public_ip_request( - resource_group_name: str, private_cloud_name: str, public_ip_id: str, subscription_id: str, **kwargs: Any +def build_update_vm_group_request( + resource_group_name: str, private_cloud_name: str, vm_group_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), - "publicIPId": _SERIALIZER.url("public_ip_id", public_ip_id, "str"), + "vmGroupId": _SERIALIZER.url("vm_group_id", vm_group_id, "str", pattern=r"^[-\w\._]+$"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1395,29 +1395,29 @@ def build_create_public_ip_request( _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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_public_ip_request( - resource_group_name: str, public_ip_id: str, private_cloud_name: str, subscription_id: str, **kwargs: Any +def build_delete_vm_group_request( + resource_group_name: str, vm_group_id: str, private_cloud_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "publicIPId": _SERIALIZER.url("public_ip_id", public_ip_id, "str"), + "vmGroupId": _SERIALIZER.url("vm_group_id", vm_group_id, "str", pattern=r"^[-\w\._]+$"), "privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"), } @@ -1451,95 +1451,17 @@ 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, - private_cloud_name: str, - workload_network_name: Union[str, _models.WorkloadNetworkName], - **kwargs: Any - ) -> _models.WorkloadNetwork: - """Get a private cloud workload network. - - Get a private cloud workload network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param private_cloud_name: Name of the private cloud. Required. - :type private_cloud_name: str - :param workload_network_name: Name for the workload network in the private cloud. "default" - Required. - :type workload_network_name: str or ~azure.mgmt.avs.models.WorkloadNetworkName - :keyword callable cls: A custom type or function that will be passed the direct response - :return: WorkloadNetwork or the result of cls(response) - :rtype: ~azure.mgmt.avs.models.WorkloadNetwork - :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.WorkloadNetwork] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - private_cloud_name=private_cloud_name, - workload_network_name=workload_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 = 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("WorkloadNetwork", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/{workloadNetworkName}" - } - @distributed_trace def list( self, resource_group_name: str, private_cloud_name: str, **kwargs: Any ) -> Iterable["_models.WorkloadNetwork"]: - """List of workload networks in a private cloud. - - List of workload networks in a private cloud. + """List WorkloadNetwork resources by PrivateCloud. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WorkloadNetwork or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetwork] :raises ~azure.core.exceptions.HttpResponseError: @@ -1550,7 +1472,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WorkloadNetworkList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1561,17 +1483,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1583,13 +1504,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("WorkloadNetworkList", pipeline_response) @@ -1599,11 +1520,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1616,36 +1537,85 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks" - } + @distributed_trace + def get(self, resource_group_name: str, private_cloud_name: str, **kwargs: Any) -> _models.WorkloadNetwork: + """Get a WorkloadNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. Required. + :type private_cloud_name: str + :return: WorkloadNetwork or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetwork + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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.WorkloadNetwork] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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("WorkloadNetwork", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace - def list_segments( + def list_dhcp( self, resource_group_name: str, private_cloud_name: str, **kwargs: Any - ) -> Iterable["_models.WorkloadNetworkSegment"]: - """List of segments in a private cloud workload network. - - List of segments in a private cloud workload network. + ) -> Iterable["_models.WorkloadNetworkDhcp"]: + """List WorkloadNetworkDhcp resources by WorkloadNetwork. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadNetworkSegment or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkSegment] + :return: An iterator like instance of either WorkloadNetworkDhcp or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDhcp] :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.WorkloadNetworkSegmentsList] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkDhcpList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1656,17 +1626,16 @@ def list_segments( def prepare_request(next_link=None): if not next_link: - request = build_list_segments_request( + _request = build_list_dhcp_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_segments.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1678,27 +1647,27 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("WorkloadNetworkSegmentsList", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDhcpList", 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) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1711,32 +1680,24 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_segments.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments" - } - @distributed_trace - def get_segment( - self, resource_group_name: str, private_cloud_name: str, segment_id: str, **kwargs: Any - ) -> _models.WorkloadNetworkSegment: - """Get a segment by id in a private cloud workload network. - - Get a segment by id in a private cloud workload network. + def get_dhcp( + self, resource_group_name: str, dhcp_id: str, private_cloud_name: str, **kwargs: Any + ) -> _models.WorkloadNetworkDhcp: + """Get a WorkloadNetworkDhcp. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str + :param dhcp_id: The ID of the DHCP configuration. Required. + :type dhcp_id: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param segment_id: NSX Segment identifier. Generally the same as the Segment's display name. - Required. - :type segment_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: WorkloadNetworkSegment or the result of cls(response) - :rtype: ~azure.mgmt.avs.models.WorkloadNetworkSegment + :return: WorkloadNetworkDhcp or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetworkDhcp :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1748,24 +1709,23 @@ def get_segment( _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.WorkloadNetworkSegment] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkDhcp] = kwargs.pop("cls", None) - request = build_get_segment_request( + _request = build_get_dhcp_request( resource_group_name=resource_group_name, + dhcp_id=dhcp_id, private_cloud_name=private_cloud_name, - segment_id=segment_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_segment.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1775,26 +1735,22 @@ def get_segment( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_segment.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}" - } + return deserialized # type: ignore - def _create_segments_initial( + def _create_dhcp_initial( self, resource_group_name: str, private_cloud_name: str, - segment_id: str, - workload_network_segment: Union[_models.WorkloadNetworkSegment, IO], + dhcp_id: str, + workload_network_dhcp: Union[_models.WorkloadNetworkDhcp, IO[bytes]], **kwargs: Any - ) -> _models.WorkloadNetworkSegment: - error_map = { + ) -> _models.WorkloadNetworkDhcp: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1807,35 +1763,34 @@ def _create_segments_initial( 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.WorkloadNetworkSegment] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkDhcp] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(workload_network_segment, (IOBase, bytes)): - _content = workload_network_segment + if isinstance(workload_network_dhcp, (IOBase, bytes)): + _content = workload_network_dhcp else: - _json = self._serialize.body(workload_network_segment, "WorkloadNetworkSegment") + _json = self._serialize.body(workload_network_dhcp, "WorkloadNetworkDhcp") - request = build_create_segments_request( + _request = build_create_dhcp_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - segment_id=segment_id, + dhcp_id=dhcp_id, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_segments_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1845,143 +1800,106 @@ def _create_segments_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_segments_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}" - } - @overload - def begin_create_segments( + def begin_create_dhcp( self, resource_group_name: str, private_cloud_name: str, - segment_id: str, - workload_network_segment: _models.WorkloadNetworkSegment, + dhcp_id: str, + workload_network_dhcp: _models.WorkloadNetworkDhcp, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkSegment]: - """Create a segment by id in a private cloud workload network. - - Create a segment by id in a private cloud workload network. + ) -> LROPoller[_models.WorkloadNetworkDhcp]: + """Create a WorkloadNetworkDhcp. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param segment_id: NSX Segment identifier. Generally the same as the Segment's display name. - Required. - :type segment_id: str - :param workload_network_segment: NSX Segment. Required. - :type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment + :param dhcp_id: The ID of the DHCP configuration. Required. + :type dhcp_id: str + :param workload_network_dhcp: Resource create parameters. Required. + :type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp :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 WorkloadNetworkSegment or the result of + :return: An instance of LROPoller that returns either WorkloadNetworkDhcp or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_segments( + def begin_create_dhcp( self, resource_group_name: str, private_cloud_name: str, - segment_id: str, - workload_network_segment: IO, + dhcp_id: str, + workload_network_dhcp: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkSegment]: - """Create a segment by id in a private cloud workload network. - - Create a segment by id in a private cloud workload network. + ) -> LROPoller[_models.WorkloadNetworkDhcp]: + """Create a WorkloadNetworkDhcp. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param segment_id: NSX Segment identifier. Generally the same as the Segment's display name. - Required. - :type segment_id: str - :param workload_network_segment: NSX Segment. Required. - :type workload_network_segment: IO + :param dhcp_id: The ID of the DHCP configuration. Required. + :type dhcp_id: str + :param workload_network_dhcp: Resource create parameters. Required. + :type workload_network_dhcp: IO[bytes] :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 WorkloadNetworkSegment or the result of + :return: An instance of LROPoller that returns either WorkloadNetworkDhcp or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_segments( + def begin_create_dhcp( self, resource_group_name: str, private_cloud_name: str, - segment_id: str, - workload_network_segment: Union[_models.WorkloadNetworkSegment, IO], + dhcp_id: str, + workload_network_dhcp: Union[_models.WorkloadNetworkDhcp, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkSegment]: - """Create a segment by id in a private cloud workload network. - - Create a segment by id in a private cloud workload network. + ) -> LROPoller[_models.WorkloadNetworkDhcp]: + """Create a WorkloadNetworkDhcp. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param segment_id: NSX Segment identifier. Generally the same as the Segment's display name. - Required. - :type segment_id: str - :param workload_network_segment: NSX Segment. Is either a WorkloadNetworkSegment type or a IO - type. Required. - :type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment 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 WorkloadNetworkSegment or the result of + :param dhcp_id: The ID of the DHCP configuration. Required. + :type dhcp_id: str + :param workload_network_dhcp: Resource create parameters. Is either a WorkloadNetworkDhcp type + or a IO[bytes] type. Required. + :type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp or IO[bytes] + :return: An instance of LROPoller that returns either WorkloadNetworkDhcp or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -1989,16 +1907,16 @@ def begin_create_segments( 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.WorkloadNetworkSegment] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkDhcp] = 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_segments_initial( + raw_result = self._create_dhcp_initial( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - segment_id=segment_id, - workload_network_segment=workload_network_segment, + dhcp_id=dhcp_id, + workload_network_dhcp=workload_network_dhcp, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -2009,39 +1927,39 @@ def begin_create_segments( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.WorkloadNetworkDhcp].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_segments.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}" - } + return LROPoller[_models.WorkloadNetworkDhcp]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _update_segments_initial( + def _update_dhcp_initial( self, resource_group_name: str, private_cloud_name: str, - segment_id: str, - workload_network_segment: Union[_models.WorkloadNetworkSegment, IO], + dhcp_id: str, + workload_network_dhcp: Union[_models.WorkloadNetworkDhcp, IO[bytes]], **kwargs: Any - ) -> Optional[_models.WorkloadNetworkSegment]: - error_map = { + ) -> Optional[_models.WorkloadNetworkDhcp]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2054,35 +1972,34 @@ def _update_segments_initial( 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.WorkloadNetworkSegment]] = kwargs.pop("cls", None) + cls: ClsType[Optional[_models.WorkloadNetworkDhcp]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(workload_network_segment, (IOBase, bytes)): - _content = workload_network_segment + if isinstance(workload_network_dhcp, (IOBase, bytes)): + _content = workload_network_dhcp else: - _json = self._serialize.body(workload_network_segment, "WorkloadNetworkSegment") + _json = self._serialize.body(workload_network_dhcp, "WorkloadNetworkDhcp") - request = build_update_segments_request( + _request = build_update_dhcp_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - segment_id=segment_id, + dhcp_id=dhcp_id, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._update_segments_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2093,140 +2010,105 @@ def _update_segments_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - return deserialized + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _update_segments_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}" - } + return deserialized # type: ignore @overload - def begin_update_segments( + def begin_update_dhcp( self, resource_group_name: str, private_cloud_name: str, - segment_id: str, - workload_network_segment: _models.WorkloadNetworkSegment, + dhcp_id: str, + workload_network_dhcp: _models.WorkloadNetworkDhcp, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkSegment]: - """Create or update a segment by id in a private cloud workload network. - - Create or update a segment by id in a private cloud workload network. + ) -> LROPoller[_models.WorkloadNetworkDhcp]: + """Update a WorkloadNetworkDhcp. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param segment_id: NSX Segment identifier. Generally the same as the Segment's display name. - Required. - :type segment_id: str - :param workload_network_segment: NSX Segment. Required. - :type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment + :param dhcp_id: The ID of the DHCP configuration. Required. + :type dhcp_id: str + :param workload_network_dhcp: The resource properties to be updated. Required. + :type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp :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 WorkloadNetworkSegment or the result of + :return: An instance of LROPoller that returns either WorkloadNetworkDhcp or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update_segments( + def begin_update_dhcp( self, resource_group_name: str, private_cloud_name: str, - segment_id: str, - workload_network_segment: IO, + dhcp_id: str, + workload_network_dhcp: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkSegment]: - """Create or update a segment by id in a private cloud workload network. - - Create or update a segment by id in a private cloud workload network. + ) -> LROPoller[_models.WorkloadNetworkDhcp]: + """Update a WorkloadNetworkDhcp. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param segment_id: NSX Segment identifier. Generally the same as the Segment's display name. - Required. - :type segment_id: str - :param workload_network_segment: NSX Segment. Required. - :type workload_network_segment: IO + :param dhcp_id: The ID of the DHCP configuration. Required. + :type dhcp_id: str + :param workload_network_dhcp: The resource properties to be updated. Required. + :type workload_network_dhcp: IO[bytes] :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 WorkloadNetworkSegment or the result of + :return: An instance of LROPoller that returns either WorkloadNetworkDhcp or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_update_segments( + def begin_update_dhcp( self, resource_group_name: str, private_cloud_name: str, - segment_id: str, - workload_network_segment: Union[_models.WorkloadNetworkSegment, IO], + dhcp_id: str, + workload_network_dhcp: Union[_models.WorkloadNetworkDhcp, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkSegment]: - """Create or update a segment by id in a private cloud workload network. - - Create or update a segment by id in a private cloud workload network. + ) -> LROPoller[_models.WorkloadNetworkDhcp]: + """Update a WorkloadNetworkDhcp. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param segment_id: NSX Segment identifier. Generally the same as the Segment's display name. - Required. - :type segment_id: str - :param workload_network_segment: NSX Segment. Is either a WorkloadNetworkSegment type or a IO - type. Required. - :type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment 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 WorkloadNetworkSegment or the result of + :param dhcp_id: The ID of the DHCP configuration. Required. + :type dhcp_id: str + :param workload_network_dhcp: The resource properties to be updated. Is either a + WorkloadNetworkDhcp type or a IO[bytes] type. Required. + :type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp or IO[bytes] + :return: An instance of LROPoller that returns either WorkloadNetworkDhcp or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -2234,16 +2116,16 @@ def begin_update_segments( 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.WorkloadNetworkSegment] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkDhcp] = 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_segments_initial( + raw_result = self._update_dhcp_initial( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - segment_id=segment_id, - workload_network_segment=workload_network_segment, + dhcp_id=dhcp_id, + workload_network_dhcp=workload_network_dhcp, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -2254,34 +2136,34 @@ def begin_update_segments( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.WorkloadNetworkDhcp].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_segments.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}" - } + return LROPoller[_models.WorkloadNetworkDhcp]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_segment_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, private_cloud_name: str, segment_id: str, **kwargs: Any + def _delete_dhcp_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, private_cloud_name: str, dhcp_id: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2295,22 +2177,21 @@ def _delete_segment_initial( # pylint: disable=inconsistent-return-statements 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_segment_request( + _request = build_delete_dhcp_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - segment_id=segment_id, + dhcp_id=dhcp_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_segment_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2320,37 +2201,27 @@ def _delete_segment_initial( # pylint: disable=inconsistent-return-statements 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, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _delete_segment_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace - def begin_delete_segment( - self, resource_group_name: str, private_cloud_name: str, segment_id: str, **kwargs: Any + def begin_delete_dhcp( + self, resource_group_name: str, private_cloud_name: str, dhcp_id: str, **kwargs: Any ) -> LROPoller[None]: - """Delete a segment by id in a private cloud workload network. - - Delete a segment by id in a private cloud workload network. + """Delete a WorkloadNetworkDhcp. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param segment_id: NSX Segment identifier. Generally the same as the Segment's display name. - Required. - :type segment_id: 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. + :param dhcp_id: The ID of the DHCP configuration. Required. + :type dhcp_id: str :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: @@ -2364,10 +2235,10 @@ def begin_delete_segment( 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_segment_initial( # type: ignore + raw_result = self._delete_dhcp_initial( # type: ignore resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - segment_id=segment_id, + dhcp_id=dhcp_id, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -2378,52 +2249,48 @@ def begin_delete_segment( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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_segment.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_dhcp( + def list_dns_services( self, resource_group_name: str, private_cloud_name: str, **kwargs: Any - ) -> Iterable["_models.WorkloadNetworkDhcp"]: - """List dhcp in a private cloud workload network. - - List dhcp in a private cloud workload network. + ) -> Iterable["_models.WorkloadNetworkDnsService"]: + """List WorkloadNetworkDnsService resources by WorkloadNetwork. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadNetworkDhcp or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDhcp] + :return: An iterator like instance of either WorkloadNetworkDnsService or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDnsService] :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.WorkloadNetworkDhcpList] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkDnsServicesList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2434,17 +2301,16 @@ def list_dhcp( def prepare_request(next_link=None): if not next_link: - request = build_list_dhcp_request( + _request = build_list_dns_services_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_dhcp.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -2456,27 +2322,27 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("WorkloadNetworkDhcpList", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDnsServicesList", 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) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2489,31 +2355,24 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_dhcp.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations" - } - @distributed_trace - def get_dhcp( - self, resource_group_name: str, dhcp_id: str, private_cloud_name: str, **kwargs: Any - ) -> _models.WorkloadNetworkDhcp: - """Get dhcp by id in a private cloud workload network. - - Get dhcp by id in a private cloud workload network. + def get_dns_service( + self, resource_group_name: str, private_cloud_name: str, dns_service_id: str, **kwargs: Any + ) -> _models.WorkloadNetworkDnsService: + """Get a WorkloadNetworkDnsService. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required. - :type dhcp_id: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: WorkloadNetworkDhcp or the result of cls(response) - :rtype: ~azure.mgmt.avs.models.WorkloadNetworkDhcp + :param dns_service_id: ID of the DNS service. Required. + :type dns_service_id: str + :return: WorkloadNetworkDnsService or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetworkDnsService :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2525,24 +2384,23 @@ def get_dhcp( _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.WorkloadNetworkDhcp] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkDnsService] = kwargs.pop("cls", None) - request = build_get_dhcp_request( + _request = build_get_dns_service_request( resource_group_name=resource_group_name, - dhcp_id=dhcp_id, private_cloud_name=private_cloud_name, + dns_service_id=dns_service_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_dhcp.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2552,26 +2410,22 @@ def get_dhcp( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_dhcp.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}" - } + return deserialized # type: ignore - def _create_dhcp_initial( + def _create_dns_service_initial( self, resource_group_name: str, private_cloud_name: str, - dhcp_id: str, - workload_network_dhcp: Union[_models.WorkloadNetworkDhcp, IO], + dns_service_id: str, + workload_network_dns_service: Union[_models.WorkloadNetworkDnsService, IO[bytes]], **kwargs: Any - ) -> _models.WorkloadNetworkDhcp: - error_map = { + ) -> _models.WorkloadNetworkDnsService: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2584,35 +2438,34 @@ def _create_dhcp_initial( 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.WorkloadNetworkDhcp] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkDnsService] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(workload_network_dhcp, (IOBase, bytes)): - _content = workload_network_dhcp + if isinstance(workload_network_dns_service, (IOBase, bytes)): + _content = workload_network_dns_service else: - _json = self._serialize.body(workload_network_dhcp, "WorkloadNetworkDhcp") + _json = self._serialize.body(workload_network_dns_service, "WorkloadNetworkDnsService") - request = build_create_dhcp_request( + _request = build_create_dns_service_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - dhcp_id=dhcp_id, + dns_service_id=dns_service_id, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_dhcp_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2622,140 +2475,107 @@ def _create_dhcp_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_dhcp_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}" - } - @overload - def begin_create_dhcp( + def begin_create_dns_service( self, resource_group_name: str, private_cloud_name: str, - dhcp_id: str, - workload_network_dhcp: _models.WorkloadNetworkDhcp, + dns_service_id: str, + workload_network_dns_service: _models.WorkloadNetworkDnsService, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkDhcp]: - """Create dhcp by id in a private cloud workload network. - - Create dhcp by id in a private cloud workload network. + ) -> LROPoller[_models.WorkloadNetworkDnsService]: + """Create a WorkloadNetworkDnsService. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required. - :type dhcp_id: str - :param workload_network_dhcp: NSX DHCP. Required. - :type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp + :param dns_service_id: ID of the DNS service. Required. + :type dns_service_id: str + :param workload_network_dns_service: Resource create parameters. Required. + :type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService :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 WorkloadNetworkDhcp or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp] + :return: An instance of LROPoller that returns either WorkloadNetworkDnsService or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_dhcp( + def begin_create_dns_service( self, resource_group_name: str, private_cloud_name: str, - dhcp_id: str, - workload_network_dhcp: IO, + dns_service_id: str, + workload_network_dns_service: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkDhcp]: - """Create dhcp by id in a private cloud workload network. - - Create dhcp by id in a private cloud workload network. + ) -> LROPoller[_models.WorkloadNetworkDnsService]: + """Create a WorkloadNetworkDnsService. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required. - :type dhcp_id: str - :param workload_network_dhcp: NSX DHCP. Required. - :type workload_network_dhcp: IO + :param dns_service_id: ID of the DNS service. Required. + :type dns_service_id: str + :param workload_network_dns_service: Resource create parameters. Required. + :type workload_network_dns_service: IO[bytes] :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 WorkloadNetworkDhcp or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp] + :return: An instance of LROPoller that returns either WorkloadNetworkDnsService or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_dhcp( + def begin_create_dns_service( self, resource_group_name: str, private_cloud_name: str, - dhcp_id: str, - workload_network_dhcp: Union[_models.WorkloadNetworkDhcp, IO], + dns_service_id: str, + workload_network_dns_service: Union[_models.WorkloadNetworkDnsService, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkDhcp]: - """Create dhcp by id in a private cloud workload network. - - Create dhcp by id in a private cloud workload network. + ) -> LROPoller[_models.WorkloadNetworkDnsService]: + """Create a WorkloadNetworkDnsService. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required. - :type dhcp_id: str - :param workload_network_dhcp: NSX DHCP. Is either a WorkloadNetworkDhcp type or a IO type. - Required. - :type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp 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 WorkloadNetworkDhcp or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp] + :param dns_service_id: ID of the DNS service. Required. + :type dns_service_id: str + :param workload_network_dns_service: Resource create parameters. Is either a + WorkloadNetworkDnsService type or a IO[bytes] type. Required. + :type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService or + IO[bytes] + :return: An instance of LROPoller that returns either WorkloadNetworkDnsService or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -2763,16 +2583,16 @@ def begin_create_dhcp( 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.WorkloadNetworkDhcp] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkDnsService] = 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_dhcp_initial( + raw_result = self._create_dns_service_initial( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - dhcp_id=dhcp_id, - workload_network_dhcp=workload_network_dhcp, + dns_service_id=dns_service_id, + workload_network_dns_service=workload_network_dns_service, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -2783,39 +2603,39 @@ def begin_create_dhcp( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.WorkloadNetworkDnsService].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_dhcp.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}" - } + return LROPoller[_models.WorkloadNetworkDnsService]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _update_dhcp_initial( + def _update_dns_service_initial( self, resource_group_name: str, private_cloud_name: str, - dhcp_id: str, - workload_network_dhcp: Union[_models.WorkloadNetworkDhcp, IO], + dns_service_id: str, + workload_network_dns_service: Union[_models.WorkloadNetworkDnsService, IO[bytes]], **kwargs: Any - ) -> Optional[_models.WorkloadNetworkDhcp]: - error_map = { + ) -> Optional[_models.WorkloadNetworkDnsService]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2828,35 +2648,34 @@ def _update_dhcp_initial( 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.WorkloadNetworkDhcp]] = kwargs.pop("cls", None) + cls: ClsType[Optional[_models.WorkloadNetworkDnsService]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(workload_network_dhcp, (IOBase, bytes)): - _content = workload_network_dhcp + if isinstance(workload_network_dns_service, (IOBase, bytes)): + _content = workload_network_dns_service else: - _json = self._serialize.body(workload_network_dhcp, "WorkloadNetworkDhcp") + _json = self._serialize.body(workload_network_dns_service, "WorkloadNetworkDnsService") - request = build_update_dhcp_request( + _request = build_update_dns_service_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - dhcp_id=dhcp_id, + dns_service_id=dns_service_id, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._update_dhcp_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2867,137 +2686,106 @@ def _update_dhcp_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - return deserialized + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _update_dhcp_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}" - } + return deserialized # type: ignore @overload - def begin_update_dhcp( + def begin_update_dns_service( self, resource_group_name: str, private_cloud_name: str, - dhcp_id: str, - workload_network_dhcp: _models.WorkloadNetworkDhcp, + dns_service_id: str, + workload_network_dns_service: _models.WorkloadNetworkDnsService, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkDhcp]: - """Create or update dhcp by id in a private cloud workload network. - - Create or update dhcp by id in a private cloud workload network. + ) -> LROPoller[_models.WorkloadNetworkDnsService]: + """Update a WorkloadNetworkDnsService. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required. - :type dhcp_id: str - :param workload_network_dhcp: NSX DHCP. Required. - :type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp + :param dns_service_id: ID of the DNS service. Required. + :type dns_service_id: str + :param workload_network_dns_service: The resource properties to be updated. Required. + :type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService :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 WorkloadNetworkDhcp or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp] + :return: An instance of LROPoller that returns either WorkloadNetworkDnsService or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update_dhcp( + def begin_update_dns_service( self, resource_group_name: str, private_cloud_name: str, - dhcp_id: str, - workload_network_dhcp: IO, + dns_service_id: str, + workload_network_dns_service: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkDhcp]: - """Create or update dhcp by id in a private cloud workload network. - - Create or update dhcp by id in a private cloud workload network. + ) -> LROPoller[_models.WorkloadNetworkDnsService]: + """Update a WorkloadNetworkDnsService. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required. - :type dhcp_id: str - :param workload_network_dhcp: NSX DHCP. Required. - :type workload_network_dhcp: IO + :param dns_service_id: ID of the DNS service. Required. + :type dns_service_id: str + :param workload_network_dns_service: The resource properties to be updated. Required. + :type workload_network_dns_service: IO[bytes] :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 WorkloadNetworkDhcp or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp] + :return: An instance of LROPoller that returns either WorkloadNetworkDnsService or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_update_dhcp( + def begin_update_dns_service( self, resource_group_name: str, private_cloud_name: str, - dhcp_id: str, - workload_network_dhcp: Union[_models.WorkloadNetworkDhcp, IO], + dns_service_id: str, + workload_network_dns_service: Union[_models.WorkloadNetworkDnsService, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkDhcp]: - """Create or update dhcp by id in a private cloud workload network. - - Create or update dhcp by id in a private cloud workload network. + ) -> LROPoller[_models.WorkloadNetworkDnsService]: + """Update a WorkloadNetworkDnsService. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required. - :type dhcp_id: str - :param workload_network_dhcp: NSX DHCP. Is either a WorkloadNetworkDhcp type or a IO type. - Required. - :type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp 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 WorkloadNetworkDhcp or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp] + :param dns_service_id: ID of the DNS service. Required. + :type dns_service_id: str + :param workload_network_dns_service: The resource properties to be updated. Is either a + WorkloadNetworkDnsService type or a IO[bytes] type. Required. + :type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService or + IO[bytes] + :return: An instance of LROPoller that returns either WorkloadNetworkDnsService or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -3005,16 +2793,16 @@ def begin_update_dhcp( 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.WorkloadNetworkDhcp] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkDnsService] = 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_dhcp_initial( + raw_result = self._update_dns_service_initial( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - dhcp_id=dhcp_id, - workload_network_dhcp=workload_network_dhcp, + dns_service_id=dns_service_id, + workload_network_dns_service=workload_network_dns_service, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -3025,34 +2813,34 @@ def begin_update_dhcp( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.WorkloadNetworkDnsService].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_dhcp.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}" - } + return LROPoller[_models.WorkloadNetworkDnsService]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_dhcp_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, private_cloud_name: str, dhcp_id: str, **kwargs: Any + def _delete_dns_service_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, dns_service_id: str, private_cloud_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3066,22 +2854,21 @@ def _delete_dhcp_initial( # pylint: disable=inconsistent-return-statements 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_dhcp_request( + _request = build_delete_dns_service_request( resource_group_name=resource_group_name, + dns_service_id=dns_service_id, private_cloud_name=private_cloud_name, - dhcp_id=dhcp_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_dhcp_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -3091,36 +2878,27 @@ def _delete_dhcp_initial( # pylint: disable=inconsistent-return-statements 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, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _delete_dhcp_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace - def begin_delete_dhcp( - self, resource_group_name: str, private_cloud_name: str, dhcp_id: str, **kwargs: Any + def begin_delete_dns_service( + self, resource_group_name: str, dns_service_id: str, private_cloud_name: str, **kwargs: Any ) -> LROPoller[None]: - """Delete dhcp by id in a private cloud workload network. - - Delete dhcp by id in a private cloud workload network. + """Delete a WorkloadNetworkDnsService. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str + :param dns_service_id: ID of the DNS service. Required. + :type dns_service_id: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required. - :type dhcp_id: 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: @@ -3134,10 +2912,10 @@ def begin_delete_dhcp( 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_dhcp_initial( # type: ignore + raw_result = self._delete_dns_service_initial( # type: ignore resource_group_name=resource_group_name, + dns_service_id=dns_service_id, private_cloud_name=private_cloud_name, - dhcp_id=dhcp_id, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -3148,53 +2926,48 @@ def begin_delete_dhcp( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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_dhcp.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_gateways( + def list_dns_zones( self, resource_group_name: str, private_cloud_name: str, **kwargs: Any - ) -> Iterable["_models.WorkloadNetworkGateway"]: - """List of gateways in a private cloud workload network. - - List of gateways in a private cloud workload network. + ) -> Iterable["_models.WorkloadNetworkDnsZone"]: + """List WorkloadNetworkDnsZone resources by WorkloadNetwork. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadNetworkGateway or the result of + :return: An iterator like instance of either WorkloadNetworkDnsZone or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkGateway] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] :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.WorkloadNetworkGatewayList] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkDnsZonesList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3205,17 +2978,16 @@ def list_gateways( def prepare_request(next_link=None): if not next_link: - request = build_list_gateways_request( + _request = build_list_dns_zones_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_gateways.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -3227,27 +2999,27 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("WorkloadNetworkGatewayList", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDnsZonesList", 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) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -3260,32 +3032,24 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_gateways.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways" - } - @distributed_trace - def get_gateway( - self, resource_group_name: str, private_cloud_name: str, gateway_id: str, **kwargs: Any - ) -> _models.WorkloadNetworkGateway: - """Get a gateway by id in a private cloud workload network. - - Get a gateway by id in a private cloud workload network. + def get_dns_zone( + self, resource_group_name: str, private_cloud_name: str, dns_zone_id: str, **kwargs: Any + ) -> _models.WorkloadNetworkDnsZone: + """Get a WorkloadNetworkDnsZone. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param gateway_id: NSX Gateway identifier. Generally the same as the Gateway's display name. - Required. - :type gateway_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: WorkloadNetworkGateway or the result of cls(response) - :rtype: ~azure.mgmt.avs.models.WorkloadNetworkGateway + :param dns_zone_id: ID of the DNS zone. Required. + :type dns_zone_id: str + :return: WorkloadNetworkDnsZone or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3297,24 +3061,23 @@ def get_gateway( _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.WorkloadNetworkGateway] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkDnsZone] = kwargs.pop("cls", None) - request = build_get_gateway_request( + _request = build_get_dns_zone_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - gateway_id=gateway_id, + dns_zone_id=dns_zone_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_gateway.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -3324,43 +3087,22 @@ def get_gateway( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkloadNetworkGateway", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_gateway.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways/{gatewayId}" - } - - @distributed_trace - def list_port_mirroring( - self, resource_group_name: str, private_cloud_name: str, **kwargs: Any - ) -> Iterable["_models.WorkloadNetworkPortMirroring"]: - """List of port mirroring profiles in a private cloud workload network. - - List of port mirroring profiles in a private cloud workload network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param private_cloud_name: Name of the private cloud. Required. - :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadNetworkPortMirroring or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkloadNetworkPortMirroringList] = kwargs.pop("cls", None) + return deserialized # type: ignore - error_map = { + def _create_dns_zone_initial( + self, + resource_group_name: str, + private_cloud_name: str, + dns_zone_id: str, + workload_network_dns_zone: Union[_models.WorkloadNetworkDnsZone, IO[bytes]], + **kwargs: Any + ) -> _models.WorkloadNetworkDnsZone: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3368,336 +3110,148 @@ def list_port_mirroring( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - request = build_list_port_mirroring_request( - resource_group_name=resource_group_name, - private_cloud_name=private_cloud_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_port_mirroring.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + 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.WorkloadNetworkDnsZone] = kwargs.pop("cls", None) - 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 + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workload_network_dns_zone, (IOBase, bytes)): + _content = workload_network_dns_zone + else: + _json = self._serialize.body(workload_network_dns_zone, "WorkloadNetworkDnsZone") - def extract_data(pipeline_response): - deserialized = self._deserialize("WorkloadNetworkPortMirroringList", 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) + _request = build_create_dns_zone_request( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + dns_zone_id=dns_zone_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) - 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 + ) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + 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) + 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) - return pipeline_response + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response) - return ItemPaged(get_next, extract_data) + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - list_port_mirroring.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles" - } + deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response) - @distributed_trace - def get_port_mirroring( - self, resource_group_name: str, private_cloud_name: str, port_mirroring_id: str, **kwargs: Any - ) -> _models.WorkloadNetworkPortMirroring: - """Get a port mirroring profile by id in a private cloud workload network. + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - Get a port mirroring profile by id in a private cloud workload network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param private_cloud_name: Name of the private cloud. Required. - :type private_cloud_name: str - :param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port - Mirroring display name. Required. - :type port_mirroring_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: WorkloadNetworkPortMirroring or the result of cls(response) - :rtype: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring - :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.WorkloadNetworkPortMirroring] = kwargs.pop("cls", None) - - request = build_get_port_mirroring_request( - resource_group_name=resource_group_name, - private_cloud_name=private_cloud_name, - port_mirroring_id=port_mirroring_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get_port_mirroring.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("WorkloadNetworkPortMirroring", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_port_mirroring.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}" - } - - def _create_port_mirroring_initial( - self, - resource_group_name: str, - private_cloud_name: str, - port_mirroring_id: str, - workload_network_port_mirroring: Union[_models.WorkloadNetworkPortMirroring, IO], - **kwargs: Any - ) -> _models.WorkloadNetworkPortMirroring: - 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.WorkloadNetworkPortMirroring] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(workload_network_port_mirroring, (IOBase, bytes)): - _content = workload_network_port_mirroring - else: - _json = self._serialize.body(workload_network_port_mirroring, "WorkloadNetworkPortMirroring") - - request = build_create_port_mirroring_request( - resource_group_name=resource_group_name, - private_cloud_name=private_cloud_name, - port_mirroring_id=port_mirroring_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_port_mirroring_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_port_mirroring_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}" - } + return deserialized # type: ignore @overload - def begin_create_port_mirroring( + def begin_create_dns_zone( self, resource_group_name: str, private_cloud_name: str, - port_mirroring_id: str, - workload_network_port_mirroring: _models.WorkloadNetworkPortMirroring, + dns_zone_id: str, + workload_network_dns_zone: _models.WorkloadNetworkDnsZone, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkPortMirroring]: - """Create a port mirroring profile by id in a private cloud workload network. - - Create a port mirroring profile by id in a private cloud workload network. + ) -> LROPoller[_models.WorkloadNetworkDnsZone]: + """Create a WorkloadNetworkDnsZone. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port - Mirroring display name. Required. - :type port_mirroring_id: str - :param workload_network_port_mirroring: NSX port mirroring. Required. - :type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring + :param dns_zone_id: ID of the DNS zone. Required. + :type dns_zone_id: str + :param workload_network_dns_zone: Resource create parameters. Required. + :type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone :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 WorkloadNetworkPortMirroring or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] + :return: An instance of LROPoller that returns either WorkloadNetworkDnsZone or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_port_mirroring( + def begin_create_dns_zone( self, resource_group_name: str, private_cloud_name: str, - port_mirroring_id: str, - workload_network_port_mirroring: IO, + dns_zone_id: str, + workload_network_dns_zone: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkPortMirroring]: - """Create a port mirroring profile by id in a private cloud workload network. - - Create a port mirroring profile by id in a private cloud workload network. + ) -> LROPoller[_models.WorkloadNetworkDnsZone]: + """Create a WorkloadNetworkDnsZone. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port - Mirroring display name. Required. - :type port_mirroring_id: str - :param workload_network_port_mirroring: NSX port mirroring. Required. - :type workload_network_port_mirroring: IO + :param dns_zone_id: ID of the DNS zone. Required. + :type dns_zone_id: str + :param workload_network_dns_zone: Resource create parameters. Required. + :type workload_network_dns_zone: IO[bytes] :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 WorkloadNetworkPortMirroring or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] + :return: An instance of LROPoller that returns either WorkloadNetworkDnsZone or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_port_mirroring( + def begin_create_dns_zone( self, resource_group_name: str, private_cloud_name: str, - port_mirroring_id: str, - workload_network_port_mirroring: Union[_models.WorkloadNetworkPortMirroring, IO], + dns_zone_id: str, + workload_network_dns_zone: Union[_models.WorkloadNetworkDnsZone, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkPortMirroring]: - """Create a port mirroring profile by id in a private cloud workload network. - - Create a port mirroring profile by id in a private cloud workload network. + ) -> LROPoller[_models.WorkloadNetworkDnsZone]: + """Create a WorkloadNetworkDnsZone. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port - Mirroring display name. Required. - :type port_mirroring_id: str - :param workload_network_port_mirroring: NSX port mirroring. Is either a - WorkloadNetworkPortMirroring type or a IO type. Required. - :type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring 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 WorkloadNetworkPortMirroring or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] + :param dns_zone_id: ID of the DNS zone. Required. + :type dns_zone_id: str + :param workload_network_dns_zone: Resource create parameters. Is either a + WorkloadNetworkDnsZone type or a IO[bytes] type. Required. + :type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone or IO[bytes] + :return: An instance of LROPoller that returns either WorkloadNetworkDnsZone or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -3705,16 +3259,16 @@ def begin_create_port_mirroring( 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.WorkloadNetworkPortMirroring] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkDnsZone] = 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_port_mirroring_initial( + raw_result = self._create_dns_zone_initial( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - port_mirroring_id=port_mirroring_id, - workload_network_port_mirroring=workload_network_port_mirroring, + dns_zone_id=dns_zone_id, + workload_network_dns_zone=workload_network_dns_zone, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -3725,39 +3279,39 @@ def begin_create_port_mirroring( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.WorkloadNetworkDnsZone].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_port_mirroring.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}" - } + return LROPoller[_models.WorkloadNetworkDnsZone]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _update_port_mirroring_initial( + def _update_dns_zone_initial( self, resource_group_name: str, private_cloud_name: str, - port_mirroring_id: str, - workload_network_port_mirroring: Union[_models.WorkloadNetworkPortMirroring, IO], + dns_zone_id: str, + workload_network_dns_zone: Union[_models.WorkloadNetworkDnsZone, IO[bytes]], **kwargs: Any - ) -> Optional[_models.WorkloadNetworkPortMirroring]: - error_map = { + ) -> Optional[_models.WorkloadNetworkDnsZone]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3770,35 +3324,34 @@ def _update_port_mirroring_initial( 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.WorkloadNetworkPortMirroring]] = kwargs.pop("cls", None) + cls: ClsType[Optional[_models.WorkloadNetworkDnsZone]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(workload_network_port_mirroring, (IOBase, bytes)): - _content = workload_network_port_mirroring + if isinstance(workload_network_dns_zone, (IOBase, bytes)): + _content = workload_network_dns_zone else: - _json = self._serialize.body(workload_network_port_mirroring, "WorkloadNetworkPortMirroring") + _json = self._serialize.body(workload_network_dns_zone, "WorkloadNetworkDnsZone") - request = build_update_port_mirroring_request( + _request = build_update_dns_zone_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - port_mirroring_id=port_mirroring_id, + dns_zone_id=dns_zone_id, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._update_port_mirroring_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -3809,141 +3362,105 @@ def _update_port_mirroring_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - return deserialized + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _update_port_mirroring_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}" - } + return deserialized # type: ignore @overload - def begin_update_port_mirroring( + def begin_update_dns_zone( self, resource_group_name: str, private_cloud_name: str, - port_mirroring_id: str, - workload_network_port_mirroring: _models.WorkloadNetworkPortMirroring, + dns_zone_id: str, + workload_network_dns_zone: _models.WorkloadNetworkDnsZone, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkPortMirroring]: - """Create or update a port mirroring profile by id in a private cloud workload network. - - Create or update a port mirroring profile by id in a private cloud workload network. + ) -> LROPoller[_models.WorkloadNetworkDnsZone]: + """Update a WorkloadNetworkDnsZone. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port - Mirroring display name. Required. - :type port_mirroring_id: str - :param workload_network_port_mirroring: NSX port mirroring. Required. - :type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring + :param dns_zone_id: ID of the DNS zone. Required. + :type dns_zone_id: str + :param workload_network_dns_zone: The resource properties to be updated. Required. + :type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone :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 WorkloadNetworkPortMirroring or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] + :return: An instance of LROPoller that returns either WorkloadNetworkDnsZone or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update_port_mirroring( + def begin_update_dns_zone( self, resource_group_name: str, private_cloud_name: str, - port_mirroring_id: str, - workload_network_port_mirroring: IO, + dns_zone_id: str, + workload_network_dns_zone: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkPortMirroring]: - """Create or update a port mirroring profile by id in a private cloud workload network. - - Create or update a port mirroring profile by id in a private cloud workload network. + ) -> LROPoller[_models.WorkloadNetworkDnsZone]: + """Update a WorkloadNetworkDnsZone. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port - Mirroring display name. Required. - :type port_mirroring_id: str - :param workload_network_port_mirroring: NSX port mirroring. Required. - :type workload_network_port_mirroring: IO + :param dns_zone_id: ID of the DNS zone. Required. + :type dns_zone_id: str + :param workload_network_dns_zone: The resource properties to be updated. Required. + :type workload_network_dns_zone: IO[bytes] :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 WorkloadNetworkPortMirroring or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] + :return: An instance of LROPoller that returns either WorkloadNetworkDnsZone or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_update_port_mirroring( + def begin_update_dns_zone( self, resource_group_name: str, private_cloud_name: str, - port_mirroring_id: str, - workload_network_port_mirroring: Union[_models.WorkloadNetworkPortMirroring, IO], + dns_zone_id: str, + workload_network_dns_zone: Union[_models.WorkloadNetworkDnsZone, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkPortMirroring]: - """Create or update a port mirroring profile by id in a private cloud workload network. - - Create or update a port mirroring profile by id in a private cloud workload network. + ) -> LROPoller[_models.WorkloadNetworkDnsZone]: + """Update a WorkloadNetworkDnsZone. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port - Mirroring display name. Required. - :type port_mirroring_id: str - :param workload_network_port_mirroring: NSX port mirroring. Is either a - WorkloadNetworkPortMirroring type or a IO type. Required. - :type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring 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 WorkloadNetworkPortMirroring or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] + :param dns_zone_id: ID of the DNS zone. Required. + :type dns_zone_id: str + :param workload_network_dns_zone: The resource properties to be updated. Is either a + WorkloadNetworkDnsZone type or a IO[bytes] type. Required. + :type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone or IO[bytes] + :return: An instance of LROPoller that returns either WorkloadNetworkDnsZone or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -3951,17 +3468,17 @@ def begin_update_port_mirroring( 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.WorkloadNetworkPortMirroring] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkDnsZone] = 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_port_mirroring_initial( + raw_result = self._update_dns_zone_initial( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - port_mirroring_id=port_mirroring_id, - workload_network_port_mirroring=workload_network_port_mirroring, - api_version=api_version, + dns_zone_id=dns_zone_id, + workload_network_dns_zone=workload_network_dns_zone, + api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -3971,34 +3488,34 @@ def begin_update_port_mirroring( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.WorkloadNetworkDnsZone].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_port_mirroring.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}" - } + return LROPoller[_models.WorkloadNetworkDnsZone]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_port_mirroring_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, port_mirroring_id: str, private_cloud_name: str, **kwargs: Any + def _delete_dns_zone_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, dns_zone_id: str, private_cloud_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4012,22 +3529,21 @@ def _delete_port_mirroring_initial( # pylint: disable=inconsistent-return-state 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_port_mirroring_request( + _request = build_delete_dns_zone_request( resource_group_name=resource_group_name, - port_mirroring_id=port_mirroring_id, + dns_zone_id=dns_zone_id, private_cloud_name=private_cloud_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_port_mirroring_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -4037,37 +3553,27 @@ def _delete_port_mirroring_initial( # pylint: disable=inconsistent-return-state 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, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _delete_port_mirroring_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace - def begin_delete_port_mirroring( - self, resource_group_name: str, port_mirroring_id: str, private_cloud_name: str, **kwargs: Any + def begin_delete_dns_zone( + self, resource_group_name: str, dns_zone_id: str, private_cloud_name: str, **kwargs: Any ) -> LROPoller[None]: - """Delete a port mirroring profile by id in a private cloud workload network. - - Delete a port mirroring profile by id in a private cloud workload network. + """Delete a WorkloadNetworkDnsZone. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port - Mirroring display name. Required. - :type port_mirroring_id: str + :param dns_zone_id: ID of the DNS zone. Required. + :type dns_zone_id: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_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: @@ -4081,9 +3587,9 @@ def begin_delete_port_mirroring( 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_port_mirroring_initial( # type: ignore + raw_result = self._delete_dns_zone_initial( # type: ignore resource_group_name=resource_group_name, - port_mirroring_id=port_mirroring_id, + dns_zone_id=dns_zone_id, private_cloud_name=private_cloud_name, api_version=api_version, cls=lambda x, y, z: x, @@ -4095,53 +3601,48 @@ def begin_delete_port_mirroring( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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_port_mirroring.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_vm_groups( + def list_gateways( self, resource_group_name: str, private_cloud_name: str, **kwargs: Any - ) -> Iterable["_models.WorkloadNetworkVMGroup"]: - """List of vm groups in a private cloud workload network. - - List of vm groups in a private cloud workload network. + ) -> Iterable["_models.WorkloadNetworkGateway"]: + """List WorkloadNetworkGateway resources by WorkloadNetwork. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadNetworkVMGroup or the result of + :return: An iterator like instance of either WorkloadNetworkGateway or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkGateway] :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.WorkloadNetworkVMGroupsList] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkGatewayList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4152,17 +3653,16 @@ def list_vm_groups( def prepare_request(next_link=None): if not next_link: - request = build_list_vm_groups_request( + _request = build_list_gateways_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_vm_groups.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -4174,27 +3674,27 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("WorkloadNetworkVMGroupsList", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkGatewayList", 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) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -4207,32 +3707,173 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_vm_groups.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups" - } - @distributed_trace - def get_vm_group( - self, resource_group_name: str, private_cloud_name: str, vm_group_id: str, **kwargs: Any - ) -> _models.WorkloadNetworkVMGroup: - """Get a vm group by id in a private cloud workload network. + def get_gateway( + self, resource_group_name: str, private_cloud_name: str, gateway_id: str, **kwargs: Any + ) -> _models.WorkloadNetworkGateway: + """Get a WorkloadNetworkGateway. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. Required. + :type private_cloud_name: str + :param gateway_id: The ID of the NSX Gateway. Required. + :type gateway_id: str + :return: WorkloadNetworkGateway or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetworkGateway + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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.WorkloadNetworkGateway] = kwargs.pop("cls", None) + + _request = build_get_gateway_request( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + gateway_id=gateway_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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) - Get a vm group by id in a private cloud workload network. + deserialized = self._deserialize("WorkloadNetworkGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_port_mirroring( + self, resource_group_name: str, private_cloud_name: str, **kwargs: Any + ) -> Iterable["_models.WorkloadNetworkPortMirroring"]: + """List WorkloadNetworkPortMirroring resources by WorkloadNetwork. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name. + :return: An iterator like instance of either WorkloadNetworkPortMirroring or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] + :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.WorkloadNetworkPortMirroringList] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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_port_mirroring_request( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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("WorkloadNetworkPortMirroringList", 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) + + @distributed_trace + def get_port_mirroring( + self, resource_group_name: str, private_cloud_name: str, port_mirroring_id: str, **kwargs: Any + ) -> _models.WorkloadNetworkPortMirroring: + """Get a WorkloadNetworkPortMirroring. + + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type vm_group_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: WorkloadNetworkVMGroup or the result of cls(response) - :rtype: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. Required. + :type private_cloud_name: str + :param port_mirroring_id: ID of the NSX port mirroring profile. Required. + :type port_mirroring_id: str + :return: WorkloadNetworkPortMirroring or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4244,24 +3885,23 @@ def get_vm_group( _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.WorkloadNetworkVMGroup] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkPortMirroring] = kwargs.pop("cls", None) - request = build_get_vm_group_request( + _request = build_get_port_mirroring_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - vm_group_id=vm_group_id, + port_mirroring_id=port_mirroring_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_vm_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -4271,26 +3911,22 @@ def get_vm_group( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_vm_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}" - } + return deserialized # type: ignore - def _create_vm_group_initial( + def _create_port_mirroring_initial( self, resource_group_name: str, private_cloud_name: str, - vm_group_id: str, - workload_network_vm_group: Union[_models.WorkloadNetworkVMGroup, IO], + port_mirroring_id: str, + workload_network_port_mirroring: Union[_models.WorkloadNetworkPortMirroring, IO[bytes]], **kwargs: Any - ) -> _models.WorkloadNetworkVMGroup: - error_map = { + ) -> _models.WorkloadNetworkPortMirroring: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4303,35 +3939,34 @@ def _create_vm_group_initial( 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.WorkloadNetworkVMGroup] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkPortMirroring] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(workload_network_vm_group, (IOBase, bytes)): - _content = workload_network_vm_group + if isinstance(workload_network_port_mirroring, (IOBase, bytes)): + _content = workload_network_port_mirroring else: - _json = self._serialize.body(workload_network_vm_group, "WorkloadNetworkVMGroup") + _json = self._serialize.body(workload_network_port_mirroring, "WorkloadNetworkPortMirroring") - request = build_create_vm_group_request( + _request = build_create_port_mirroring_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - vm_group_id=vm_group_id, + port_mirroring_id=port_mirroring_id, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_vm_group_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -4341,143 +3976,107 @@ def _create_vm_group_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_vm_group_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}" - } - @overload - def begin_create_vm_group( + def begin_create_port_mirroring( self, resource_group_name: str, private_cloud_name: str, - vm_group_id: str, - workload_network_vm_group: _models.WorkloadNetworkVMGroup, + port_mirroring_id: str, + workload_network_port_mirroring: _models.WorkloadNetworkPortMirroring, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkVMGroup]: - """Create a vm group by id in a private cloud workload network. - - Create a vm group by id in a private cloud workload network. + ) -> LROPoller[_models.WorkloadNetworkPortMirroring]: + """Create a WorkloadNetworkPortMirroring. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name. - Required. - :type vm_group_id: str - :param workload_network_vm_group: NSX VM Group. Required. - :type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup + :param port_mirroring_id: ID of the NSX port mirroring profile. Required. + :type port_mirroring_id: str + :param workload_network_port_mirroring: Resource create parameters. Required. + :type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring :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 WorkloadNetworkVMGroup or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] + :return: An instance of LROPoller that returns either WorkloadNetworkPortMirroring or the + result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_vm_group( + def begin_create_port_mirroring( self, resource_group_name: str, private_cloud_name: str, - vm_group_id: str, - workload_network_vm_group: IO, + port_mirroring_id: str, + workload_network_port_mirroring: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkVMGroup]: - """Create a vm group by id in a private cloud workload network. - - Create a vm group by id in a private cloud workload network. + ) -> LROPoller[_models.WorkloadNetworkPortMirroring]: + """Create a WorkloadNetworkPortMirroring. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name. - Required. - :type vm_group_id: str - :param workload_network_vm_group: NSX VM Group. Required. - :type workload_network_vm_group: IO + :param port_mirroring_id: ID of the NSX port mirroring profile. Required. + :type port_mirroring_id: str + :param workload_network_port_mirroring: Resource create parameters. Required. + :type workload_network_port_mirroring: IO[bytes] :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 WorkloadNetworkVMGroup or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] - :raises ~azure.core.exceptions.HttpResponseError: - """ + :return: An instance of LROPoller that returns either WorkloadNetworkPortMirroring or the + result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def begin_create_vm_group( + def begin_create_port_mirroring( self, resource_group_name: str, private_cloud_name: str, - vm_group_id: str, - workload_network_vm_group: Union[_models.WorkloadNetworkVMGroup, IO], + port_mirroring_id: str, + workload_network_port_mirroring: Union[_models.WorkloadNetworkPortMirroring, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkVMGroup]: - """Create a vm group by id in a private cloud workload network. - - Create a vm group by id in a private cloud workload network. + ) -> LROPoller[_models.WorkloadNetworkPortMirroring]: + """Create a WorkloadNetworkPortMirroring. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name. - Required. - :type vm_group_id: str - :param workload_network_vm_group: NSX VM Group. Is either a WorkloadNetworkVMGroup type or a IO - type. Required. - :type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup 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 WorkloadNetworkVMGroup or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] + :param port_mirroring_id: ID of the NSX port mirroring profile. Required. + :type port_mirroring_id: str + :param workload_network_port_mirroring: Resource create parameters. Is either a + WorkloadNetworkPortMirroring type or a IO[bytes] type. Required. + :type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring or + IO[bytes] + :return: An instance of LROPoller that returns either WorkloadNetworkPortMirroring or the + result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -4485,16 +4084,16 @@ def begin_create_vm_group( 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.WorkloadNetworkVMGroup] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkPortMirroring] = 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_vm_group_initial( + raw_result = self._create_port_mirroring_initial( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - vm_group_id=vm_group_id, - workload_network_vm_group=workload_network_vm_group, + port_mirroring_id=port_mirroring_id, + workload_network_port_mirroring=workload_network_port_mirroring, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -4505,39 +4104,39 @@ def begin_create_vm_group( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.WorkloadNetworkPortMirroring].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_vm_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}" - } + return LROPoller[_models.WorkloadNetworkPortMirroring]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _update_vm_group_initial( + def _update_port_mirroring_initial( self, resource_group_name: str, private_cloud_name: str, - vm_group_id: str, - workload_network_vm_group: Union[_models.WorkloadNetworkVMGroup, IO], + port_mirroring_id: str, + workload_network_port_mirroring: Union[_models.WorkloadNetworkPortMirroring, IO[bytes]], **kwargs: Any - ) -> Optional[_models.WorkloadNetworkVMGroup]: - error_map = { + ) -> Optional[_models.WorkloadNetworkPortMirroring]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4550,35 +4149,34 @@ def _update_vm_group_initial( 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.WorkloadNetworkVMGroup]] = kwargs.pop("cls", None) + cls: ClsType[Optional[_models.WorkloadNetworkPortMirroring]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(workload_network_vm_group, (IOBase, bytes)): - _content = workload_network_vm_group + if isinstance(workload_network_port_mirroring, (IOBase, bytes)): + _content = workload_network_port_mirroring else: - _json = self._serialize.body(workload_network_vm_group, "WorkloadNetworkVMGroup") + _json = self._serialize.body(workload_network_port_mirroring, "WorkloadNetworkPortMirroring") - request = build_update_vm_group_request( + _request = build_update_port_mirroring_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - vm_group_id=vm_group_id, + port_mirroring_id=port_mirroring_id, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._update_vm_group_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -4589,140 +4187,106 @@ def _update_vm_group_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - return deserialized + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _update_vm_group_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}" - } + return deserialized # type: ignore @overload - def begin_update_vm_group( + def begin_update_port_mirroring( self, resource_group_name: str, private_cloud_name: str, - vm_group_id: str, - workload_network_vm_group: _models.WorkloadNetworkVMGroup, + port_mirroring_id: str, + workload_network_port_mirroring: _models.WorkloadNetworkPortMirroring, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkVMGroup]: - """Create or update a vm group by id in a private cloud workload network. - - Create or update a vm group by id in a private cloud workload network. + ) -> LROPoller[_models.WorkloadNetworkPortMirroring]: + """Update a WorkloadNetworkPortMirroring. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name. - Required. - :type vm_group_id: str - :param workload_network_vm_group: NSX VM Group. Required. - :type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup + :param port_mirroring_id: ID of the NSX port mirroring profile. Required. + :type port_mirroring_id: str + :param workload_network_port_mirroring: The resource properties to be updated. Required. + :type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring :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 WorkloadNetworkVMGroup or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] + :return: An instance of LROPoller that returns either WorkloadNetworkPortMirroring or the + result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update_vm_group( + def begin_update_port_mirroring( self, resource_group_name: str, private_cloud_name: str, - vm_group_id: str, - workload_network_vm_group: IO, + port_mirroring_id: str, + workload_network_port_mirroring: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkVMGroup]: - """Create or update a vm group by id in a private cloud workload network. - - Create or update a vm group by id in a private cloud workload network. + ) -> LROPoller[_models.WorkloadNetworkPortMirroring]: + """Update a WorkloadNetworkPortMirroring. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name. - Required. - :type vm_group_id: str - :param workload_network_vm_group: NSX VM Group. Required. - :type workload_network_vm_group: IO + :param port_mirroring_id: ID of the NSX port mirroring profile. Required. + :type port_mirroring_id: str + :param workload_network_port_mirroring: The resource properties to be updated. Required. + :type workload_network_port_mirroring: IO[bytes] :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 WorkloadNetworkVMGroup or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] + :return: An instance of LROPoller that returns either WorkloadNetworkPortMirroring or the + result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_update_vm_group( + def begin_update_port_mirroring( self, resource_group_name: str, private_cloud_name: str, - vm_group_id: str, - workload_network_vm_group: Union[_models.WorkloadNetworkVMGroup, IO], + port_mirroring_id: str, + workload_network_port_mirroring: Union[_models.WorkloadNetworkPortMirroring, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkVMGroup]: - """Create or update a vm group by id in a private cloud workload network. - - Create or update a vm group by id in a private cloud workload network. + ) -> LROPoller[_models.WorkloadNetworkPortMirroring]: + """Update a WorkloadNetworkPortMirroring. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name. - Required. - :type vm_group_id: str - :param workload_network_vm_group: NSX VM Group. Is either a WorkloadNetworkVMGroup type or a IO - type. Required. - :type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup 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 WorkloadNetworkVMGroup or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] + :param port_mirroring_id: ID of the NSX port mirroring profile. Required. + :type port_mirroring_id: str + :param workload_network_port_mirroring: The resource properties to be updated. Is either a + WorkloadNetworkPortMirroring type or a IO[bytes] type. Required. + :type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring or + IO[bytes] + :return: An instance of LROPoller that returns either WorkloadNetworkPortMirroring or the + result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -4730,16 +4294,16 @@ def begin_update_vm_group( 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.WorkloadNetworkVMGroup] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkPortMirroring] = 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_vm_group_initial( + raw_result = self._update_port_mirroring_initial( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - vm_group_id=vm_group_id, - workload_network_vm_group=workload_network_vm_group, + port_mirroring_id=port_mirroring_id, + workload_network_port_mirroring=workload_network_port_mirroring, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -4750,34 +4314,34 @@ def begin_update_vm_group( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.WorkloadNetworkPortMirroring].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_vm_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}" - } + return LROPoller[_models.WorkloadNetworkPortMirroring]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_vm_group_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, vm_group_id: str, private_cloud_name: str, **kwargs: Any + def _delete_port_mirroring_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, port_mirroring_id: str, private_cloud_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4791,22 +4355,21 @@ def _delete_vm_group_initial( # pylint: disable=inconsistent-return-statements 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_vm_group_request( + _request = build_delete_port_mirroring_request( resource_group_name=resource_group_name, - vm_group_id=vm_group_id, + port_mirroring_id=port_mirroring_id, private_cloud_name=private_cloud_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_vm_group_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -4816,37 +4379,27 @@ def _delete_vm_group_initial( # pylint: disable=inconsistent-return-statements 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, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _delete_vm_group_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace - def begin_delete_vm_group( - self, resource_group_name: str, vm_group_id: str, private_cloud_name: str, **kwargs: Any + def begin_delete_port_mirroring( + self, resource_group_name: str, port_mirroring_id: str, private_cloud_name: str, **kwargs: Any ) -> LROPoller[None]: - """Delete a vm group by id in a private cloud workload network. - - Delete a vm group by id in a private cloud workload network. + """Delete a WorkloadNetworkPortMirroring. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name. - Required. - :type vm_group_id: str + :param port_mirroring_id: ID of the NSX port mirroring profile. Required. + :type port_mirroring_id: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_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: @@ -4860,9 +4413,9 @@ def begin_delete_vm_group( 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_vm_group_initial( # type: ignore + raw_result = self._delete_port_mirroring_initial( # type: ignore resource_group_name=resource_group_name, - vm_group_id=vm_group_id, + port_mirroring_id=port_mirroring_id, private_cloud_name=private_cloud_name, api_version=api_version, cls=lambda x, y, z: x, @@ -4874,53 +4427,48 @@ def begin_delete_vm_group( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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_vm_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_virtual_machines( + def list_public_i_ps( self, resource_group_name: str, private_cloud_name: str, **kwargs: Any - ) -> Iterable["_models.WorkloadNetworkVirtualMachine"]: - """List of virtual machines in a private cloud workload network. - - List of virtual machines in a private cloud workload network. + ) -> Iterable["_models.WorkloadNetworkPublicIP"]: + """List WorkloadNetworkPublicIP resources by WorkloadNetwork. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadNetworkVirtualMachine or the result of + :return: An iterator like instance of either WorkloadNetworkPublicIP or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkVirtualMachine] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkPublicIP] :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.WorkloadNetworkVirtualMachinesList] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkPublicIPsList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4931,17 +4479,16 @@ def list_virtual_machines( def prepare_request(next_link=None): if not next_link: - request = build_list_virtual_machines_request( + _request = build_list_public_i_ps_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_virtual_machines.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -4953,27 +4500,27 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("WorkloadNetworkVirtualMachinesList", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkPublicIPsList", 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) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -4986,31 +4533,24 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_virtual_machines.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines" - } - @distributed_trace - def get_virtual_machine( - self, resource_group_name: str, private_cloud_name: str, virtual_machine_id: str, **kwargs: Any - ) -> _models.WorkloadNetworkVirtualMachine: - """Get a virtual machine by id in a private cloud workload network. - - Get a virtual machine by id in a private cloud workload network. + def get_public_ip( + self, resource_group_name: str, private_cloud_name: str, public_ip_id: str, **kwargs: Any + ) -> _models.WorkloadNetworkPublicIP: + """Get a WorkloadNetworkPublicIP. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param virtual_machine_id: Virtual Machine identifier. Required. - :type virtual_machine_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: WorkloadNetworkVirtualMachine or the result of cls(response) - :rtype: ~azure.mgmt.avs.models.WorkloadNetworkVirtualMachine + :param public_ip_id: ID of the DNS zone. Required. + :type public_ip_id: str + :return: WorkloadNetworkPublicIP or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetworkPublicIP :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5022,24 +4562,23 @@ def get_virtual_machine( _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.WorkloadNetworkVirtualMachine] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkPublicIP] = kwargs.pop("cls", None) - request = build_get_virtual_machine_request( + _request = build_get_public_ip_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - virtual_machine_id=virtual_machine_id, + public_ip_id=public_ip_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_virtual_machine.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -5049,43 +4588,22 @@ def get_virtual_machine( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkloadNetworkVirtualMachine", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkPublicIP", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_virtual_machine.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines/{virtualMachineId}" - } - - @distributed_trace - def list_dns_services( - self, resource_group_name: str, private_cloud_name: str, **kwargs: Any - ) -> Iterable["_models.WorkloadNetworkDnsService"]: - """List of DNS services in a private cloud workload network. - - List of DNS services in a private cloud workload network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param private_cloud_name: Name of the private cloud. Required. - :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadNetworkDnsService or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDnsService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkloadNetworkDnsServicesList] = kwargs.pop("cls", None) + return deserialized # type: ignore - error_map = { + def _create_public_ip_initial( + self, + resource_group_name: str, + private_cloud_name: str, + public_ip_id: str, + workload_network_public_ip: Union[_models.WorkloadNetworkPublicIP, IO[bytes]], + **kwargs: Any + ) -> _models.WorkloadNetworkPublicIP: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5093,189 +4611,39 @@ def list_dns_services( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - request = build_list_dns_services_request( - resource_group_name=resource_group_name, - private_cloud_name=private_cloud_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_dns_services.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + 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.WorkloadNetworkPublicIP] = kwargs.pop("cls", None) - 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 + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workload_network_public_ip, (IOBase, bytes)): + _content = workload_network_public_ip + else: + _json = self._serialize.body(workload_network_public_ip, "WorkloadNetworkPublicIP") - def extract_data(pipeline_response): - deserialized = self._deserialize("WorkloadNetworkDnsServicesList", 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_dns_services.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices" - } - - @distributed_trace - def get_dns_service( - self, resource_group_name: str, private_cloud_name: str, dns_service_id: str, **kwargs: Any - ) -> _models.WorkloadNetworkDnsService: - """Get a DNS service by id in a private cloud workload network. - - Get a DNS service by id in a private cloud workload network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param private_cloud_name: Name of the private cloud. Required. - :type private_cloud_name: str - :param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's - display name. Required. - :type dns_service_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: WorkloadNetworkDnsService or the result of cls(response) - :rtype: ~azure.mgmt.avs.models.WorkloadNetworkDnsService - :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.WorkloadNetworkDnsService] = kwargs.pop("cls", None) - - request = build_get_dns_service_request( + _request = build_create_public_ip_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - dns_service_id=dns_service_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get_dns_service.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("WorkloadNetworkDnsService", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_dns_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}" - } - - def _create_dns_service_initial( - self, - resource_group_name: str, - private_cloud_name: str, - dns_service_id: str, - workload_network_dns_service: Union[_models.WorkloadNetworkDnsService, IO], - **kwargs: Any - ) -> _models.WorkloadNetworkDnsService: - 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.WorkloadNetworkDnsService] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(workload_network_dns_service, (IOBase, bytes)): - _content = workload_network_dns_service - else: - _json = self._serialize.body(workload_network_dns_service, "WorkloadNetworkDnsService") - - request = build_create_dns_service_request( - resource_group_name=resource_group_name, - private_cloud_name=private_cloud_name, - dns_service_id=dns_service_id, + public_ip_id=public_ip_id, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_dns_service_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -5285,388 +4653,106 @@ def _create_dns_service_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkPublicIP", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_dns_service_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}" - } - - @overload - def begin_create_dns_service( - self, - resource_group_name: str, - private_cloud_name: str, - dns_service_id: str, - workload_network_dns_service: _models.WorkloadNetworkDnsService, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkDnsService]: - """Create a DNS service by id in a private cloud workload network. - - Create a DNS service by id in a private cloud workload network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param private_cloud_name: Name of the private cloud. Required. - :type private_cloud_name: str - :param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's - display name. Required. - :type dns_service_id: str - :param workload_network_dns_service: NSX DNS Service. Required. - :type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService - :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 WorkloadNetworkDnsService or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_dns_service( - self, - resource_group_name: str, - private_cloud_name: str, - dns_service_id: str, - workload_network_dns_service: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkDnsService]: - """Create a DNS service by id in a private cloud workload network. - - Create a DNS service by id in a private cloud workload network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param private_cloud_name: Name of the private cloud. Required. - :type private_cloud_name: str - :param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's - display name. Required. - :type dns_service_id: str - :param workload_network_dns_service: NSX DNS Service. Required. - :type workload_network_dns_service: 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 WorkloadNetworkDnsService or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_dns_service( - self, - resource_group_name: str, - private_cloud_name: str, - dns_service_id: str, - workload_network_dns_service: Union[_models.WorkloadNetworkDnsService, IO], - **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkDnsService]: - """Create a DNS service by id in a private cloud workload network. - - Create a DNS service by id in a private cloud workload network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param private_cloud_name: Name of the private cloud. Required. - :type private_cloud_name: str - :param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's - display name. Required. - :type dns_service_id: str - :param workload_network_dns_service: NSX DNS Service. Is either a WorkloadNetworkDnsService - type or a IO type. Required. - :type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService 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 WorkloadNetworkDnsService or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService] - :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.WorkloadNetworkDnsService] = 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_dns_service_initial( - resource_group_name=resource_group_name, - private_cloud_name=private_cloud_name, - dns_service_id=dns_service_id, - workload_network_dns_service=workload_network_dns_service, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_dns_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}" - } - - def _update_dns_service_initial( - self, - resource_group_name: str, - private_cloud_name: str, - dns_service_id: str, - workload_network_dns_service: Union[_models.WorkloadNetworkDnsService, IO], - **kwargs: Any - ) -> Optional[_models.WorkloadNetworkDnsService]: - 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.WorkloadNetworkDnsService]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(workload_network_dns_service, (IOBase, bytes)): - _content = workload_network_dns_service - else: - _json = self._serialize.body(workload_network_dns_service, "WorkloadNetworkDnsService") - - request = build_update_dns_service_request( - resource_group_name=resource_group_name, - private_cloud_name=private_cloud_name, - dns_service_id=dns_service_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._update_dns_service_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkPublicIP", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _update_dns_service_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}" - } + return deserialized # type: ignore @overload - def begin_update_dns_service( + def begin_create_public_ip( self, resource_group_name: str, private_cloud_name: str, - dns_service_id: str, - workload_network_dns_service: _models.WorkloadNetworkDnsService, + public_ip_id: str, + workload_network_public_ip: _models.WorkloadNetworkPublicIP, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkDnsService]: - """Create or update a DNS service by id in a private cloud workload network. - - Create or update a DNS service by id in a private cloud workload network. + ) -> LROPoller[_models.WorkloadNetworkPublicIP]: + """Create a WorkloadNetworkPublicIP. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's - display name. Required. - :type dns_service_id: str - :param workload_network_dns_service: NSX DNS Service. Required. - :type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService + :param public_ip_id: ID of the DNS zone. Required. + :type public_ip_id: str + :param workload_network_public_ip: Resource create parameters. Required. + :type workload_network_public_ip: ~azure.mgmt.avs.models.WorkloadNetworkPublicIP :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 WorkloadNetworkDnsService or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService] + :return: An instance of LROPoller that returns either WorkloadNetworkPublicIP or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPublicIP] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update_dns_service( + def begin_create_public_ip( self, resource_group_name: str, private_cloud_name: str, - dns_service_id: str, - workload_network_dns_service: IO, + public_ip_id: str, + workload_network_public_ip: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkDnsService]: - """Create or update a DNS service by id in a private cloud workload network. - - Create or update a DNS service by id in a private cloud workload network. + ) -> LROPoller[_models.WorkloadNetworkPublicIP]: + """Create a WorkloadNetworkPublicIP. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's - display name. Required. - :type dns_service_id: str - :param workload_network_dns_service: NSX DNS Service. Required. - :type workload_network_dns_service: IO + :param public_ip_id: ID of the DNS zone. Required. + :type public_ip_id: str + :param workload_network_public_ip: Resource create parameters. Required. + :type workload_network_public_ip: IO[bytes] :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 WorkloadNetworkDnsService or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService] + :return: An instance of LROPoller that returns either WorkloadNetworkPublicIP or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPublicIP] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_update_dns_service( + def begin_create_public_ip( self, resource_group_name: str, private_cloud_name: str, - dns_service_id: str, - workload_network_dns_service: Union[_models.WorkloadNetworkDnsService, IO], + public_ip_id: str, + workload_network_public_ip: Union[_models.WorkloadNetworkPublicIP, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkDnsService]: - """Create or update a DNS service by id in a private cloud workload network. - - Create or update a DNS service by id in a private cloud workload network. + ) -> LROPoller[_models.WorkloadNetworkPublicIP]: + """Create a WorkloadNetworkPublicIP. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's - display name. Required. - :type dns_service_id: str - :param workload_network_dns_service: NSX DNS Service. Is either a WorkloadNetworkDnsService - type or a IO type. Required. - :type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService 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 WorkloadNetworkDnsService or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService] + :param public_ip_id: ID of the DNS zone. Required. + :type public_ip_id: str + :param workload_network_public_ip: Resource create parameters. Is either a + WorkloadNetworkPublicIP type or a IO[bytes] type. Required. + :type workload_network_public_ip: ~azure.mgmt.avs.models.WorkloadNetworkPublicIP or IO[bytes] + :return: An instance of LROPoller that returns either WorkloadNetworkPublicIP or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPublicIP] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -5674,16 +4760,16 @@ def begin_update_dns_service( 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.WorkloadNetworkDnsService] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkPublicIP] = 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_dns_service_initial( + raw_result = self._create_public_ip_initial( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - dns_service_id=dns_service_id, - workload_network_dns_service=workload_network_dns_service, + public_ip_id=public_ip_id, + workload_network_public_ip=workload_network_public_ip, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -5694,34 +4780,34 @@ def begin_update_dns_service( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkPublicIP", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.WorkloadNetworkPublicIP].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_dns_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}" - } + return LROPoller[_models.WorkloadNetworkPublicIP]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_dns_service_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, dns_service_id: str, private_cloud_name: str, **kwargs: Any + def _delete_public_ip_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, public_ip_id: str, private_cloud_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5735,22 +4821,21 @@ def _delete_dns_service_initial( # pylint: disable=inconsistent-return-statemen 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_dns_service_request( + _request = build_delete_public_ip_request( resource_group_name=resource_group_name, - dns_service_id=dns_service_id, + public_ip_id=public_ip_id, private_cloud_name=private_cloud_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_dns_service_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -5760,37 +4845,27 @@ def _delete_dns_service_initial( # pylint: disable=inconsistent-return-statemen 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, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _delete_dns_service_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace - def begin_delete_dns_service( - self, resource_group_name: str, dns_service_id: str, private_cloud_name: str, **kwargs: Any + def begin_delete_public_ip( + self, resource_group_name: str, public_ip_id: str, private_cloud_name: str, **kwargs: Any ) -> LROPoller[None]: - """Delete a DNS service by id in a private cloud workload network. - - Delete a DNS service by id in a private cloud workload network. + """Delete a WorkloadNetworkPublicIP. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's - display name. Required. - :type dns_service_id: str + :param public_ip_id: ID of the DNS zone. Required. + :type public_ip_id: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_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: @@ -5804,9 +4879,9 @@ def begin_delete_dns_service( 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_dns_service_initial( # type: ignore + raw_result = self._delete_public_ip_initial( # type: ignore resource_group_name=resource_group_name, - dns_service_id=dns_service_id, + public_ip_id=public_ip_id, private_cloud_name=private_cloud_name, api_version=api_version, cls=lambda x, y, z: x, @@ -5818,53 +4893,48 @@ def begin_delete_dns_service( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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_dns_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_dns_zones( + def list_segments( self, resource_group_name: str, private_cloud_name: str, **kwargs: Any - ) -> Iterable["_models.WorkloadNetworkDnsZone"]: - """List of DNS zones in a private cloud workload network. - - List of DNS zones in a private cloud workload network. + ) -> Iterable["_models.WorkloadNetworkSegment"]: + """List WorkloadNetworkSegment resources by WorkloadNetwork. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadNetworkDnsZone or the result of + :return: An iterator like instance of either WorkloadNetworkSegment or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkSegment] :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.WorkloadNetworkDnsZonesList] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkSegmentsList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5875,17 +4945,16 @@ def list_dns_zones( def prepare_request(next_link=None): if not next_link: - request = build_list_dns_zones_request( + _request = build_list_segments_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_dns_zones.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -5897,27 +4966,27 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("WorkloadNetworkDnsZonesList", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkSegmentsList", 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) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -5930,32 +4999,24 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_dns_zones.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones" - } - @distributed_trace - def get_dns_zone( - self, resource_group_name: str, private_cloud_name: str, dns_zone_id: str, **kwargs: Any - ) -> _models.WorkloadNetworkDnsZone: - """Get a DNS zone by id in a private cloud workload network. - - Get a DNS zone by id in a private cloud workload network. + def get_segment( + self, resource_group_name: str, private_cloud_name: str, segment_id: str, **kwargs: Any + ) -> _models.WorkloadNetworkSegment: + """Get a WorkloadNetworkSegment. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. - Required. - :type dns_zone_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: WorkloadNetworkDnsZone or the result of cls(response) - :rtype: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone + :param segment_id: The ID of the NSX Segment. Required. + :type segment_id: str + :return: WorkloadNetworkSegment or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetworkSegment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5967,24 +5028,23 @@ def get_dns_zone( _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.WorkloadNetworkDnsZone] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkSegment] = kwargs.pop("cls", None) - request = build_get_dns_zone_request( + _request = build_get_segment_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - dns_zone_id=dns_zone_id, + segment_id=segment_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_dns_zone.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -5994,26 +5054,22 @@ def get_dns_zone( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_dns_zone.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}" - } + return deserialized # type: ignore - def _create_dns_zone_initial( + def _create_segments_initial( self, resource_group_name: str, private_cloud_name: str, - dns_zone_id: str, - workload_network_dns_zone: Union[_models.WorkloadNetworkDnsZone, IO], + segment_id: str, + workload_network_segment: Union[_models.WorkloadNetworkSegment, IO[bytes]], **kwargs: Any - ) -> _models.WorkloadNetworkDnsZone: - error_map = { + ) -> _models.WorkloadNetworkSegment: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6026,35 +5082,34 @@ def _create_dns_zone_initial( 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.WorkloadNetworkDnsZone] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkSegment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(workload_network_dns_zone, (IOBase, bytes)): - _content = workload_network_dns_zone + if isinstance(workload_network_segment, (IOBase, bytes)): + _content = workload_network_segment else: - _json = self._serialize.body(workload_network_dns_zone, "WorkloadNetworkDnsZone") + _json = self._serialize.body(workload_network_segment, "WorkloadNetworkSegment") - request = build_create_dns_zone_request( + _request = build_create_segments_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - dns_zone_id=dns_zone_id, + segment_id=segment_id, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_dns_zone_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -6064,143 +5119,106 @@ def _create_dns_zone_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_dns_zone_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}" - } - @overload - def begin_create_dns_zone( + def begin_create_segments( self, resource_group_name: str, private_cloud_name: str, - dns_zone_id: str, - workload_network_dns_zone: _models.WorkloadNetworkDnsZone, + segment_id: str, + workload_network_segment: _models.WorkloadNetworkSegment, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkDnsZone]: - """Create a DNS zone by id in a private cloud workload network. - - Create a DNS zone by id in a private cloud workload network. + ) -> LROPoller[_models.WorkloadNetworkSegment]: + """Create a WorkloadNetworkSegment. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. - Required. - :type dns_zone_id: str - :param workload_network_dns_zone: NSX DNS Zone. Required. - :type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone + :param segment_id: The ID of the NSX Segment. Required. + :type segment_id: str + :param workload_network_segment: Resource create parameters. Required. + :type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment :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 WorkloadNetworkDnsZone or the result of + :return: An instance of LROPoller that returns either WorkloadNetworkSegment or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_dns_zone( + def begin_create_segments( self, resource_group_name: str, private_cloud_name: str, - dns_zone_id: str, - workload_network_dns_zone: IO, + segment_id: str, + workload_network_segment: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkDnsZone]: - """Create a DNS zone by id in a private cloud workload network. - - Create a DNS zone by id in a private cloud workload network. + ) -> LROPoller[_models.WorkloadNetworkSegment]: + """Create a WorkloadNetworkSegment. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. - Required. - :type dns_zone_id: str - :param workload_network_dns_zone: NSX DNS Zone. Required. - :type workload_network_dns_zone: IO + :param segment_id: The ID of the NSX Segment. Required. + :type segment_id: str + :param workload_network_segment: Resource create parameters. Required. + :type workload_network_segment: IO[bytes] :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 WorkloadNetworkDnsZone or the result of + :return: An instance of LROPoller that returns either WorkloadNetworkSegment or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_dns_zone( + def begin_create_segments( self, resource_group_name: str, private_cloud_name: str, - dns_zone_id: str, - workload_network_dns_zone: Union[_models.WorkloadNetworkDnsZone, IO], + segment_id: str, + workload_network_segment: Union[_models.WorkloadNetworkSegment, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkDnsZone]: - """Create a DNS zone by id in a private cloud workload network. - - Create a DNS zone by id in a private cloud workload network. + ) -> LROPoller[_models.WorkloadNetworkSegment]: + """Create a WorkloadNetworkSegment. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. - Required. - :type dns_zone_id: str - :param workload_network_dns_zone: NSX DNS Zone. Is either a WorkloadNetworkDnsZone type or a IO - type. Required. - :type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone 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 WorkloadNetworkDnsZone or the result of + :param segment_id: The ID of the NSX Segment. Required. + :type segment_id: str + :param workload_network_segment: Resource create parameters. Is either a WorkloadNetworkSegment + type or a IO[bytes] type. Required. + :type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment or IO[bytes] + :return: An instance of LROPoller that returns either WorkloadNetworkSegment or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -6208,16 +5226,16 @@ def begin_create_dns_zone( 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.WorkloadNetworkDnsZone] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkSegment] = 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_dns_zone_initial( + raw_result = self._create_segments_initial( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - dns_zone_id=dns_zone_id, - workload_network_dns_zone=workload_network_dns_zone, + segment_id=segment_id, + workload_network_segment=workload_network_segment, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -6228,39 +5246,39 @@ def begin_create_dns_zone( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.WorkloadNetworkSegment].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_dns_zone.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}" - } + return LROPoller[_models.WorkloadNetworkSegment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _update_dns_zone_initial( + def _update_segments_initial( self, resource_group_name: str, private_cloud_name: str, - dns_zone_id: str, - workload_network_dns_zone: Union[_models.WorkloadNetworkDnsZone, IO], + segment_id: str, + workload_network_segment: Union[_models.WorkloadNetworkSegment, IO[bytes]], **kwargs: Any - ) -> Optional[_models.WorkloadNetworkDnsZone]: - error_map = { + ) -> Optional[_models.WorkloadNetworkSegment]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6273,35 +5291,34 @@ def _update_dns_zone_initial( 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.WorkloadNetworkDnsZone]] = kwargs.pop("cls", None) + cls: ClsType[Optional[_models.WorkloadNetworkSegment]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(workload_network_dns_zone, (IOBase, bytes)): - _content = workload_network_dns_zone + if isinstance(workload_network_segment, (IOBase, bytes)): + _content = workload_network_segment else: - _json = self._serialize.body(workload_network_dns_zone, "WorkloadNetworkDnsZone") + _json = self._serialize.body(workload_network_segment, "WorkloadNetworkSegment") - request = build_update_dns_zone_request( + _request = build_update_segments_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - dns_zone_id=dns_zone_id, + segment_id=segment_id, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._update_dns_zone_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -6312,140 +5329,105 @@ def _update_dns_zone_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - return deserialized + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _update_dns_zone_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}" - } + return deserialized # type: ignore @overload - def begin_update_dns_zone( + def begin_update_segments( self, resource_group_name: str, private_cloud_name: str, - dns_zone_id: str, - workload_network_dns_zone: _models.WorkloadNetworkDnsZone, + segment_id: str, + workload_network_segment: _models.WorkloadNetworkSegment, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkDnsZone]: - """Create or update a DNS zone by id in a private cloud workload network. - - Create or update a DNS zone by id in a private cloud workload network. + ) -> LROPoller[_models.WorkloadNetworkSegment]: + """Update a WorkloadNetworkSegment. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. - Required. - :type dns_zone_id: str - :param workload_network_dns_zone: NSX DNS Zone. Required. - :type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone + :param segment_id: The ID of the NSX Segment. Required. + :type segment_id: str + :param workload_network_segment: The resource properties to be updated. Required. + :type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment :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 WorkloadNetworkDnsZone or the result of + :return: An instance of LROPoller that returns either WorkloadNetworkSegment or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update_dns_zone( + def begin_update_segments( self, resource_group_name: str, private_cloud_name: str, - dns_zone_id: str, - workload_network_dns_zone: IO, + segment_id: str, + workload_network_segment: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkDnsZone]: - """Create or update a DNS zone by id in a private cloud workload network. - - Create or update a DNS zone by id in a private cloud workload network. + ) -> LROPoller[_models.WorkloadNetworkSegment]: + """Update a WorkloadNetworkSegment. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. - :type private_cloud_name: str - :param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. - Required. - :type dns_zone_id: str - :param workload_network_dns_zone: NSX DNS Zone. Required. - :type workload_network_dns_zone: IO + :type private_cloud_name: str + :param segment_id: The ID of the NSX Segment. Required. + :type segment_id: str + :param workload_network_segment: The resource properties to be updated. Required. + :type workload_network_segment: IO[bytes] :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 WorkloadNetworkDnsZone or the result of + :return: An instance of LROPoller that returns either WorkloadNetworkSegment or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_update_dns_zone( + def begin_update_segments( self, resource_group_name: str, private_cloud_name: str, - dns_zone_id: str, - workload_network_dns_zone: Union[_models.WorkloadNetworkDnsZone, IO], + segment_id: str, + workload_network_segment: Union[_models.WorkloadNetworkSegment, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkDnsZone]: - """Create or update a DNS zone by id in a private cloud workload network. - - Create or update a DNS zone by id in a private cloud workload network. + ) -> LROPoller[_models.WorkloadNetworkSegment]: + """Update a WorkloadNetworkSegment. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. - Required. - :type dns_zone_id: str - :param workload_network_dns_zone: NSX DNS Zone. Is either a WorkloadNetworkDnsZone type or a IO - type. Required. - :type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone 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 WorkloadNetworkDnsZone or the result of + :param segment_id: The ID of the NSX Segment. Required. + :type segment_id: str + :param workload_network_segment: The resource properties to be updated. Is either a + WorkloadNetworkSegment type or a IO[bytes] type. Required. + :type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment or IO[bytes] + :return: An instance of LROPoller that returns either WorkloadNetworkSegment or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -6453,16 +5435,16 @@ def begin_update_dns_zone( 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.WorkloadNetworkDnsZone] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkSegment] = 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_dns_zone_initial( + raw_result = self._update_segments_initial( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - dns_zone_id=dns_zone_id, - workload_network_dns_zone=workload_network_dns_zone, + segment_id=segment_id, + workload_network_segment=workload_network_segment, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -6473,34 +5455,34 @@ def begin_update_dns_zone( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.WorkloadNetworkSegment].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_dns_zone.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}" - } + return LROPoller[_models.WorkloadNetworkSegment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_dns_zone_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, dns_zone_id: str, private_cloud_name: str, **kwargs: Any + def _delete_segment_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, private_cloud_name: str, segment_id: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6514,22 +5496,21 @@ def _delete_dns_zone_initial( # pylint: disable=inconsistent-return-statements 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_dns_zone_request( + _request = build_delete_segment_request( resource_group_name=resource_group_name, - dns_zone_id=dns_zone_id, private_cloud_name=private_cloud_name, + segment_id=segment_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_dns_zone_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -6539,37 +5520,27 @@ def _delete_dns_zone_initial( # pylint: disable=inconsistent-return-statements 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, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _delete_dns_zone_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace - def begin_delete_dns_zone( - self, resource_group_name: str, dns_zone_id: str, private_cloud_name: str, **kwargs: Any + def begin_delete_segment( + self, resource_group_name: str, private_cloud_name: str, segment_id: str, **kwargs: Any ) -> LROPoller[None]: - """Delete a DNS zone by id in a private cloud workload network. - - Delete a DNS zone by id in a private cloud workload network. + """Delete a WorkloadNetworkSegment. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. - Required. - :type dns_zone_id: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_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. + :param segment_id: The ID of the NSX Segment. Required. + :type segment_id: str :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: @@ -6583,10 +5554,10 @@ def begin_delete_dns_zone( 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_dns_zone_initial( # type: ignore + raw_result = self._delete_segment_initial( # type: ignore resource_group_name=resource_group_name, - dns_zone_id=dns_zone_id, private_cloud_name=private_cloud_name, + segment_id=segment_id, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -6597,53 +5568,48 @@ def begin_delete_dns_zone( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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_dns_zone.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_public_i_ps( + def list_virtual_machines( self, resource_group_name: str, private_cloud_name: str, **kwargs: Any - ) -> Iterable["_models.WorkloadNetworkPublicIP"]: - """List of Public IP Blocks in a private cloud workload network. - - List of Public IP Blocks in a private cloud workload network. + ) -> Iterable["_models.WorkloadNetworkVirtualMachine"]: + """List WorkloadNetworkVirtualMachine resources by WorkloadNetwork. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadNetworkPublicIP or the result of + :return: An iterator like instance of either WorkloadNetworkVirtualMachine or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkPublicIP] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkVirtualMachine] :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.WorkloadNetworkPublicIPsList] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkVirtualMachinesList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6654,17 +5620,16 @@ def list_public_i_ps( def prepare_request(next_link=None): if not next_link: - request = build_list_public_i_ps_request( + _request = build_list_virtual_machines_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_public_i_ps.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -6676,27 +5641,27 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("WorkloadNetworkPublicIPsList", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkVirtualMachinesList", 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) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -6709,32 +5674,226 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_public_i_ps.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs" - } + @distributed_trace + def get_virtual_machine( + self, resource_group_name: str, private_cloud_name: str, virtual_machine_id: str, **kwargs: Any + ) -> _models.WorkloadNetworkVirtualMachine: + """Get a WorkloadNetworkVirtualMachine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. Required. + :type private_cloud_name: str + :param virtual_machine_id: ID of the virtual machine. Required. + :type virtual_machine_id: str + :return: WorkloadNetworkVirtualMachine or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetworkVirtualMachine + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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.WorkloadNetworkVirtualMachine] = kwargs.pop("cls", None) + + _request = build_get_virtual_machine_request( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + virtual_machine_id=virtual_machine_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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("WorkloadNetworkVirtualMachine", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace - def get_public_ip( - self, resource_group_name: str, private_cloud_name: str, public_ip_id: str, **kwargs: Any - ) -> _models.WorkloadNetworkPublicIP: - """Get a Public IP Block by id in a private cloud workload network. + def list_vm_groups( + self, resource_group_name: str, private_cloud_name: str, **kwargs: Any + ) -> Iterable["_models.WorkloadNetworkVMGroup"]: + """List WorkloadNetworkVMGroup resources by WorkloadNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. Required. + :type private_cloud_name: str + :return: An iterator like instance of either WorkloadNetworkVMGroup or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] + :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.WorkloadNetworkVMGroupsList] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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_vm_groups_request( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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("WorkloadNetworkVMGroupsList", 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) - Get a Public IP Block by id in a private cloud workload network. + @distributed_trace + def get_vm_group( + self, resource_group_name: str, private_cloud_name: str, vm_group_id: str, **kwargs: Any + ) -> _models.WorkloadNetworkVMGroup: + """Get a WorkloadNetworkVMGroup. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param public_ip_id: NSX Public IP Block identifier. Generally the same as the Public IP - Block's display name. Required. - :type public_ip_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: WorkloadNetworkPublicIP or the result of cls(response) - :rtype: ~azure.mgmt.avs.models.WorkloadNetworkPublicIP + :param vm_group_id: ID of the VM group. Required. + :type vm_group_id: str + :return: WorkloadNetworkVMGroup or the result of cls(response) + :rtype: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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.WorkloadNetworkVMGroup] = kwargs.pop("cls", None) + + _request = build_get_vm_group_request( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + vm_group_id=vm_group_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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("WorkloadNetworkVMGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_vm_group_initial( + self, + resource_group_name: str, + private_cloud_name: str, + vm_group_id: str, + workload_network_vm_group: Union[_models.WorkloadNetworkVMGroup, IO[bytes]], + **kwargs: Any + ) -> _models.WorkloadNetworkVMGroup: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6742,57 +5901,208 @@ def get_public_ip( } 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkloadNetworkPublicIP] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WorkloadNetworkVMGroup] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workload_network_vm_group, (IOBase, bytes)): + _content = workload_network_vm_group + else: + _json = self._serialize.body(workload_network_vm_group, "WorkloadNetworkVMGroup") - request = build_get_public_ip_request( + _request = build_create_vm_group_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - public_ip_id=public_ip_id, + vm_group_id=vm_group_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_public_ip.metadata["url"], + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) - deserialized = self._deserialize("WorkloadNetworkPublicIP", pipeline_response) + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore - return deserialized + @overload + def begin_create_vm_group( + self, + resource_group_name: str, + private_cloud_name: str, + vm_group_id: str, + workload_network_vm_group: _models.WorkloadNetworkVMGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.WorkloadNetworkVMGroup]: + """Create a WorkloadNetworkVMGroup. - get_public_ip.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}" - } + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. Required. + :type private_cloud_name: str + :param vm_group_id: ID of the VM group. Required. + :type vm_group_id: str + :param workload_network_vm_group: Resource create parameters. Required. + :type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either WorkloadNetworkVMGroup or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ - def _create_public_ip_initial( + @overload + def begin_create_vm_group( self, resource_group_name: str, private_cloud_name: str, - public_ip_id: str, - workload_network_public_ip: Union[_models.WorkloadNetworkPublicIP, IO], + vm_group_id: str, + workload_network_vm_group: IO[bytes], + *, + content_type: str = "application/json", **kwargs: Any - ) -> _models.WorkloadNetworkPublicIP: - error_map = { + ) -> LROPoller[_models.WorkloadNetworkVMGroup]: + """Create a WorkloadNetworkVMGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. Required. + :type private_cloud_name: str + :param vm_group_id: ID of the VM group. Required. + :type vm_group_id: str + :param workload_network_vm_group: Resource create parameters. Required. + :type workload_network_vm_group: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either WorkloadNetworkVMGroup or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_vm_group( + self, + resource_group_name: str, + private_cloud_name: str, + vm_group_id: str, + workload_network_vm_group: Union[_models.WorkloadNetworkVMGroup, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.WorkloadNetworkVMGroup]: + """Create a WorkloadNetworkVMGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param private_cloud_name: Name of the private cloud. Required. + :type private_cloud_name: str + :param vm_group_id: ID of the VM group. Required. + :type vm_group_id: str + :param workload_network_vm_group: Resource create parameters. Is either a + WorkloadNetworkVMGroup type or a IO[bytes] type. Required. + :type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup or IO[bytes] + :return: An instance of LROPoller that returns either WorkloadNetworkVMGroup or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] + :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.WorkloadNetworkVMGroup] = 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_vm_group_initial( + resource_group_name=resource_group_name, + private_cloud_name=private_cloud_name, + vm_group_id=vm_group_id, + workload_network_vm_group=workload_network_vm_group, + 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("WorkloadNetworkVMGroup", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.WorkloadNetworkVMGroup].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.WorkloadNetworkVMGroup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_vm_group_initial( + self, + resource_group_name: str, + private_cloud_name: str, + vm_group_id: str, + workload_network_vm_group: Union[_models.WorkloadNetworkVMGroup, IO[bytes]], + **kwargs: Any + ) -> Optional[_models.WorkloadNetworkVMGroup]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6805,181 +6115,143 @@ def _create_public_ip_initial( 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.WorkloadNetworkPublicIP] = kwargs.pop("cls", None) + cls: ClsType[Optional[_models.WorkloadNetworkVMGroup]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(workload_network_public_ip, (IOBase, bytes)): - _content = workload_network_public_ip + if isinstance(workload_network_vm_group, (IOBase, bytes)): + _content = workload_network_vm_group else: - _json = self._serialize.body(workload_network_public_ip, "WorkloadNetworkPublicIP") + _json = self._serialize.body(workload_network_vm_group, "WorkloadNetworkVMGroup") - request = build_create_public_ip_request( + _request = build_update_vm_group_request( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - public_ip_id=public_ip_id, + vm_group_id=vm_group_id, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_public_ip_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _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("WorkloadNetworkPublicIP", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response) - if response.status_code == 201: - deserialized = self._deserialize("WorkloadNetworkPublicIP", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_public_ip_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}" - } - @overload - def begin_create_public_ip( + def begin_update_vm_group( self, resource_group_name: str, private_cloud_name: str, - public_ip_id: str, - workload_network_public_ip: _models.WorkloadNetworkPublicIP, + vm_group_id: str, + workload_network_vm_group: _models.WorkloadNetworkVMGroup, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkPublicIP]: - """Create a Public IP Block by id in a private cloud workload network. - - Create a Public IP Block by id in a private cloud workload network. + ) -> LROPoller[_models.WorkloadNetworkVMGroup]: + """Update a WorkloadNetworkVMGroup. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param public_ip_id: NSX Public IP Block identifier. Generally the same as the Public IP - Block's display name. Required. - :type public_ip_id: str - :param workload_network_public_ip: NSX Public IP Block. Required. - :type workload_network_public_ip: ~azure.mgmt.avs.models.WorkloadNetworkPublicIP + :param vm_group_id: ID of the VM group. Required. + :type vm_group_id: str + :param workload_network_vm_group: The resource properties to be updated. Required. + :type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup :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 WorkloadNetworkPublicIP or the result of + :return: An instance of LROPoller that returns either WorkloadNetworkVMGroup or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPublicIP] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_public_ip( + def begin_update_vm_group( self, resource_group_name: str, private_cloud_name: str, - public_ip_id: str, - workload_network_public_ip: IO, + vm_group_id: str, + workload_network_vm_group: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkPublicIP]: - """Create a Public IP Block by id in a private cloud workload network. - - Create a Public IP Block by id in a private cloud workload network. + ) -> LROPoller[_models.WorkloadNetworkVMGroup]: + """Update a WorkloadNetworkVMGroup. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param public_ip_id: NSX Public IP Block identifier. Generally the same as the Public IP - Block's display name. Required. - :type public_ip_id: str - :param workload_network_public_ip: NSX Public IP Block. Required. - :type workload_network_public_ip: IO + :param vm_group_id: ID of the VM group. Required. + :type vm_group_id: str + :param workload_network_vm_group: The resource properties to be updated. Required. + :type workload_network_vm_group: IO[bytes] :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 WorkloadNetworkPublicIP or the result of + :return: An instance of LROPoller that returns either WorkloadNetworkVMGroup or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPublicIP] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_public_ip( + def begin_update_vm_group( self, resource_group_name: str, private_cloud_name: str, - public_ip_id: str, - workload_network_public_ip: Union[_models.WorkloadNetworkPublicIP, IO], + vm_group_id: str, + workload_network_vm_group: Union[_models.WorkloadNetworkVMGroup, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.WorkloadNetworkPublicIP]: - """Create a Public IP Block by id in a private cloud workload network. - - Create a Public IP Block by id in a private cloud workload network. + ) -> LROPoller[_models.WorkloadNetworkVMGroup]: + """Update a WorkloadNetworkVMGroup. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_name: str - :param public_ip_id: NSX Public IP Block identifier. Generally the same as the Public IP - Block's display name. Required. - :type public_ip_id: str - :param workload_network_public_ip: NSX Public IP Block. Is either a WorkloadNetworkPublicIP - type or a IO type. Required. - :type workload_network_public_ip: ~azure.mgmt.avs.models.WorkloadNetworkPublicIP 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 WorkloadNetworkPublicIP or the result of + :param vm_group_id: ID of the VM group. Required. + :type vm_group_id: str + :param workload_network_vm_group: The resource properties to be updated. Is either a + WorkloadNetworkVMGroup type or a IO[bytes] type. Required. + :type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup or IO[bytes] + :return: An instance of LROPoller that returns either WorkloadNetworkVMGroup or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPublicIP] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -6987,16 +6259,16 @@ def begin_create_public_ip( 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.WorkloadNetworkPublicIP] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkloadNetworkVMGroup] = 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_public_ip_initial( + raw_result = self._update_vm_group_initial( resource_group_name=resource_group_name, private_cloud_name=private_cloud_name, - public_ip_id=public_ip_id, - workload_network_public_ip=workload_network_public_ip, + vm_group_id=vm_group_id, + workload_network_vm_group=workload_network_vm_group, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -7007,34 +6279,34 @@ def begin_create_public_ip( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkloadNetworkPublicIP", pipeline_response) + deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.WorkloadNetworkVMGroup].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_public_ip.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}" - } + return LROPoller[_models.WorkloadNetworkVMGroup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_public_ip_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, public_ip_id: str, private_cloud_name: str, **kwargs: Any + def _delete_vm_group_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, vm_group_id: str, private_cloud_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7048,22 +6320,21 @@ def _delete_public_ip_initial( # pylint: disable=inconsistent-return-statements 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_public_ip_request( + _request = build_delete_vm_group_request( resource_group_name=resource_group_name, - public_ip_id=public_ip_id, + vm_group_id=vm_group_id, private_cloud_name=private_cloud_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_public_ip_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -7073,37 +6344,27 @@ def _delete_public_ip_initial( # pylint: disable=inconsistent-return-statements 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, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _delete_public_ip_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}" - } + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace - def begin_delete_public_ip( - self, resource_group_name: str, public_ip_id: str, private_cloud_name: str, **kwargs: Any + def begin_delete_vm_group( + self, resource_group_name: str, vm_group_id: str, private_cloud_name: str, **kwargs: Any ) -> LROPoller[None]: - """Delete a Public IP Block by id in a private cloud workload network. - - Delete a Public IP Block by id in a private cloud workload network. + """Delete a WorkloadNetworkVMGroup. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param public_ip_id: NSX Public IP Block identifier. Generally the same as the Public IP - Block's display name. Required. - :type public_ip_id: str + :param vm_group_id: ID of the VM group. Required. + :type vm_group_id: str :param private_cloud_name: Name of the private cloud. Required. :type private_cloud_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: @@ -7117,9 +6378,9 @@ def begin_delete_public_ip( 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_public_ip_initial( # type: ignore + raw_result = self._delete_vm_group_initial( # type: ignore resource_group_name=resource_group_name, - public_ip_id=public_ip_id, + vm_group_id=vm_group_id, private_cloud_name=private_cloud_name, api_version=api_version, cls=lambda x, y, z: x, @@ -7131,23 +6392,21 @@ def begin_delete_public_ip( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore 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": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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_public_ip.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/addons_create_or_update_arc_reg.py b/sdk/compute/azure-mgmt-avs/generated_samples/addons_create_or_update_arc_reg.py index 3f9a9dae8f25..ffc3efaae7be 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/addons_create_or_update_arc_reg.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/addons_create_or_update_arc_reg.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -43,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/Addons_CreateOrUpdate_ArcReg.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Addons_CreateOrUpdate_ArcReg.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/addons_create_or_update_hcx.py b/sdk/compute/azure-mgmt-avs/generated_samples/addons_create_or_update_hcx.py index a5b3efa36e7b..fcd80a778728 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/addons_create_or_update_hcx.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/addons_create_or_update_hcx.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -38,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/Addons_CreateOrUpdate_HCX.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Addons_CreateOrUpdate_HCX.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/addons_create_or_update_srm.py b/sdk/compute/azure-mgmt-avs/generated_samples/addons_create_or_update_srm.py index cd4d7867a856..0c571793837d 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/addons_create_or_update_srm.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/addons_create_or_update_srm.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -38,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/Addons_CreateOrUpdate_SRM.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Addons_CreateOrUpdate_SRM.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/addons_create_or_update_vr.py b/sdk/compute/azure-mgmt-avs/generated_samples/addons_create_or_update_vr.py index dad255dffa65..ce8b338cf2f6 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/addons_create_or_update_vr.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/addons_create_or_update_vr.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -38,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/Addons_CreateOrUpdate_VR.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Addons_CreateOrUpdate_VR.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/addons_delete.py b/sdk/compute/azure-mgmt-avs/generated_samples/addons_delete.py index 7ffff0eabeb3..ac6352d6e4e0 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/addons_delete.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/addons_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/Addons_Delete.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Addons_Delete.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/addons_get_arc_reg.py b/sdk/compute/azure-mgmt-avs/generated_samples/addons_get_arc_reg.py index 71fbac432c15..857fb47879fe 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/addons_get_arc_reg.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/addons_get_arc_reg.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/Addons_Get_ArcReg.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Addons_Get_ArcReg.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/addons_get_hcx.py b/sdk/compute/azure-mgmt-avs/generated_samples/addons_get_hcx.py index 98d89aeb1a48..1a2caa60d8e8 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/addons_get_hcx.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/addons_get_hcx.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/Addons_Get_HCX.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Addons_Get_HCX.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/addons_get_srm.py b/sdk/compute/azure-mgmt-avs/generated_samples/addons_get_srm.py index bfda9f69266e..45f9129f4f3f 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/addons_get_srm.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/addons_get_srm.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/Addons_Get_SRM.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Addons_Get_SRM.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/addons_get_vr.py b/sdk/compute/azure-mgmt-avs/generated_samples/addons_get_vr.py index a151b43acb11..b64dcfa110e5 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/addons_get_vr.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/addons_get_vr.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/Addons_Get_VR.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Addons_Get_VR.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/addons_list.py b/sdk/compute/azure-mgmt-avs/generated_samples/addons_list.py index eea6094762dd..3a24576d2f3f 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/addons_list.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/addons_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/Addons_List.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Addons_List.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/authorizations_delete.py b/sdk/compute/azure-mgmt-avs/generated_samples/authorizations_delete.py index 583598a6514c..2afba9f258d4 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/authorizations_delete.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/authorizations_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/Authorizations_Delete.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Authorizations_Delete.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/authorizations_get.py b/sdk/compute/azure-mgmt-avs/generated_samples/authorizations_get.py index f1ac08eb888c..bda55f39ffa2 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/authorizations_get.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/authorizations_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/Authorizations_Get.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Authorizations_Get.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/authorizations_list.py b/sdk/compute/azure-mgmt-avs/generated_samples/authorizations_list.py index 1fb518c92152..a7ac0bf9c235 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/authorizations_list.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/authorizations_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/Authorizations_List.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Authorizations_List.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/cloud_links_create_or_update.py b/sdk/compute/azure-mgmt-avs/generated_samples/cloud_links_create_or_update.py index 8f7987fce884..8e4635d2342c 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/cloud_links_create_or_update.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/cloud_links_create_or_update.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -42,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/CloudLinks_CreateOrUpdate.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/CloudLinks_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/cloud_links_delete.py b/sdk/compute/azure-mgmt-avs/generated_samples/cloud_links_delete.py index 28a16d80be2f..2d93ee6791df 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/cloud_links_delete.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/cloud_links_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/CloudLinks_Delete.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/CloudLinks_Delete.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/cloud_links_get.py b/sdk/compute/azure-mgmt-avs/generated_samples/cloud_links_get.py index 2a5d24083fd3..d31a83acfe62 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/cloud_links_get.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/cloud_links_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/CloudLinks_Get.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/CloudLinks_Get.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/cloud_links_list.py b/sdk/compute/azure-mgmt-avs/generated_samples/cloud_links_list.py index e5f1a46deed4..66b67b12123f 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/cloud_links_list.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/cloud_links_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/CloudLinks_List.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/CloudLinks_List.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/clusters_create_or_update.py b/sdk/compute/azure-mgmt-avs/generated_samples/clusters_create_or_update.py index 121e47d60426..1f4e9368f2a7 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/clusters_create_or_update.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/clusters_create_or_update.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -38,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/Clusters_CreateOrUpdate.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Clusters_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/clusters_delete.py b/sdk/compute/azure-mgmt-avs/generated_samples/clusters_delete.py index d93c34a7aa5b..d879e70a5844 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/clusters_delete.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/clusters_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/Clusters_Delete.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Clusters_Delete.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/clusters_get.py b/sdk/compute/azure-mgmt-avs/generated_samples/clusters_get.py index 2f615c9ee17f..5400b820788f 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/clusters_get.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/clusters_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/Clusters_Get.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Clusters_Get.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/clusters_list.py b/sdk/compute/azure-mgmt-avs/generated_samples/clusters_list.py index befc375cd66d..fb2e42b85713 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/clusters_list.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/clusters_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/Clusters_List.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Clusters_List.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/clusters_list_zones.py b/sdk/compute/azure-mgmt-avs/generated_samples/clusters_list_zones.py index 1cbdc61e74e1..fff714096b8c 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/clusters_list_zones.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/clusters_list_zones.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/Clusters_ListZones.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Clusters_ListZones.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/clusters_list_zones_stretched.py b/sdk/compute/azure-mgmt-avs/generated_samples/clusters_list_zones_stretched.py index d2310f861b44..bc91085d488c 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/clusters_list_zones_stretched.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/clusters_list_zones_stretched.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/Clusters_ListZones_Stretched.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Clusters_ListZones_Stretched.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/clusters_update.py b/sdk/compute/azure-mgmt-avs/generated_samples/clusters_update.py index fa0a1af04342..482fd8fa59a2 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/clusters_update.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/clusters_update.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -38,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/Clusters_Update.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Clusters_Update.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/datastores_create_or_update.py b/sdk/compute/azure-mgmt-avs/generated_samples/datastores_create_or_update.py index 9fa167c87668..2668fa653dd5 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/datastores_create_or_update.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/datastores_create_or_update.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -45,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/Datastores_CreateOrUpdate.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Datastores_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/datastores_delete.py b/sdk/compute/azure-mgmt-avs/generated_samples/datastores_delete.py index 522e25448fb8..dc8ce46d5094 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/datastores_delete.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/datastores_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -37,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/Datastores_Delete.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Datastores_Delete.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/datastores_get.py b/sdk/compute/azure-mgmt-avs/generated_samples/datastores_get.py index 58180a226483..9f5a4ad104a8 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/datastores_get.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/datastores_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/Datastores_Get.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Datastores_Get.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/datastores_list.py b/sdk/compute/azure-mgmt-avs/generated_samples/datastores_list.py index 70195e098e9b..f40c368a6056 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/datastores_list.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/datastores_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/Datastores_List.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Datastores_List.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/global_reach_connections_create_or_update.py b/sdk/compute/azure-mgmt-avs/generated_samples/global_reach_connections_create_or_update.py index e9690072c9c8..05323a3d0506 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/global_reach_connections_create_or_update.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/global_reach_connections_create_or_update.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -43,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/GlobalReachConnections_CreateOrUpdate.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/GlobalReachConnections_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/global_reach_connections_delete.py b/sdk/compute/azure-mgmt-avs/generated_samples/global_reach_connections_delete.py index ad04cecf90ce..1ad1ebd41a64 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/global_reach_connections_delete.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/global_reach_connections_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/GlobalReachConnections_Delete.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/GlobalReachConnections_Delete.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/global_reach_connections_get.py b/sdk/compute/azure-mgmt-avs/generated_samples/global_reach_connections_get.py index a2639a316106..cce06dd7ba8f 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/global_reach_connections_get.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/global_reach_connections_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/GlobalReachConnections_Get.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/GlobalReachConnections_Get.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/global_reach_connections_list.py b/sdk/compute/azure-mgmt-avs/generated_samples/global_reach_connections_list.py index 7d9a3af24bb0..008d2fd9f070 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/global_reach_connections_list.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/global_reach_connections_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/GlobalReachConnections_List.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/GlobalReachConnections_List.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/hcx_enterprise_sites_delete.py b/sdk/compute/azure-mgmt-avs/generated_samples/hcx_enterprise_sites_delete.py index 77e55eac556b..dad47ce9ef2b 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/hcx_enterprise_sites_delete.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/hcx_enterprise_sites_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/HcxEnterpriseSites_Delete.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/HcxEnterpriseSites_Delete.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/hcx_enterprise_sites_get.py b/sdk/compute/azure-mgmt-avs/generated_samples/hcx_enterprise_sites_get.py index 2b2c0c790ab2..5c2521db3ebe 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/hcx_enterprise_sites_get.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/hcx_enterprise_sites_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/HcxEnterpriseSites_Get.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/HcxEnterpriseSites_Get.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/hcx_enterprise_sites_list.py b/sdk/compute/azure-mgmt-avs/generated_samples/hcx_enterprise_sites_list.py index b9f2d84f9d11..e83389722194 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/hcx_enterprise_sites_list.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/hcx_enterprise_sites_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/HcxEnterpriseSites_List.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/HcxEnterpriseSites_List.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/iscsi_paths_create_or_update.py b/sdk/compute/azure-mgmt-avs/generated_samples/iscsi_paths_create_or_update.py new file mode 100644 index 000000000000..6b4def2a0fcd --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/generated_samples/iscsi_paths_create_or_update.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.avs import AVSClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-avs +# USAGE + python iscsi_paths_create_or_update.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 = AVSClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.iscsi_paths.begin_create_or_update( + resource_group_name="group1", + private_cloud_name="cloud1", + resource={"properties": {"networkBlock": "192.168.0.0/24"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/IscsiPaths_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/iscsi_paths_delete.py b/sdk/compute/azure-mgmt-avs/generated_samples/iscsi_paths_delete.py new file mode 100644 index 000000000000..7407743aa846 --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/generated_samples/iscsi_paths_delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.avs import AVSClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-avs +# USAGE + python iscsi_paths_delete.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 = AVSClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.iscsi_paths.begin_delete( + resource_group_name="group1", + private_cloud_name="cloud1", + ).result() + + +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/IscsiPaths_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/iscsi_paths_get.py b/sdk/compute/azure-mgmt-avs/generated_samples/iscsi_paths_get.py new file mode 100644 index 000000000000..7a94cc469b2f --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/generated_samples/iscsi_paths_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.avs import AVSClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-avs +# USAGE + python iscsi_paths_get.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 = AVSClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.iscsi_paths.get( + resource_group_name="group1", + private_cloud_name="cloud1", + ) + print(response) + + +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/IscsiPaths_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/iscsi_paths_list.py b/sdk/compute/azure-mgmt-avs/generated_samples/iscsi_paths_list.py new file mode 100644 index 000000000000..275e70f8f38e --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/generated_samples/iscsi_paths_list.py @@ -0,0 +1,43 @@ +# 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.avs import AVSClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-avs +# USAGE + python iscsi_paths_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, + 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 = AVSClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.iscsi_paths.list_by_private_cloud( + resource_group_name="group1", + private_cloud_name="cloud1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/IscsiPaths_List.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/locations_check_quota_availability.py b/sdk/compute/azure-mgmt-avs/generated_samples/locations_check_quota_availability.py index 8f495af97d4f..9d9b0cd0bd93 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/locations_check_quota_availability.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/locations_check_quota_availability.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/Locations_CheckQuotaAvailability.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Locations_CheckQuotaAvailability.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/locations_check_trial_availability.py b/sdk/compute/azure-mgmt-avs/generated_samples/locations_check_trial_availability.py index 18fee98caa3d..9acbb0b2cd3a 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/locations_check_trial_availability.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/locations_check_trial_availability.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/Locations_CheckTrialAvailability.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Locations_CheckTrialAvailability.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/locations_check_trial_availability_with_sku.py b/sdk/compute/azure-mgmt-avs/generated_samples/locations_check_trial_availability_with_sku.py index 3dd1f0430730..fc84afd5e87e 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/locations_check_trial_availability_with_sku.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/locations_check_trial_availability_with_sku.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/Locations_CheckTrialAvailabilityWithSku.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Locations_CheckTrialAvailabilityWithSku.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/operations_list.py b/sdk/compute/azure-mgmt-avs/generated_samples/operations_list.py index 9814ccd278ae..6f835266f01c 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/operations_list.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/operations_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/Operations_List.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/placement_policies_create_or_update.py b/sdk/compute/azure-mgmt-avs/generated_samples/placement_policies_create_or_update.py index 18ba649d6aeb..2fc00f132a39 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/placement_policies_create_or_update.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/placement_policies_create_or_update.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -55,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/PlacementPolicies_CreateOrUpdate.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PlacementPolicies_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/placement_policies_delete.py b/sdk/compute/azure-mgmt-avs/generated_samples/placement_policies_delete.py index 222427577cbe..52f65e7ad9da 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/placement_policies_delete.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/placement_policies_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -37,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/PlacementPolicies_Delete.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PlacementPolicies_Delete.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/placement_policies_get.py b/sdk/compute/azure-mgmt-avs/generated_samples/placement_policies_get.py index 5f958fa4eed2..3f54bf9f827e 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/placement_policies_get.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/placement_policies_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/PlacementPolicies_Get.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PlacementPolicies_Get.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/placement_policies_list.py b/sdk/compute/azure-mgmt-avs/generated_samples/placement_policies_list.py index 339327280b50..3763cd3afd0e 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/placement_policies_list.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/placement_policies_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/PlacementPolicies_List.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PlacementPolicies_List.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/placement_policies_update.py b/sdk/compute/azure-mgmt-avs/generated_samples/placement_policies_update.py index 285880596e5b..98b2ff21126e 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/placement_policies_update.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/placement_policies_update.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -54,6 +57,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/PlacementPolicies_Update.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PlacementPolicies_Update.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_create_or_update.py b/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_create_or_update.py index 20dd3c7a1761..4925f335767e 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_create_or_update.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_create_or_update.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -43,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/PrivateClouds_CreateOrUpdate.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PrivateClouds_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_create_or_update_stretched.py b/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_create_or_update_stretched.py index e3d66ec9cdad..5dfce1e5ab4e 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_create_or_update_stretched.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_create_or_update_stretched.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -46,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/PrivateClouds_CreateOrUpdate_Stretched.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PrivateClouds_CreateOrUpdate_Stretched.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_delete.py b/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_delete.py index 64bcf10bd1e4..c8e817ad1e4e 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_delete.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/PrivateClouds_Delete.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PrivateClouds_Delete.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_get.py b/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_get.py index 5c4756c3ca13..ae29418cbe38 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_get.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/PrivateClouds_Get.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PrivateClouds_Get.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_get_stretched.py b/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_get_stretched.py index d5e74608fcf4..22229ae328eb 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_get_stretched.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_get_stretched.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/PrivateClouds_Get_Stretched.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PrivateClouds_Get_Stretched.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_list.py b/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_list.py index 1742d81a3def..ca6e24707bf1 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_list.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/PrivateClouds_List.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PrivateClouds_List.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_list_admin_credentials.py b/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_list_admin_credentials.py index c73f573f9420..4916d5a5c4b2 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_list_admin_credentials.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_list_admin_credentials.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/PrivateClouds_ListAdminCredentials.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PrivateClouds_ListAdminCredentials.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_list_in_subscription.py b/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_list_in_subscription.py index 329f5550247b..a1bbefb09ad8 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_list_in_subscription.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_list_in_subscription.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/PrivateClouds_ListInSubscription.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PrivateClouds_ListInSubscription.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_list_in_subscription_stretched.py b/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_list_in_subscription_stretched.py index 959b9247b337..9f4e2328bcbc 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_list_in_subscription_stretched.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_list_in_subscription_stretched.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/PrivateClouds_ListInSubscription_Stretched.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PrivateClouds_ListInSubscription_Stretched.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_list_stretched.py b/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_list_stretched.py index 018e9bb4c740..df7a72efc90c 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_list_stretched.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_list_stretched.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/PrivateClouds_List_Stretched.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PrivateClouds_List_Stretched.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_rotate_nsxt_password.py b/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_rotate_nsxt_password.py index 8e5a0130bcc3..23c3490ac9c4 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_rotate_nsxt_password.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_rotate_nsxt_password.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/PrivateClouds_RotateNsxtPassword.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PrivateClouds_RotateNsxtPassword.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_rotate_vcenter_password.py b/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_rotate_vcenter_password.py index c0e85efaa0ca..963c90bb5e01 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_rotate_vcenter_password.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_rotate_vcenter_password.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/PrivateClouds_RotateVcenterPassword.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PrivateClouds_RotateVcenterPassword.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_update.py b/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_update.py index 34fe1acfa655..f90ee5bb3dfd 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_update.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_update.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -50,6 +53,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/PrivateClouds_Update.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PrivateClouds_Update.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_update_stretched.py b/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_update_stretched.py index d26f07fafe35..47647e0fce88 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_update_stretched.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/private_clouds_update_stretched.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -37,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/PrivateClouds_Update_Stretched.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PrivateClouds_Update_Stretched.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/script_cmdlets_get.py b/sdk/compute/azure-mgmt-avs/generated_samples/script_cmdlets_get.py index 87fd60f87eb1..2419d800ee75 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/script_cmdlets_get.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/script_cmdlets_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/ScriptCmdlets_Get.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptCmdlets_Get.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/script_cmdlets_list.py b/sdk/compute/azure-mgmt-avs/generated_samples/script_cmdlets_list.py index 2647a8ad06d4..33f12411b4ff 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/script_cmdlets_list.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/script_cmdlets_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/ScriptCmdlets_List.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptCmdlets_List.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/script_executions_create_or_update.py b/sdk/compute/azure-mgmt-avs/generated_samples/script_executions_create_or_update.py index f29bcf9fd981..160e91e13f7d 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/script_executions_create_or_update.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/script_executions_create_or_update.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -49,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/ScriptExecutions_CreateOrUpdate.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptExecutions_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/script_executions_delete.py b/sdk/compute/azure-mgmt-avs/generated_samples/script_executions_delete.py index 352e15cd1e8a..7b25ad242532 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/script_executions_delete.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/script_executions_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/ScriptExecutions_Delete.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptExecutions_Delete.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/script_executions_get.py b/sdk/compute/azure-mgmt-avs/generated_samples/script_executions_get.py index 85abfb249bef..68e307f66b0a 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/script_executions_get.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/script_executions_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/ScriptExecutions_Get.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptExecutions_Get.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/script_executions_get_execution_logs.py b/sdk/compute/azure-mgmt-avs/generated_samples/script_executions_get_execution_logs.py index 7aa338029cdd..7d7d00535882 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/script_executions_get_execution_logs.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/script_executions_get_execution_logs.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/ScriptExecutions_GetExecutionLogs.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptExecutions_GetExecutionLogs.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/script_executions_list.py b/sdk/compute/azure-mgmt-avs/generated_samples/script_executions_list.py index c8f2debf19d1..61a5cdf77ed3 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/script_executions_list.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/script_executions_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/ScriptExecutions_List.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptExecutions_List.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/script_packages_get.py b/sdk/compute/azure-mgmt-avs/generated_samples/script_packages_get.py index 5a84f40dbd95..898bf4f8dddd 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/script_packages_get.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/script_packages_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/ScriptPackages_Get.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptPackages_Get.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/script_packages_list.py b/sdk/compute/azure-mgmt-avs/generated_samples/script_packages_list.py index acb15bbdc8e7..198756373511 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/script_packages_list.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/script_packages_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/ScriptPackages_List.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptPackages_List.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/virtual_machines_get.py b/sdk/compute/azure-mgmt-avs/generated_samples/virtual_machines_get.py index dbde0e93189f..56266abe632b 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/virtual_machines_get.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/virtual_machines_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/VirtualMachines_Get.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/VirtualMachines_Get.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/virtual_machines_list.py b/sdk/compute/azure-mgmt-avs/generated_samples/virtual_machines_list.py index 7d20d2ff75cd..08d7cd344450 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/virtual_machines_list.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/virtual_machines_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/VirtualMachines_List.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/VirtualMachines_List.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/virtual_machines_restrict_movement.py b/sdk/compute/azure-mgmt-avs/generated_samples/virtual_machines_restrict_movement.py index 46b7f6095b12..46e4214a5a87 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/virtual_machines_restrict_movement.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/virtual_machines_restrict_movement.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -38,6 +41,6 @@ def main(): ).result() -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/VirtualMachines_RestrictMovement.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/VirtualMachines_RestrictMovement.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_create_dhcp_configurations.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_create_dhcp.py similarity index 92% rename from sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_create_dhcp_configurations.py rename to sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_create_dhcp.py index e64fc5e63a2c..917659ec61c3 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_create_dhcp_configurations.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_create_dhcp.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -14,7 +17,7 @@ pip install azure-identity pip install azure-mgmt-avs # USAGE - python workload_networks_create_dhcp_configurations.py + python workload_networks_create_dhcp.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, @@ -46,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_CreateDhcpConfigurations.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_CreateDhcp.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_create_dns_services.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_create_dns_service.py similarity index 91% rename from sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_create_dns_services.py rename to sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_create_dns_service.py index 66241173c64c..066717a3e537 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_create_dns_services.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_create_dns_service.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -14,7 +17,7 @@ pip install azure-identity pip install azure-mgmt-avs # USAGE - python workload_networks_create_dns_services.py + python workload_networks_create_dns_service.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, @@ -47,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_CreateDnsServices.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_CreateDnsService.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_create_dns_zones.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_create_dns_zone.py similarity index 91% rename from sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_create_dns_zones.py rename to sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_create_dns_zone.py index 6bf48554d91d..bee3195fa480 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_create_dns_zones.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_create_dns_zone.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -14,7 +17,7 @@ pip install azure-identity pip install azure-mgmt-avs # USAGE - python workload_networks_create_dns_zones.py + python workload_networks_create_dns_zone.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, @@ -46,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_CreateDnsZones.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_CreateDnsZone.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_create_port_mirroring_profiles.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_create_port_mirroring.py similarity index 91% rename from sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_create_port_mirroring_profiles.py rename to sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_create_port_mirroring.py index e7a677b0c6dd..3306d00061db 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_create_port_mirroring_profiles.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_create_port_mirroring.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -14,7 +17,7 @@ pip install azure-identity pip install azure-mgmt-avs # USAGE - python workload_networks_create_port_mirroring_profiles.py + python workload_networks_create_port_mirroring.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, @@ -46,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_CreatePortMirroringProfiles.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_CreatePortMirroring.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_create_segments.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_create_segments.py index a5533302bdb8..c35ad9933fa1 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_create_segments.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_create_segments.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -45,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_CreateSegments.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_CreateSegments.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_create_vm_groups.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_create_vm_group.py similarity index 91% rename from sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_create_vm_groups.py rename to sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_create_vm_group.py index 97ec4a11354a..b413dc04ef61 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_create_vm_groups.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_create_vm_group.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -14,7 +17,7 @@ pip install azure-identity pip install azure-mgmt-avs # USAGE - python workload_networks_create_vm_groups.py + python workload_networks_create_vm_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, @@ -44,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_CreateVMGroups.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_CreateVMGroup.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_delete_dhcp_configurations.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_delete_dhcp.py similarity index 90% rename from sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_delete_dhcp_configurations.py rename to sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_delete_dhcp.py index e609dad697aa..dfc7aed2067d 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_delete_dhcp_configurations.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_delete_dhcp.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-avs # USAGE - python workload_networks_delete_dhcp_configurations.py + python workload_networks_delete_dhcp.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, @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_DeleteDhcpConfigurations.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_DeleteDhcp.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_delete_dns_services.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_delete_dns_service.py similarity index 91% rename from sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_delete_dns_services.py rename to sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_delete_dns_service.py index b02f950ed69b..3b007bd5571f 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_delete_dns_services.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_delete_dns_service.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-avs # USAGE - python workload_networks_delete_dns_services.py + python workload_networks_delete_dns_service.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, @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_DeleteDnsServices.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_DeleteDnsService.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_delete_dns_zones.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_delete_dns_zone.py similarity index 92% rename from sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_delete_dns_zones.py rename to sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_delete_dns_zone.py index e7bbfe237915..fe98145ada67 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_delete_dns_zones.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_delete_dns_zone.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-avs # USAGE - python workload_networks_delete_dns_zones.py + python workload_networks_delete_dns_zone.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, @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_DeleteDnsZones.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_DeleteDnsZone.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_delete_port_mirroring_profiles.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_delete_port_mirroring.py similarity index 90% rename from sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_delete_port_mirroring_profiles.py rename to sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_delete_port_mirroring.py index ef77220dfe28..c504ce7f8d0f 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_delete_port_mirroring_profiles.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_delete_port_mirroring.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-avs # USAGE - python workload_networks_delete_port_mirroring_profiles.py + python workload_networks_delete_port_mirroring.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, @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_DeletePortMirroringProfiles.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_DeletePortMirroring.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_delete_segments.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_delete_segment.py similarity index 92% rename from sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_delete_segments.py rename to sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_delete_segment.py index bb3144e51b7e..5578bf59996c 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_delete_segments.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_delete_segment.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-avs # USAGE - python workload_networks_delete_segments.py + python workload_networks_delete_segment.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, @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_DeleteSegments.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_DeleteSegment.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_delete_vm_groups.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_delete_vm_group.py similarity index 92% rename from sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_delete_vm_groups.py rename to sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_delete_vm_group.py index 360f811ab43d..216f8ebcb96f 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_delete_vm_groups.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_delete_vm_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-avs # USAGE - python workload_networks_delete_vm_groups.py + python workload_networks_delete_vm_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, @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_DeleteVMGroups.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_DeleteVMGroup.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get.py index d4bee508c162..48177a474863 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -32,11 +33,10 @@ def main(): response = client.workload_networks.get( resource_group_name="group1", private_cloud_name="cloud1", - workload_network_name="default", ) print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_Get.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_Get.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_dhcp_configurations.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_dhcp.py similarity index 91% rename from sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_dhcp_configurations.py rename to sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_dhcp.py index e053eb758a03..df673054ecb6 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_dhcp_configurations.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_dhcp.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-avs # USAGE - python workload_networks_get_dhcp_configurations.py + python workload_networks_get_dhcp.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, @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_GetDhcpConfigurations.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_GetDhcp.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_dns_services.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_dns_service.py similarity index 92% rename from sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_dns_services.py rename to sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_dns_service.py index 865877e3f1c0..cba7f6ed653b 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_dns_services.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_dns_service.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-avs # USAGE - python workload_networks_get_dns_services.py + python workload_networks_get_dns_service.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, @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_GetDnsServices.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_GetDnsService.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_dns_zones.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_dns_zone.py similarity index 92% rename from sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_dns_zones.py rename to sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_dns_zone.py index 9c3d86c26187..9173437be595 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_dns_zones.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_dns_zone.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-avs # USAGE - python workload_networks_get_dns_zones.py + python workload_networks_get_dns_zone.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, @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_GetDnsZones.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_GetDnsZone.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_gateway.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_gateway.py index 8831a501a995..7befac3786b5 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_gateway.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_gateway.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_GetGateway.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_GetGateway.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_port_mirroring_profiles.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_port_mirroring.py similarity index 91% rename from sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_port_mirroring_profiles.py rename to sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_port_mirroring.py index 8d496c2438e1..8d4e9d845925 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_port_mirroring_profiles.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_port_mirroring.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-avs # USAGE - python workload_networks_get_port_mirroring_profiles.py + python workload_networks_get_port_mirroring.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, @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_GetPortMirroringProfiles.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_GetPortMirroring.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_segments.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_segment.py similarity index 92% rename from sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_segments.py rename to sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_segment.py index 61099130bd5f..1a678b54b9b6 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_segments.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_segment.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-avs # USAGE - python workload_networks_get_segments.py + python workload_networks_get_segment.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, @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_GetSegments.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_GetSegment.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_virtual_machine.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_virtual_machine.py index d8ff8718d1ef..9b5939496103 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_virtual_machine.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_virtual_machine.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_GetVirtualMachine.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_GetVirtualMachine.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_vm_groups.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_vm_group.py similarity index 92% rename from sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_vm_groups.py rename to sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_vm_group.py index afffc7ce7a84..1b02d3ca50ac 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_vm_groups.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_get_vm_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-avs # USAGE - python workload_networks_get_vm_groups.py + python workload_networks_get_vm_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, @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_GetVMGroups.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_GetVMGroup.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list.py index bc563948f204..9620699c2878 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_List.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_List.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_dhcp_configurations.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_dhcp.py similarity index 91% rename from sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_dhcp_configurations.py rename to sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_dhcp.py index b83e642c70f4..17984c5933fd 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_dhcp_configurations.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_dhcp.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-avs # USAGE - python workload_networks_list_dhcp_configurations.py + python workload_networks_list_dhcp.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, @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_ListDhcpConfigurations.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_ListDhcp.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_dns_services.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_dns_services.py index e92222ba29d8..a1155ee1a665 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_dns_services.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_dns_services.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_ListDnsServices.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_ListDnsServices.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_dns_zones.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_dns_zones.py index 58293e5eda62..280bdb5d8b80 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_dns_zones.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_dns_zones.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_ListDnsZones.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_ListDnsZones.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_gateways.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_gateways.py index 1928d16fb290..b6bc87bd1370 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_gateways.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_gateways.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_ListGateways.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_ListGateways.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_port_mirroring_profiles.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_port_mirroring.py similarity index 90% rename from sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_port_mirroring_profiles.py rename to sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_port_mirroring.py index b8ddb568a4f7..d1c04d288da3 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_port_mirroring_profiles.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_port_mirroring.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-avs # USAGE - python workload_networks_list_port_mirroring_profiles.py + python workload_networks_list_port_mirroring.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, @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_ListPortMirroringProfiles.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_ListPortMirroring.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_public_ips.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_public_ips.py index fb3af3f5691b..a5ec374ab1a6 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_public_ips.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_public_ips.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_ListPublicIPs.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_ListPublicIPs.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_segments.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_segments.py index 0604b151accf..804114346eac 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_segments.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_segments.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_ListSegments.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_ListSegments.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_virtual_machines.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_virtual_machines.py index f34f1e20a8a7..dd3e8d642260 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_virtual_machines.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_virtual_machines.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_ListVirtualMachines.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_ListVirtualMachines.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_vm_groups.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_vm_groups.py index 8c5d7ce91fbb..f5d3add18b30 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_vm_groups.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_list_vm_groups.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_ListVMGroups.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_ListVMGroups.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_update_dhcp_configurations.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_update_dhcp.py similarity index 91% rename from sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_update_dhcp_configurations.py rename to sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_update_dhcp.py index 8e4a93b5ab0e..4e9ce7a9df20 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_update_dhcp_configurations.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_update_dhcp.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -14,7 +17,7 @@ pip install azure-identity pip install azure-mgmt-avs # USAGE - python workload_networks_update_dhcp_configurations.py + python workload_networks_update_dhcp.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, @@ -40,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_UpdateDhcpConfigurations.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_UpdateDhcp.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_update_dns_services.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_update_dns_service.py similarity index 91% rename from sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_update_dns_services.py rename to sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_update_dns_service.py index 8e1a57120a5f..5214e840af5f 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_update_dns_services.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_update_dns_service.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -14,7 +17,7 @@ pip install azure-identity pip install azure-mgmt-avs # USAGE - python workload_networks_update_dns_services.py + python workload_networks_update_dns_service.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, @@ -47,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_UpdateDnsServices.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_UpdateDnsService.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_update_dns_zones.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_update_dns_zone.py similarity index 91% rename from sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_update_dns_zones.py rename to sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_update_dns_zone.py index b6eee6037b5c..feb65b019c9b 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_update_dns_zones.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_update_dns_zone.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -14,7 +17,7 @@ pip install azure-identity pip install azure-mgmt-avs # USAGE - python workload_networks_update_dns_zones.py + python workload_networks_update_dns_zone.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, @@ -46,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_UpdateDnsZones.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_UpdateDnsZone.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_update_port_mirroring_profiles.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_update_port_mirroring.py similarity index 90% rename from sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_update_port_mirroring_profiles.py rename to sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_update_port_mirroring.py index 2b061f61e1d0..03b902a97a81 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_update_port_mirroring_profiles.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_update_port_mirroring.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -14,7 +17,7 @@ pip install azure-identity pip install azure-mgmt-avs # USAGE - python workload_networks_update_port_mirroring_profiles.py + python workload_networks_update_port_mirroring.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, @@ -40,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_UpdatePortMirroringProfiles.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_UpdatePortMirroring.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_update_segments.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_update_segments.py index 40851c0f9d7e..f98936204648 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_update_segments.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_update_segments.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -44,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_UpdateSegments.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_UpdateSegments.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_update_vm_groups.py b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_update_vm_group.py similarity index 91% rename from sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_update_vm_groups.py rename to sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_update_vm_group.py index f203352c5a2c..fd142b1054bc 100644 --- a/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_update_vm_groups.py +++ b/sdk/compute/azure-mgmt-avs/generated_samples/workload_networks_update_vm_group.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.avs import AVSClient """ @@ -14,7 +17,7 @@ pip install azure-identity pip install azure-mgmt-avs # USAGE - python workload_networks_update_vm_groups.py + python workload_networks_update_vm_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, @@ -38,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-03-01/examples/WorkloadNetworks_UpdateVMGroups.json +# x-ms-original-file: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_UpdateVMGroup.json if __name__ == "__main__": main() diff --git a/sdk/compute/azure-mgmt-avs/setup.py b/sdk/compute/azure-mgmt-avs/setup.py index 81f3d1efb5f2..743e0f72a3d8 100644 --- a/sdk/compute/azure-mgmt-avs/setup.py +++ b/sdk/compute/azure-mgmt-avs/setup.py @@ -53,11 +53,11 @@ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "License :: OSI Approved :: MIT License", ], zip_safe=False, @@ -74,10 +74,9 @@ "pytyped": ["py.typed"], }, install_requires=[ - "isodate<1.0.0,>=0.6.1", - "azure-common~=1.1", - "azure-mgmt-core>=1.3.2,<2.0.0", - "typing-extensions>=4.3.0; python_version<'3.8.0'", + "isodate>=0.6.1", + "azure-common>=1.1", + "azure-mgmt-core>=1.3.2", ], - python_requires=">=3.7", + python_requires=">=3.8", )