diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/CHANGELOG.md b/sdk/hybridcompute/azure-mgmt-hybridcompute/CHANGELOG.md index e98141860748..8acac6fee6b0 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/CHANGELOG.md +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/CHANGELOG.md @@ -1,5 +1,76 @@ # Release History +## 9.0.0b1 (2023-11-20) + +### Features Added + + - Added operation MachinesOperations.begin_assess_patches + - Added operation MachinesOperations.begin_install_patches + - Added operation group AgentVersionOperations + - Added operation group ExtensionMetadataOperations + - Added operation group HybridIdentityMetadataOperations + - Added operation group LicenseProfilesOperations + - Added operation group LicensesOperations + - Added operation group NetworkProfileOperations + - Model AgentConfiguration has a new parameter config_mode + - Model Machine has a new parameter ad_fqdn + - Model Machine has a new parameter agent_configuration + - Model Machine has a new parameter agent_upgrade + - Model Machine has a new parameter agent_version + - Model Machine has a new parameter client_public_key + - Model Machine has a new parameter cloud_metadata + - Model Machine has a new parameter detected_properties + - Model Machine has a new parameter display_name + - Model Machine has a new parameter dns_fqdn + - Model Machine has a new parameter domain_name + - Model Machine has a new parameter error_details + - Model Machine has a new parameter extensions + - Model Machine has a new parameter kind + - Model Machine has a new parameter last_status_change + - Model Machine has a new parameter license_profile + - Model Machine has a new parameter location_data + - Model Machine has a new parameter machine_fqdn + - Model Machine has a new parameter mssql_discovered + - Model Machine has a new parameter network_profile + - Model Machine has a new parameter os_name + - Model Machine has a new parameter os_profile + - Model Machine has a new parameter os_sku + - Model Machine has a new parameter os_type + - Model Machine has a new parameter os_version + - Model Machine has a new parameter parent_cluster_resource_id + - Model Machine has a new parameter private_link_scope_resource_id + - Model Machine has a new parameter provisioning_state + - Model Machine has a new parameter resources + - Model Machine has a new parameter service_statuses + - Model Machine has a new parameter status + - Model Machine has a new parameter vm_id + - Model Machine has a new parameter vm_uuid + - Model MachineExtensionUpdate has a new parameter auto_upgrade_minor_version + - Model MachineExtensionUpdate has a new parameter enable_automatic_upgrade + - Model MachineExtensionUpdate has a new parameter force_update_tag + - Model MachineExtensionUpdate has a new parameter protected_settings + - Model MachineExtensionUpdate has a new parameter publisher + - Model MachineExtensionUpdate has a new parameter settings + - Model MachineExtensionUpdate has a new parameter type + - Model MachineExtensionUpdate has a new parameter type_handler_version + - Model MachineUpdate has a new parameter agent_upgrade + - Model MachineUpdate has a new parameter cloud_metadata + - Model MachineUpdate has a new parameter kind + - Model MachineUpdate has a new parameter location_data + - Model MachineUpdate has a new parameter os_profile + - Model MachineUpdate has a new parameter parent_cluster_resource_id + - Model MachineUpdate has a new parameter private_link_scope_resource_id + - Model ProxyResource has a new parameter system_data + - Model Resource has a new parameter system_data + - Model TrackedResource has a new parameter system_data + - Operation MachinesOperations.list_by_resource_group has a new optional parameter expand + +### Breaking Changes + + - Model Machine no longer has parameter properties + - Model MachineExtensionUpdate no longer has parameter properties + - Model MachineUpdate no longer has parameter properties + ## 8.0.0 (2023-02-15) ### Features Added diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/README.md b/sdk/hybridcompute/azure-mgmt-hybridcompute/README.md index 62386d9c5a8c..32f3e2dee091 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/README.md +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/README.md @@ -45,8 +45,9 @@ client = HybridComputeManagementClient(credential=DefaultAzureCredential(), subs ## Examples - -Code samples for this package can be found at [Hybrid Compute Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com and [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) +Code samples for this package can be found at: +- [Search Hybrid Compute Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com +- [Azure Python Mgmt SDK Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) ## Troubleshooting @@ -58,6 +59,3 @@ Code samples for this package can be found at [Hybrid Compute Management](https: 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-hybridcompute%2FREADME.png) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/_meta.json b/sdk/hybridcompute/azure-mgmt-hybridcompute/_meta.json index b7d1fb8d7d36..ab0c3990e3d7 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/_meta.json +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/_meta.json @@ -1,11 +1,11 @@ { - "commit": "270d3cd664cca3ddc8511f92d3851a715e2c61db", + "commit": "11bbc2b1df2e915a2227a6a1a48a27b9e67c3311", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.2.16", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/hybridcompute/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --tag=package-2022-03 --use=@autorest/python@6.2.16 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/hybridcompute/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", "readme": "specification/hybridcompute/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/assets.json b/sdk/hybridcompute/azure-mgmt-hybridcompute/assets.json new file mode 100644 index 000000000000..8ce8691e6a67 --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "python", + "TagPrefix": "python/hybridcompute/azure-mgmt-hybridcompute", + "Tag": "python/hybridcompute/azure-mgmt-hybridcompute_9bab93f309" +} \ No newline at end of file diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_configuration.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_configuration.py index fde6c33ae9a6..7831bd4c2deb 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_configuration.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -35,14 +29,14 @@ class HybridComputeManagementClientConfiguration(Configuration): # pylint: disa :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-03-10". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-06-20-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(HybridComputeManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-03-10"] = kwargs.pop("api_version", "2022-03-10") + api_version: str = kwargs.pop("api_version", "2023-06-20-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_hybrid_compute_management_client.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_hybrid_compute_management_client.py index 8a0077896e44..d5c1e7979fb4 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_hybrid_compute_management_client.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_hybrid_compute_management_client.py @@ -16,9 +16,15 @@ from ._configuration import HybridComputeManagementClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( + AgentVersionOperations, + ExtensionMetadataOperations, HybridComputeManagementClientOperationsMixin, + HybridIdentityMetadataOperations, + LicenseProfilesOperations, + LicensesOperations, MachineExtensionsOperations, MachinesOperations, + NetworkProfileOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, @@ -35,12 +41,25 @@ class HybridComputeManagementClient( ): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Hybrid Compute Management Client. + :ivar licenses: LicensesOperations operations + :vartype licenses: azure.mgmt.hybridcompute.operations.LicensesOperations :ivar machines: MachinesOperations operations :vartype machines: azure.mgmt.hybridcompute.operations.MachinesOperations + :ivar license_profiles: LicenseProfilesOperations operations + :vartype license_profiles: azure.mgmt.hybridcompute.operations.LicenseProfilesOperations :ivar machine_extensions: MachineExtensionsOperations operations :vartype machine_extensions: azure.mgmt.hybridcompute.operations.MachineExtensionsOperations + :ivar extension_metadata: ExtensionMetadataOperations operations + :vartype extension_metadata: azure.mgmt.hybridcompute.operations.ExtensionMetadataOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.hybridcompute.operations.Operations + :ivar network_profile: NetworkProfileOperations operations + :vartype network_profile: azure.mgmt.hybridcompute.operations.NetworkProfileOperations + :ivar hybrid_identity_metadata: HybridIdentityMetadataOperations operations + :vartype hybrid_identity_metadata: + azure.mgmt.hybridcompute.operations.HybridIdentityMetadataOperations + :ivar agent_version: AgentVersionOperations operations + :vartype agent_version: azure.mgmt.hybridcompute.operations.AgentVersionOperations :ivar private_link_scopes: PrivateLinkScopesOperations operations :vartype private_link_scopes: azure.mgmt.hybridcompute.operations.PrivateLinkScopesOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations @@ -55,8 +74,8 @@ class HybridComputeManagementClient( :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-03-10". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-06-20-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -72,17 +91,29 @@ def __init__( self._config = HybridComputeManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False + self.licenses = LicensesOperations(self._client, self._config, self._serialize, self._deserialize) self.machines = MachinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.license_profiles = LicenseProfilesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.machine_extensions = MachineExtensionsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.extension_metadata = ExtensionMetadataOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.network_profile = NetworkProfileOperations(self._client, self._config, self._serialize, self._deserialize) + self.hybrid_identity_metadata = HybridIdentityMetadataOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_version = AgentVersionOperations(self._client, self._config, self._serialize, self._deserialize) self.private_link_scopes = PrivateLinkScopesOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -122,5 +153,5 @@ def __enter__(self) -> "HybridComputeManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_serialization.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_serialization.py index f17c068e833e..4bae2292227b 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_serialization.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_serialization.py @@ -629,7 +629,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): @@ -662,8 +662,9 @@ def _serialize(self, target_obj, data_type=None, **kwargs): _serialized.update(_new_attr) # type: ignore _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] - except ValueError: - continue + except ValueError as err: + if isinstance(err, SerializationError): + raise except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) @@ -741,6 +742,8 @@ def query(self, name, data, data_type, **kwargs): :param data: The data to be serialized. :param str data_type: The type to be serialized from. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None @@ -749,10 +752,8 @@ def query(self, name, data, data_type, **kwargs): # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] - if not kwargs.get("skip_quote", False): - data = [quote(str(d), safe="") for d in data] - return str(self.serialize_iter(data, internal_data_type, **kwargs)) + do_quote = not kwargs.get("skip_quote", False) + return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -891,6 +892,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. + :keyword bool do_quote: Whether to quote the serialized result of each iterable element. + Defaults to False. :rtype: list, str """ if isinstance(data, str): @@ -903,9 +906,14 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): for d in data: try: serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized.append(None) + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + if div: serialized = ["" if s is None else str(s) for s in serialized] serialized = div.join(serialized) @@ -950,7 +958,9 @@ def serialize_dict(self, attr, dict_type, **kwargs): for key, value in attr.items(): try: serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized[self.serialize_unicode(key)] = None if "xml" in serialization_ctxt: @@ -1271,7 +1281,7 @@ def _extract_name_from_internal_type(internal_type): xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1295,7 +1305,7 @@ def xml_key_extractor(attr, attr_desc, data): # Integrate namespace if necessary xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_vendor.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_vendor.py index b26bf832e7d5..7857973c34b3 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_vendor.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_vendor.py @@ -6,7 +6,7 @@ # -------------------------------------------------------------------------- from abc import ABC -from typing import List, TYPE_CHECKING, cast +from typing import TYPE_CHECKING from azure.core.pipeline.transport import HttpRequest @@ -27,18 +27,6 @@ def _convert_request(request, files=None): return request -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) - - class HybridComputeManagementClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_version.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_version.py index 142a0420b39b..6dddc002d43d 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_version.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_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 = "9.0.0b1" diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/_configuration.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/_configuration.py index fb08dae516ef..98c32b2ee28e 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/_configuration.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -35,14 +29,14 @@ class HybridComputeManagementClientConfiguration(Configuration): # pylint: disa :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-03-10". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-06-20-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(HybridComputeManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-03-10"] = kwargs.pop("api_version", "2022-03-10") + api_version: str = kwargs.pop("api_version", "2023-06-20-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/_hybrid_compute_management_client.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/_hybrid_compute_management_client.py index c91d02fe633f..380c0e85af10 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/_hybrid_compute_management_client.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/_hybrid_compute_management_client.py @@ -16,9 +16,15 @@ from .._serialization import Deserializer, Serializer from ._configuration import HybridComputeManagementClientConfiguration from .operations import ( + AgentVersionOperations, + ExtensionMetadataOperations, HybridComputeManagementClientOperationsMixin, + HybridIdentityMetadataOperations, + LicenseProfilesOperations, + LicensesOperations, MachineExtensionsOperations, MachinesOperations, + NetworkProfileOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, @@ -35,13 +41,27 @@ class HybridComputeManagementClient( ): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Hybrid Compute Management Client. + :ivar licenses: LicensesOperations operations + :vartype licenses: azure.mgmt.hybridcompute.aio.operations.LicensesOperations :ivar machines: MachinesOperations operations :vartype machines: azure.mgmt.hybridcompute.aio.operations.MachinesOperations + :ivar license_profiles: LicenseProfilesOperations operations + :vartype license_profiles: azure.mgmt.hybridcompute.aio.operations.LicenseProfilesOperations :ivar machine_extensions: MachineExtensionsOperations operations :vartype machine_extensions: azure.mgmt.hybridcompute.aio.operations.MachineExtensionsOperations + :ivar extension_metadata: ExtensionMetadataOperations operations + :vartype extension_metadata: + azure.mgmt.hybridcompute.aio.operations.ExtensionMetadataOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.hybridcompute.aio.operations.Operations + :ivar network_profile: NetworkProfileOperations operations + :vartype network_profile: azure.mgmt.hybridcompute.aio.operations.NetworkProfileOperations + :ivar hybrid_identity_metadata: HybridIdentityMetadataOperations operations + :vartype hybrid_identity_metadata: + azure.mgmt.hybridcompute.aio.operations.HybridIdentityMetadataOperations + :ivar agent_version: AgentVersionOperations operations + :vartype agent_version: azure.mgmt.hybridcompute.aio.operations.AgentVersionOperations :ivar private_link_scopes: PrivateLinkScopesOperations operations :vartype private_link_scopes: azure.mgmt.hybridcompute.aio.operations.PrivateLinkScopesOperations @@ -57,8 +77,8 @@ class HybridComputeManagementClient( :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-03-10". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-06-20-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -74,17 +94,29 @@ def __init__( self._config = HybridComputeManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False + self.licenses = LicensesOperations(self._client, self._config, self._serialize, self._deserialize) self.machines = MachinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.license_profiles = LicenseProfilesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.machine_extensions = MachineExtensionsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.extension_metadata = ExtensionMetadataOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.network_profile = NetworkProfileOperations(self._client, self._config, self._serialize, self._deserialize) + self.hybrid_identity_metadata = HybridIdentityMetadataOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_version = AgentVersionOperations(self._client, self._config, self._serialize, self._deserialize) self.private_link_scopes = PrivateLinkScopesOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -124,5 +156,5 @@ async def __aenter__(self) -> "HybridComputeManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/__init__.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/__init__.py index 4709c0d6c162..8f0589115fae 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/__init__.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/__init__.py @@ -6,10 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._licenses_operations import LicensesOperations from ._machines_operations import MachinesOperations +from ._license_profiles_operations import LicenseProfilesOperations from ._machine_extensions_operations import MachineExtensionsOperations from ._hybrid_compute_management_client_operations import HybridComputeManagementClientOperationsMixin +from ._extension_metadata_operations import ExtensionMetadataOperations from ._operations import Operations +from ._network_profile_operations import NetworkProfileOperations +from ._hybrid_identity_metadata_operations import HybridIdentityMetadataOperations +from ._agent_version_operations import AgentVersionOperations from ._private_link_scopes_operations import PrivateLinkScopesOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations @@ -19,10 +25,16 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ + "LicensesOperations", "MachinesOperations", + "LicenseProfilesOperations", "MachineExtensionsOperations", "HybridComputeManagementClientOperationsMixin", + "ExtensionMetadataOperations", "Operations", + "NetworkProfileOperations", + "HybridIdentityMetadataOperations", + "AgentVersionOperations", "PrivateLinkScopesOperations", "PrivateLinkResourcesOperations", "PrivateEndpointConnectionsOperations", diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_agent_version_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_agent_version_operations.py new file mode 100644 index 000000000000..f3008ff91b46 --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_agent_version_operations.py @@ -0,0 +1,168 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._agent_version_operations import build_get_request, build_list_request +from .._vendor import HybridComputeManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AgentVersionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'s + :attr:`agent_version` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def list(self, os_type: str, **kwargs: Any) -> _models.AgentVersionsList: + """Gets all Agent Versions along with the download link currently present. + + :param os_type: Defines the os type. Required. + :type os_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AgentVersionsList or the result of cls(response) + :rtype: ~azure.mgmt.hybridcompute.models.AgentVersionsList + :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.AgentVersionsList] = kwargs.pop("cls", None) + + request = build_list_request( + os_type=os_type, + 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) + + _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.ErrorResponseAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AgentVersionsList", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {"url": "/providers/Microsoft.HybridCompute/osType/{osType}/agentVersions"} + + @distributed_trace_async + async def get(self, os_type: str, version: str, **kwargs: Any) -> _models.AgentVersion: + """Gets an Agent Version along with the download link currently present. + + :param os_type: Defines the os type. Required. + :type os_type: str + :param version: Defines the agent version. To get latest, use latest or else a specific agent + version. Required. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AgentVersion or the result of cls(response) + :rtype: ~azure.mgmt.hybridcompute.models.AgentVersion + :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.AgentVersion] = kwargs.pop("cls", None) + + request = build_get_request( + os_type=os_type, + version=version, + 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.ErrorResponseAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AgentVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {"url": "/providers/Microsoft.HybridCompute/osType/{osType}/agentVersions/{version}"} diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_extension_metadata_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_extension_metadata_operations.py new file mode 100644 index 000000000000..4af771926b60 --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_extension_metadata_operations.py @@ -0,0 +1,220 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._extension_metadata_operations import build_get_request, build_list_request +from .._vendor import HybridComputeManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ExtensionMetadataOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'s + :attr:`extension_metadata` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, location: str, publisher: str, extension_type: str, version: str, **kwargs: Any + ) -> _models.ExtensionValue: + """Gets an Extension Metadata based on location, publisher, extensionType and version. + + :param location: The location of the Extension being received. Required. + :type location: str + :param publisher: The publisher of the Extension being received. Required. + :type publisher: str + :param extension_type: The extensionType of the Extension being received. Required. + :type extension_type: str + :param version: The version of the Extension being received. Required. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExtensionValue or the result of cls(response) + :rtype: ~azure.mgmt.hybridcompute.models.ExtensionValue + :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.ExtensionValue] = kwargs.pop("cls", None) + + request = build_get_request( + location=location, + publisher=publisher, + extension_type=extension_type, + version=version, + 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("ExtensionValue", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions/{version}" + } + + @distributed_trace + def list( + self, location: str, publisher: str, extension_type: str, **kwargs: Any + ) -> AsyncIterable["_models.ExtensionValue"]: + """Gets all Extension versions based on location, publisher, extensionType. + + :param location: The location of the Extension being received. Required. + :type location: str + :param publisher: The publisher of the Extension being received. Required. + :type publisher: str + :param extension_type: The extensionType of the Extension being received. Required. + :type extension_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExtensionValue or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.ExtensionValue] + :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.ExtensionValueListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + location=location, + publisher=publisher, + extension_type=extension_type, + 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) + + 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("ExtensionValueListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions" + } diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_hybrid_compute_management_client_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_hybrid_compute_management_client_operations.py index 9ed92a8644c4..835969a7914c 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_hybrid_compute_management_client_operations.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_hybrid_compute_management_client_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -31,10 +31,6 @@ from ...operations._hybrid_compute_management_client_operations import build_upgrade_extensions_request from .._vendor import HybridComputeManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,16 +54,14 @@ async def _upgrade_extensions_initial( # pylint: disable=inconsistent-return-st _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(extension_upgrade_parameters, (IO, bytes)): + if isinstance(extension_upgrade_parameters, (IOBase, bytes)): _content = extension_upgrade_parameters else: _json = self._serialize.body(extension_upgrade_parameters, "MachineExtensionUpgrade") @@ -87,8 +81,9 @@ async def _upgrade_extensions_initial( # pylint: disable=inconsistent-return-st request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -98,8 +93,16 @@ async def _upgrade_extensions_initial( # pylint: disable=inconsistent-return-st error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _upgrade_extensions_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/upgradeExtensions" @@ -193,7 +196,7 @@ async def begin_upgrade_extensions( :param machine_name: The name of the hybrid machine. Required. :type machine_name: str :param extension_upgrade_parameters: Parameters supplied to the Upgrade Extensions operation. - Is either a model type or a IO type. Required. + Is either a MachineExtensionUpgrade type or a IO type. Required. :type extension_upgrade_parameters: ~azure.mgmt.hybridcompute.models.MachineExtensionUpgrade or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -214,9 +217,7 @@ async def begin_upgrade_extensions( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_hybrid_identity_metadata_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_hybrid_identity_metadata_operations.py new file mode 100644 index 000000000000..c216c4e4a567 --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_hybrid_identity_metadata_operations.py @@ -0,0 +1,221 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._hybrid_identity_metadata_operations import build_get_request, build_list_by_machines_request +from .._vendor import HybridComputeManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class HybridIdentityMetadataOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'s + :attr:`hybrid_identity_metadata` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, machine_name: str, metadata_name: str, **kwargs: Any + ) -> _models.HybridIdentityMetadata: + """Gets HybridIdentityMetadata. + + Implements HybridIdentityMetadata GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param metadata_name: Name of the HybridIdentityMetadata. Required. + :type metadata_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridIdentityMetadata or the result of cls(response) + :rtype: ~azure.mgmt.hybridcompute.models.HybridIdentityMetadata + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.HybridIdentityMetadata] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + metadata_name=metadata_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("HybridIdentityMetadata", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/hybridIdentityMetadata/{metadataName}" + } + + @distributed_trace + def list_by_machines( + self, resource_group_name: str, machine_name: str, **kwargs: Any + ) -> AsyncIterable["_models.HybridIdentityMetadata"]: + """Implements GET HybridIdentityMetadata in a machine. + + Returns the list of HybridIdentityMetadata of the given machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HybridIdentityMetadata or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.HybridIdentityMetadata] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.HybridIdentityMetadataList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_machines_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_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("HybridIdentityMetadataList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_machines.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/hybridIdentityMetadata" + } diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_license_profiles_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_license_profiles_operations.py new file mode 100644 index 000000000000..d380b3887ae1 --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_license_profiles_operations.py @@ -0,0 +1,840 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._license_profiles_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) +from .._vendor import HybridComputeManagementClientMixinABC + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class LicenseProfilesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'s + :attr:`license_profiles` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _create_or_update_initial( + self, resource_group_name: str, machine_name: str, parameters: Union[_models.LicenseProfile, IO], **kwargs: Any + ) -> _models.LicenseProfile: + 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)) + license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LicenseProfile] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "LicenseProfile") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + license_profile_name=license_profile_name, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("LicenseProfile", 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")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("LicenseProfile", pipeline_response) + + if cls: + 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.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + machine_name: str, + parameters: _models.LicenseProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.LicenseProfile]: + """The operation to create or update a license profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Create license profile operation. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.LicenseProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword license_profile_name: The name of the license profile. Default value is "default". + Note that overriding this default value may result in unsupported behavior. + :paramtype license_profile_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 LicenseProfile or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + machine_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.LicenseProfile]: + """The operation to create or update a license profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Create license profile operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword license_profile_name: The name of the license profile. Default value is "default". + Note that overriding this default value may result in unsupported behavior. + :paramtype license_profile_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 LicenseProfile or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, machine_name: str, parameters: Union[_models.LicenseProfile, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.LicenseProfile]: + """The operation to create or update a license profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Create license profile operation. Is either a + LicenseProfile type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.LicenseProfile or IO + :keyword license_profile_name: The name of the license profile. Default value is "default". + Note that overriding this default value may result in unsupported behavior. + :paramtype license_profile_name: str + :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 LicenseProfile or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] + :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)) + license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LicenseProfile] = 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, + machine_name=machine_name, + parameters=parameters, + api_version=api_version, + license_profile_name=license_profile_name, + 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("LicenseProfile", 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_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}" + } + + async def _update_initial( + self, + resource_group_name: str, + machine_name: str, + parameters: Union[_models.LicenseProfileUpdate, IO], + **kwargs: Any + ) -> Optional[_models.LicenseProfile]: + 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)) + license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.LicenseProfile]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "LicenseProfileUpdate") + + request = build_update_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + license_profile_name=license_profile_name, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("LicenseProfile", 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")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + machine_name: str, + parameters: _models.LicenseProfileUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.LicenseProfile]: + """The operation to update a license profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Update license profile operation. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.LicenseProfileUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword license_profile_name: The name of the license profile. Default value is "default". + Note that overriding this default value may result in unsupported behavior. + :paramtype license_profile_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 LicenseProfile or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + machine_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.LicenseProfile]: + """The operation to update a license profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Update license profile operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword license_profile_name: The name of the license profile. Default value is "default". + Note that overriding this default value may result in unsupported behavior. + :paramtype license_profile_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 LicenseProfile or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + machine_name: str, + parameters: Union[_models.LicenseProfileUpdate, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.LicenseProfile]: + """The operation to update a license profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Update license profile operation. Is either a + LicenseProfileUpdate type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.LicenseProfileUpdate or IO + :keyword license_profile_name: The name of the license profile. Default value is "default". + Note that overriding this default value may result in unsupported behavior. + :paramtype license_profile_name: str + :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 LicenseProfile or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] + :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)) + license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LicenseProfile] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + machine_name=machine_name, + parameters=parameters, + api_version=api_version, + license_profile_name=license_profile_name, + 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("LicenseProfile", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}" + } + + @distributed_trace_async + async def get(self, resource_group_name: str, machine_name: str, **kwargs: Any) -> _models.LicenseProfile: + """Retrieves information about the view of a license profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :keyword license_profile_name: The name of the license profile. Default value is "default". + Note that overriding this default value may result in unsupported behavior. + :paramtype license_profile_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LicenseProfile or the result of cls(response) + :rtype: ~azure.mgmt.hybridcompute.models.LicenseProfile + :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)) + license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") + cls: ClsType[_models.LicenseProfile] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + license_profile_name=license_profile_name, + 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("LicenseProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, machine_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + license_profile_name=license_profile_name, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}" + } + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, machine_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """The operation to delete a license profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :keyword license_profile_name: The name of the license profile. Default value is "default". + Note that overriding this default value may result in unsupported behavior. + :paramtype license_profile_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") + 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, + machine_name=machine_name, + api_version=api_version, + license_profile_name=license_profile_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, machine_name: str, **kwargs: Any + ) -> AsyncIterable["_models.LicenseProfile"]: + """The operation to get all license profiles of a non-Azure machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the machine. Required. + :type machine_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LicenseProfile or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.LicenseProfile] + :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.LicenseProfilesListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + machine_name=machine_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) + + 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("LicenseProfilesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles" + } diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_licenses_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_licenses_operations.py new file mode 100644 index 000000000000..c933b91183c9 --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_licenses_operations.py @@ -0,0 +1,1020 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._licenses_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_update_request, + build_validate_license_request, +) +from .._vendor import HybridComputeManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class LicensesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'s + :attr:`licenses` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _validate_license_initial(self, parameters: Union[_models.License, IO], **kwargs: Any) -> _models.License: + 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.License] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "License") + + request = build_validate_license_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._validate_license_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]: + 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("License", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _validate_license_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/validateLicense" + } + + @overload + async def begin_validate_license( + self, parameters: _models.License, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.License]: + """The operation to validate a license. + + :param parameters: Parameters supplied to the license validation operation. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.License + :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 License or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.License] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_validate_license( + self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.License]: + """The operation to validate a license. + + :param parameters: Parameters supplied to the license validation operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either License or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.License] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_validate_license( + self, parameters: Union[_models.License, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.License]: + """The operation to validate a license. + + :param parameters: Parameters supplied to the license validation operation. Is either a License + type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.License 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 License or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.License] + :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.License] = 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._validate_license_initial( + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("License", 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_validate_license.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/validateLicense" + } + + async def _create_or_update_initial( + self, resource_group_name: str, license_name: str, parameters: Union[_models.License, IO], **kwargs: Any + ) -> _models.License: + 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.License] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "License") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + license_name=license_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + 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("License", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/licenses/{licenseName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + license_name: str, + parameters: _models.License, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.License]: + """The operation to create or update a license. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param license_name: The name of the license. Required. + :type license_name: str + :param parameters: Parameters supplied to the Create license operation. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.License + :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 License or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.License] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + license_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.License]: + """The operation to create or update a license. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param license_name: The name of the license. Required. + :type license_name: str + :param parameters: Parameters supplied to the Create license operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either License or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.License] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, license_name: str, parameters: Union[_models.License, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.License]: + """The operation to create or update a license. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param license_name: The name of the license. Required. + :type license_name: str + :param parameters: Parameters supplied to the Create license operation. Is either a License + type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.License 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 License or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.License] + :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.License] = 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, + license_name=license_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("License", 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_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/licenses/{licenseName}" + } + + async def _update_initial( + self, resource_group_name: str, license_name: str, parameters: Union[_models.LicenseUpdate, IO], **kwargs: Any + ) -> _models.License: + 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.License] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "LicenseUpdate") + + request = build_update_request( + resource_group_name=resource_group_name, + license_name=license_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + 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("License", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/licenses/{licenseName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + license_name: str, + parameters: _models.LicenseUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.License]: + """The operation to update a license. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param license_name: The name of the license. Required. + :type license_name: str + :param parameters: Parameters supplied to the Update license operation. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.LicenseUpdate + :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 License or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.License] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + license_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.License]: + """The operation to update a license. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param license_name: The name of the license. Required. + :type license_name: str + :param parameters: Parameters supplied to the Update license operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either License or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.License] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, resource_group_name: str, license_name: str, parameters: Union[_models.LicenseUpdate, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.License]: + """The operation to update a license. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param license_name: The name of the license. Required. + :type license_name: str + :param parameters: Parameters supplied to the Update license operation. Is either a + LicenseUpdate type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.LicenseUpdate 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 License or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.License] + :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.License] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + license_name=license_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("License", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/licenses/{licenseName}" + } + + @distributed_trace_async + async def get(self, resource_group_name: str, license_name: str, **kwargs: Any) -> _models.License: + """Retrieves information about the view of a license. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param license_name: The name of the license. Required. + :type license_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: License or the result of cls(response) + :rtype: ~azure.mgmt.hybridcompute.models.License + :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.License] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + license_name=license_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("License", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/licenses/{licenseName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, license_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + license_name=license_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/licenses/{licenseName}" + } + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, license_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """The operation to delete a license. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param license_name: The name of the license. Required. + :type license_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + license_name=license_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/licenses/{licenseName}" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.License"]: + """The operation to get all licenses of a non-Azure machine. + + :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 License or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.License] + :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.LicensesListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("LicensesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/licenses" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.License"]: + """The operation to get all licenses of a non-Azure machine. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either License or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.License] + :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.LicensesListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("LicensesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/licenses" + } diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_machine_extensions_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_machine_extensions_operations.py index 9222583a9bcc..576789a7db7a 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_machine_extensions_operations.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_machine_extensions_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -40,10 +40,6 @@ ) from .._vendor import HybridComputeManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,16 +82,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.MachineExtension]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(extension_parameters, (IO, bytes)): + if isinstance(extension_parameters, (IOBase, bytes)): _content = extension_parameters else: _json = self._serialize.body(extension_parameters, "MachineExtension") @@ -116,8 +110,9 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -242,7 +237,7 @@ async def begin_create_or_update( :param extension_name: The name of the machine extension. Required. :type extension_name: str :param extension_parameters: Parameters supplied to the Create Machine Extension operation. Is - either a model type or a IO type. Required. + either a MachineExtension type or a IO type. Required. :type extension_parameters: ~azure.mgmt.hybridcompute.models.MachineExtension or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -263,9 +258,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.MachineExtension] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -330,16 +323,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.MachineExtension]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(extension_parameters, (IO, bytes)): + if isinstance(extension_parameters, (IOBase, bytes)): _content = extension_parameters else: _json = self._serialize.body(extension_parameters, "MachineExtensionUpdate") @@ -360,8 +351,9 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -372,11 +364,19 @@ async def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("MachineExtension", 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")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized @@ -486,7 +486,7 @@ async def begin_update( :param extension_name: The name of the machine extension. Required. :type extension_name: str :param extension_parameters: Parameters supplied to the Create Machine Extension operation. Is - either a model type or a IO type. Required. + either a MachineExtensionUpdate type or a IO type. Required. :type extension_parameters: ~azure.mgmt.hybridcompute.models.MachineExtensionUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -507,9 +507,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.MachineExtension] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -569,9 +567,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -587,8 +583,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -598,8 +595,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}" @@ -633,9 +638,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -705,9 +708,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MachineExtension] = kwargs.pop("cls", None) request = build_get_request( @@ -723,8 +724,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -767,9 +769,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MachineExtensionsListResult] = kwargs.pop("cls", None) error_map = { @@ -824,8 +824,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_machines_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_machines_operations.py index 82d87fe31a41..b756421b0e13 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_machines_operations.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_machines_operations.py @@ -6,8 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,26 +21,26 @@ ) 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._machines_operations import ( + build_assess_patches_request, build_delete_request, build_get_request, + build_install_patches_request, build_list_by_resource_group_request, build_list_by_subscription_request, ) from .._vendor import HybridComputeManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,7 +68,7 @@ def __init__(self, *args, **kwargs) -> None: async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, machine_name: str, **kwargs: Any ) -> None: - """The operation to remove a hybrid machine identity in Azure. + """The operation to delete a hybrid machine. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -91,9 +91,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -108,8 +106,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -160,9 +159,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Machine] = kwargs.pop("cls", None) request = build_get_request( @@ -178,8 +175,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -200,14 +198,380 @@ async def get( "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}" } + async def _assess_patches_initial( + self, resource_group_name: str, name: str, **kwargs: Any + ) -> Optional[_models.MachineAssessPatchesResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.MachineAssessPatchesResult]] = kwargs.pop("cls", None) + + request = build_assess_patches_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._assess_patches_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("MachineAssessPatchesResult", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _assess_patches_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{name}/assessPatches" + } + + @distributed_trace_async + async def begin_assess_patches( + self, resource_group_name: str, name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.MachineAssessPatchesResult]: + """The operation to assess patches on a hybrid machine identity in Azure. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param name: The name of the hybrid machine. Required. + :type 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 MachineAssessPatchesResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.MachineAssessPatchesResult] + :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.MachineAssessPatchesResult] = 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._assess_patches_initial( + resource_group_name=resource_group_name, + name=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): + deserialized = self._deserialize("MachineAssessPatchesResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_assess_patches.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{name}/assessPatches" + } + + async def _install_patches_initial( + self, + resource_group_name: str, + name: str, + install_patches_input: Union[_models.MachineInstallPatchesParameters, IO], + **kwargs: Any + ) -> Optional[_models.MachineInstallPatchesResult]: + 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.MachineInstallPatchesResult]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(install_patches_input, (IOBase, bytes)): + _content = install_patches_input + else: + _json = self._serialize.body(install_patches_input, "MachineInstallPatchesParameters") + + request = build_install_patches_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._install_patches_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("MachineInstallPatchesResult", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _install_patches_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{name}/installPatches" + } + + @overload + async def begin_install_patches( + self, + resource_group_name: str, + name: str, + install_patches_input: _models.MachineInstallPatchesParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MachineInstallPatchesResult]: + """The operation to install patches on a hybrid machine identity in Azure. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param name: The name of the hybrid machine. Required. + :type name: str + :param install_patches_input: Input for InstallPatches as directly received by the API. + Required. + :type install_patches_input: ~azure.mgmt.hybridcompute.models.MachineInstallPatchesParameters + :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 MachineInstallPatchesResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.MachineInstallPatchesResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_install_patches( + self, + resource_group_name: str, + name: str, + install_patches_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MachineInstallPatchesResult]: + """The operation to install patches on a hybrid machine identity in Azure. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param name: The name of the hybrid machine. Required. + :type name: str + :param install_patches_input: Input for InstallPatches as directly received by the API. + Required. + :type install_patches_input: 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 MachineInstallPatchesResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.MachineInstallPatchesResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_install_patches( + self, + resource_group_name: str, + name: str, + install_patches_input: Union[_models.MachineInstallPatchesParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.MachineInstallPatchesResult]: + """The operation to install patches on a hybrid machine identity in Azure. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param name: The name of the hybrid machine. Required. + :type name: str + :param install_patches_input: Input for InstallPatches as directly received by the API. Is + either a MachineInstallPatchesParameters type or a IO type. Required. + :type install_patches_input: ~azure.mgmt.hybridcompute.models.MachineInstallPatchesParameters + 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 MachineInstallPatchesResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.MachineInstallPatchesResult] + :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.MachineInstallPatchesResult] = 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._install_patches_initial( + resource_group_name=resource_group_name, + name=name, + install_patches_input=install_patches_input, + 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("MachineInstallPatchesResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_install_patches.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{name}/installPatches" + } + @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Machine"]: + def list_by_resource_group( + self, resource_group_name: str, expand: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.Machine"]: """Lists all the hybrid machines in the specified resource group. Use the nextLink property in the response to get the next page of hybrid machines. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str + :param expand: Expands referenced resources. Default value is None. + :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Machine or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.Machine] @@ -216,9 +580,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MachineListResult] = kwargs.pop("cls", None) error_map = { @@ -235,6 +597,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + expand=expand, api_version=api_version, template_url=self.list_by_resource_group.metadata["url"], headers=_headers, @@ -271,8 +634,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -302,9 +666,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Machine" _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MachineListResult] = kwargs.pop("cls", None) error_map = { @@ -356,8 +718,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_network_profile_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_network_profile_operations.py new file mode 100644 index 000000000000..b0cfb9ec8869 --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_network_profile_operations.py @@ -0,0 +1,115 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._network_profile_operations import build_get_request +from .._vendor import HybridComputeManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class NetworkProfileOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'s + :attr:`network_profile` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, resource_group_name: str, machine_name: str, **kwargs: Any) -> _models.NetworkProfile: + """The operation to get network information of hybrid machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkProfile or the result of cls(response) + :rtype: ~azure.mgmt.hybridcompute.models.NetworkProfile + :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.NetworkProfile] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + machine_name=machine_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("NetworkProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/networkProfile" + } diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_operations.py index 9f5348b29c3e..eeb92142bae1 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_operations.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from ...operations._operations import build_list_request from .._vendor import HybridComputeManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,9 +66,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { @@ -124,8 +117,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_private_endpoint_connections_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_private_endpoint_connections_operations.py index 060a70c71e0b..6522e3ab687e 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_private_endpoint_connections_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ ) from .._vendor import HybridComputeManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -95,9 +91,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) request = build_get_request( @@ -113,8 +107,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -154,16 +149,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PrivateEndpointConnection") @@ -184,8 +177,9 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -306,7 +300,7 @@ async def begin_create_or_update( :type scope_name: str :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a PrivateEndpointConnection type or a IO type. Required. :type parameters: ~azure.mgmt.hybridcompute.models.PrivateEndpointConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -328,9 +322,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -390,9 +382,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -408,8 +398,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -419,8 +410,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}" @@ -454,9 +453,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -518,9 +515,7 @@ def list_by_private_link_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { @@ -574,8 +569,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_private_link_resources_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_private_link_resources_operations.py index 631aff65c461..9225f541bdae 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_private_link_resources_operations.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_private_link_resources_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -32,10 +31,6 @@ from ...operations._private_link_resources_operations import build_get_request, build_list_by_private_link_scope_request from .._vendor import HybridComputeManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,9 +74,7 @@ def list_by_private_link_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) error_map = { @@ -135,8 +128,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -182,9 +176,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) request = build_get_request( @@ -200,8 +192,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_private_link_scopes_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_private_link_scopes_operations.py index c5d98c4beb86..3e546d00b9ce 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_private_link_scopes_operations.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_private_link_scopes_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -43,10 +43,6 @@ ) from .._vendor import HybridComputeManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,9 +80,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.HybridComputePrivateLink _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HybridComputePrivateLinkScopeListResult] = kwargs.pop("cls", None) error_map = { @@ -138,8 +132,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -173,9 +168,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HybridComputePrivateLinkScopeListResult] = kwargs.pop("cls", None) error_map = { @@ -228,8 +221,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -260,9 +254,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -277,8 +269,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -288,8 +281,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}" @@ -319,9 +320,7 @@ async def begin_delete(self, resource_group_name: str, scope_name: str, **kwargs _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -388,9 +387,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HybridComputePrivateLinkScope] = kwargs.pop("cls", None) request = build_get_request( @@ -405,8 +402,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -504,7 +502,8 @@ async def create_or_update( :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. :type scope_name: str :param parameters: Properties that need to be specified to create or update a Azure Arc for - Servers and Clusters PrivateLinkScope. Is either a model type or a IO type. Required. + Servers and Clusters PrivateLinkScope. Is either a HybridComputePrivateLinkScope type or a IO + type. Required. :type parameters: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -525,16 +524,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.HybridComputePrivateLinkScope] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "HybridComputePrivateLinkScope") @@ -554,8 +551,9 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -657,7 +655,7 @@ async def update_tags( :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. :type scope_name: str :param private_link_scope_tags: Updated tag information to set into the PrivateLinkScope - instance. Is either a model type or a IO type. Required. + instance. Is either a TagsResource type or a IO type. Required. :type private_link_scope_tags: ~azure.mgmt.hybridcompute.models.TagsResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -678,16 +676,14 @@ async def update_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.HybridComputePrivateLinkScope] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(private_link_scope_tags, (IO, bytes)): + if isinstance(private_link_scope_tags, (IOBase, bytes)): _content = private_link_scope_tags else: _json = self._serialize.body(private_link_scope_tags, "TagsResource") @@ -707,8 +703,9 @@ async def update_tags( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -756,9 +753,7 @@ async def get_validation_details( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkScopeValidationDetails] = kwargs.pop("cls", None) request = build_get_validation_details_request( @@ -773,8 +768,9 @@ async def get_validation_details( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -823,9 +819,7 @@ async def get_validation_details_for_machine( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkScopeValidationDetails] = kwargs.pop("cls", None) request = build_get_validation_details_for_machine_request( @@ -840,8 +834,9 @@ async def get_validation_details_for_machine( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/models/__init__.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/models/__init__.py index 2dfe40d65d6c..72a6efa52bf7 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/models/__init__.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/models/__init__.py @@ -7,31 +7,58 @@ # -------------------------------------------------------------------------- from ._models_py3 import AgentConfiguration +from ._models_py3 import AgentUpgrade +from ._models_py3 import AgentVersion +from ._models_py3 import AgentVersionsList +from ._models_py3 import AvailablePatchCountByClassification from ._models_py3 import CloudMetadata from ._models_py3 import ConfigurationExtension from ._models_py3 import ConnectionDetail from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorDetailAutoGenerated from ._models_py3 import ErrorResponse +from ._models_py3 import ErrorResponseAutoGenerated +from ._models_py3 import EsuKey from ._models_py3 import ExtensionTargetProperties +from ._models_py3 import ExtensionValue +from ._models_py3 import ExtensionValueListResult from ._models_py3 import HybridComputePrivateLinkScope from ._models_py3 import HybridComputePrivateLinkScopeListResult from ._models_py3 import HybridComputePrivateLinkScopeProperties +from ._models_py3 import HybridIdentityMetadata +from ._models_py3 import HybridIdentityMetadataList from ._models_py3 import Identity +from ._models_py3 import IpAddress +from ._models_py3 import License +from ._models_py3 import LicenseDetails +from ._models_py3 import LicenseProfile +from ._models_py3 import LicenseProfileArmEsuProperties +from ._models_py3 import LicenseProfileArmEsuPropertiesWithoutAssignedLicense +from ._models_py3 import LicenseProfileMachineInstanceView +from ._models_py3 import LicenseProfileMachineInstanceViewEsuProperties +from ._models_py3 import LicenseProfileStorageModelEsuProperties +from ._models_py3 import LicenseProfileUpdate +from ._models_py3 import LicenseProfilesListResult +from ._models_py3 import LicenseUpdate +from ._models_py3 import LicensesListResult +from ._models_py3 import LinuxParameters from ._models_py3 import LocationData from ._models_py3 import Machine +from ._models_py3 import MachineAssessPatchesResult from ._models_py3 import MachineExtension from ._models_py3 import MachineExtensionInstanceView from ._models_py3 import MachineExtensionInstanceViewStatus from ._models_py3 import MachineExtensionProperties from ._models_py3 import MachineExtensionUpdate -from ._models_py3 import MachineExtensionUpdateProperties from ._models_py3 import MachineExtensionUpgrade from ._models_py3 import MachineExtensionsListResult +from ._models_py3 import MachineInstallPatchesParameters +from ._models_py3 import MachineInstallPatchesResult from ._models_py3 import MachineListResult -from ._models_py3 import MachineProperties from ._models_py3 import MachineUpdate -from ._models_py3 import MachineUpdateProperties +from ._models_py3 import NetworkInterface +from ._models_py3 import NetworkProfile from ._models_py3 import OSProfile from ._models_py3 import OSProfileLinuxConfiguration from ._models_py3 import OSProfileWindowsConfiguration @@ -54,48 +81,98 @@ from ._models_py3 import ResourceUpdate from ._models_py3 import ServiceStatus from ._models_py3 import ServiceStatuses +from ._models_py3 import Subnet from ._models_py3 import SystemData from ._models_py3 import TagsResource from ._models_py3 import TrackedResource +from ._models_py3 import WindowsParameters +from ._hybrid_compute_management_client_enums import AgentConfigurationMode +from ._hybrid_compute_management_client_enums import ArcKindEnum from ._hybrid_compute_management_client_enums import AssessmentModeTypes from ._hybrid_compute_management_client_enums import CreatedByType +from ._hybrid_compute_management_client_enums import EsuEligibility +from ._hybrid_compute_management_client_enums import EsuKeyState +from ._hybrid_compute_management_client_enums import EsuServerType from ._hybrid_compute_management_client_enums import InstanceViewTypes +from ._hybrid_compute_management_client_enums import LastAttemptStatusEnum +from ._hybrid_compute_management_client_enums import LicenseAssignmentState +from ._hybrid_compute_management_client_enums import LicenseCoreType +from ._hybrid_compute_management_client_enums import LicenseEdition +from ._hybrid_compute_management_client_enums import LicenseState +from ._hybrid_compute_management_client_enums import LicenseTarget +from ._hybrid_compute_management_client_enums import LicenseType +from ._hybrid_compute_management_client_enums import OsType from ._hybrid_compute_management_client_enums import PatchModeTypes +from ._hybrid_compute_management_client_enums import PatchOperationStartedBy +from ._hybrid_compute_management_client_enums import PatchOperationStatus +from ._hybrid_compute_management_client_enums import PatchServiceUsed +from ._hybrid_compute_management_client_enums import ProvisioningState from ._hybrid_compute_management_client_enums import PublicNetworkAccessType from ._hybrid_compute_management_client_enums import StatusLevelTypes from ._hybrid_compute_management_client_enums import StatusTypes +from ._hybrid_compute_management_client_enums import VMGuestPatchClassificationLinux +from ._hybrid_compute_management_client_enums import VMGuestPatchClassificationWindows +from ._hybrid_compute_management_client_enums import VMGuestPatchRebootSetting +from ._hybrid_compute_management_client_enums import VMGuestPatchRebootStatus from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ "AgentConfiguration", + "AgentUpgrade", + "AgentVersion", + "AgentVersionsList", + "AvailablePatchCountByClassification", "CloudMetadata", "ConfigurationExtension", "ConnectionDetail", "ErrorAdditionalInfo", "ErrorDetail", + "ErrorDetailAutoGenerated", "ErrorResponse", + "ErrorResponseAutoGenerated", + "EsuKey", "ExtensionTargetProperties", + "ExtensionValue", + "ExtensionValueListResult", "HybridComputePrivateLinkScope", "HybridComputePrivateLinkScopeListResult", "HybridComputePrivateLinkScopeProperties", + "HybridIdentityMetadata", + "HybridIdentityMetadataList", "Identity", + "IpAddress", + "License", + "LicenseDetails", + "LicenseProfile", + "LicenseProfileArmEsuProperties", + "LicenseProfileArmEsuPropertiesWithoutAssignedLicense", + "LicenseProfileMachineInstanceView", + "LicenseProfileMachineInstanceViewEsuProperties", + "LicenseProfileStorageModelEsuProperties", + "LicenseProfileUpdate", + "LicenseProfilesListResult", + "LicenseUpdate", + "LicensesListResult", + "LinuxParameters", "LocationData", "Machine", + "MachineAssessPatchesResult", "MachineExtension", "MachineExtensionInstanceView", "MachineExtensionInstanceViewStatus", "MachineExtensionProperties", "MachineExtensionUpdate", - "MachineExtensionUpdateProperties", "MachineExtensionUpgrade", "MachineExtensionsListResult", + "MachineInstallPatchesParameters", + "MachineInstallPatchesResult", "MachineListResult", - "MachineProperties", "MachineUpdate", - "MachineUpdateProperties", + "NetworkInterface", + "NetworkProfile", "OSProfile", "OSProfileLinuxConfiguration", "OSProfileWindowsConfiguration", @@ -118,16 +195,39 @@ "ResourceUpdate", "ServiceStatus", "ServiceStatuses", + "Subnet", "SystemData", "TagsResource", "TrackedResource", + "WindowsParameters", + "AgentConfigurationMode", + "ArcKindEnum", "AssessmentModeTypes", "CreatedByType", + "EsuEligibility", + "EsuKeyState", + "EsuServerType", "InstanceViewTypes", + "LastAttemptStatusEnum", + "LicenseAssignmentState", + "LicenseCoreType", + "LicenseEdition", + "LicenseState", + "LicenseTarget", + "LicenseType", + "OsType", "PatchModeTypes", + "PatchOperationStartedBy", + "PatchOperationStatus", + "PatchServiceUsed", + "ProvisioningState", "PublicNetworkAccessType", "StatusLevelTypes", "StatusTypes", + "VMGuestPatchClassificationLinux", + "VMGuestPatchClassificationWindows", + "VMGuestPatchRebootSetting", + "VMGuestPatchRebootStatus", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/models/_hybrid_compute_management_client_enums.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/models/_hybrid_compute_management_client_enums.py index cf1430cbeb8a..8204e9c64222 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/models/_hybrid_compute_management_client_enums.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/models/_hybrid_compute_management_client_enums.py @@ -10,6 +10,27 @@ from azure.core import CaseInsensitiveEnumMeta +class AgentConfigurationMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Name of configuration mode to use. Modes are pre-defined configurations of security controls, + extension allowlists and guest configuration, maintained by Microsoft. + """ + + FULL = "full" + MONITOR = "monitor" + + +class ArcKindEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates which kind of Arc machine placement on-premises, such as HCI, SCVMM or VMware etc.""" + + AVS = "AVS" + HCI = "HCI" + SCVMM = "SCVMM" + V_MWARE = "VMware" + EPS = "EPS" + GCP = "GCP" + AWS = "AWS" + + class AssessmentModeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies the assessment mode.""" @@ -26,12 +47,89 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): KEY = "Key" +class EsuEligibility(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The ESU eligibility.""" + + ELIGIBLE = "Eligible" + INELIGIBLE = "Ineligible" + UNKNOWN = "Unknown" + + +class EsuKeyState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The ESU key state.""" + + INACTIVE = "Inactive" + ACTIVE = "Active" + + +class EsuServerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The server types for Esu.""" + + STANDARD = "Standard" + DATACENTER = "Datacenter" + + class InstanceViewTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """InstanceViewTypes.""" INSTANCE_VIEW = "instanceView" +class LastAttemptStatusEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies the status of Agent Upgrade.""" + + SUCCESS = "Success" + FAILED = "Failed" + + +class LicenseAssignmentState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes the license assignment state (Assigned or NotAssigned).""" + + ASSIGNED = "Assigned" + NOT_ASSIGNED = "NotAssigned" + + +class LicenseCoreType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes the license core type (pCore or vCore).""" + + P_CORE = "pCore" + V_CORE = "vCore" + + +class LicenseEdition(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes the edition of the license. The values are either Standard or Datacenter.""" + + STANDARD = "Standard" + DATACENTER = "Datacenter" + + +class LicenseState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes the state of the license.""" + + ACTIVATED = "Activated" + DEACTIVATED = "Deactivated" + + +class LicenseTarget(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes the license target server.""" + + WINDOWS_SERVER2012 = "Windows Server 2012" + WINDOWS_SERVER2012_R2 = "Windows Server 2012 R2" + + +class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of the license resource.""" + + ESU = "ESU" + + +class OsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The operating system type of the machine.""" + + WINDOWS = "Windows" + LINUX = "Linux" + + class PatchModeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies the patch mode.""" @@ -41,6 +139,50 @@ class PatchModeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): MANUAL = "Manual" +class PatchOperationStartedBy(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates if operation was triggered by user or by platform.""" + + USER = "User" + PLATFORM = "Platform" + + +class PatchOperationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The overall success or failure status of the operation. It remains "InProgress" until the + operation completes. At that point it will become "Unknown", "Failed", "Succeeded", or + "CompletedWithWarnings.". + """ + + UNKNOWN = "Unknown" + IN_PROGRESS = "InProgress" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + COMPLETED_WITH_WARNINGS = "CompletedWithWarnings" + + +class PatchServiceUsed(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies the patch service used for the operation.""" + + UNKNOWN = "Unknown" + WU = "WU" + WU_WSUS = "WU_WSUS" + YUM = "YUM" + APT = "APT" + ZYPPER = "Zypper" + + +class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The provisioning state, which only appears in the response.""" + + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + ACCEPTED = "Accepted" + CANCELED = "Canceled" + DELETED = "Deleted" + + class PublicNetworkAccessType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The network access policy to determine if Azure Arc agents can use public Azure Arc service endpoints. Defaults to disabled (access to Azure Arc services only via private link). @@ -68,3 +210,43 @@ class StatusTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): CONNECTED = "Connected" DISCONNECTED = "Disconnected" ERROR = "Error" + + +class VMGuestPatchClassificationLinux(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """VMGuestPatchClassificationLinux.""" + + CRITICAL = "Critical" + SECURITY = "Security" + OTHER = "Other" + + +class VMGuestPatchClassificationWindows(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """VMGuestPatchClassificationWindows.""" + + CRITICAL = "Critical" + SECURITY = "Security" + UPDATE_ROLL_UP = "UpdateRollUp" + FEATURE_PACK = "FeaturePack" + SERVICE_PACK = "ServicePack" + DEFINITION = "Definition" + TOOLS = "Tools" + UPDATES = "Updates" + + +class VMGuestPatchRebootSetting(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Defines when it is acceptable to reboot a VM during a software update operation.""" + + IF_REQUIRED = "IfRequired" + NEVER = "Never" + ALWAYS = "Always" + + +class VMGuestPatchRebootStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The reboot state of the VM following completion of the operation.""" + + UNKNOWN = "Unknown" + NOT_NEEDED = "NotNeeded" + REQUIRED = "Required" + STARTED = "Started" + FAILED = "Failed" + COMPLETED = "Completed" diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/models/_models_py3.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/models/_models_py3.py index 1a98ef511fa2..332ac4d14893 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/models/_models_py3.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/models/_models_py3.py @@ -13,10 +13,6 @@ from .. import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports if sys.version_info >= (3, 8): from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports else: @@ -25,7 +21,6 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object class AgentConfiguration(_serialization.Model): @@ -51,6 +46,10 @@ class AgentConfiguration(_serialization.Model): :ivar guest_configuration_enabled: Specified whether the guest configuration service is enabled or disabled. :vartype guest_configuration_enabled: str + :ivar config_mode: Name of configuration mode to use. Modes are pre-defined configurations of + security controls, extension allowlists and guest configuration, maintained by Microsoft. Known + values are: "full" and "monitor". + :vartype config_mode: str or ~azure.mgmt.hybridcompute.models.AgentConfigurationMode """ _validation = { @@ -61,6 +60,7 @@ class AgentConfiguration(_serialization.Model): "proxy_bypass": {"readonly": True}, "extensions_enabled": {"readonly": True}, "guest_configuration_enabled": {"readonly": True}, + "config_mode": {"readonly": True}, } _attribute_map = { @@ -71,6 +71,7 @@ class AgentConfiguration(_serialization.Model): "proxy_bypass": {"key": "proxyBypass", "type": "[str]"}, "extensions_enabled": {"key": "extensionsEnabled", "type": "str"}, "guest_configuration_enabled": {"key": "guestConfigurationEnabled", "type": "str"}, + "config_mode": {"key": "configMode", "type": "str"}, } def __init__(self, **kwargs: Any) -> None: @@ -83,6 +84,202 @@ def __init__(self, **kwargs: Any) -> None: self.proxy_bypass = None self.extensions_enabled = None self.guest_configuration_enabled = None + self.config_mode = None + + +class AgentUpgrade(_serialization.Model): + """The info w.r.t Agent Upgrade. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar desired_version: Specifies the version info w.r.t AgentUpgrade for the machine. + :vartype desired_version: str + :ivar correlation_id: The correlation ID passed in from RSM per upgrade. + :vartype correlation_id: str + :ivar enable_automatic_upgrade: Specifies if RSM should try to upgrade this machine. + :vartype enable_automatic_upgrade: bool + :ivar last_attempt_desired_version: Specifies the version of the last attempt. + :vartype last_attempt_desired_version: str + :ivar last_attempt_timestamp: Timestamp of last upgrade attempt. + :vartype last_attempt_timestamp: str + :ivar last_attempt_status: Specifies the status of Agent Upgrade. Known values are: "Success" + and "Failed". + :vartype last_attempt_status: str or ~azure.mgmt.hybridcompute.models.LastAttemptStatusEnum + :ivar last_attempt_message: Failure message of last upgrade attempt if any. + :vartype last_attempt_message: str + """ + + _validation = { + "last_attempt_desired_version": {"readonly": True}, + "last_attempt_timestamp": {"readonly": True}, + "last_attempt_status": {"readonly": True}, + "last_attempt_message": {"readonly": True}, + } + + _attribute_map = { + "desired_version": {"key": "desiredVersion", "type": "str"}, + "correlation_id": {"key": "correlationId", "type": "str"}, + "enable_automatic_upgrade": {"key": "enableAutomaticUpgrade", "type": "bool"}, + "last_attempt_desired_version": {"key": "lastAttemptDesiredVersion", "type": "str"}, + "last_attempt_timestamp": {"key": "lastAttemptTimestamp", "type": "str"}, + "last_attempt_status": {"key": "lastAttemptStatus", "type": "str"}, + "last_attempt_message": {"key": "lastAttemptMessage", "type": "str"}, + } + + def __init__( + self, + *, + desired_version: Optional[str] = None, + correlation_id: Optional[str] = None, + enable_automatic_upgrade: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword desired_version: Specifies the version info w.r.t AgentUpgrade for the machine. + :paramtype desired_version: str + :keyword correlation_id: The correlation ID passed in from RSM per upgrade. + :paramtype correlation_id: str + :keyword enable_automatic_upgrade: Specifies if RSM should try to upgrade this machine. + :paramtype enable_automatic_upgrade: bool + """ + super().__init__(**kwargs) + self.desired_version = desired_version + self.correlation_id = correlation_id + self.enable_automatic_upgrade = enable_automatic_upgrade + self.last_attempt_desired_version = None + self.last_attempt_timestamp = None + self.last_attempt_status = None + self.last_attempt_message = None + + +class AgentVersion(_serialization.Model): + """Describes properties of Agent Version. + + :ivar agent_version: Represents the agent version. + :vartype agent_version: str + :ivar download_link: Represents the download link of specific agent version. + :vartype download_link: str + :ivar os_type: Defines the os type. + :vartype os_type: str + """ + + _attribute_map = { + "agent_version": {"key": "agentVersion", "type": "str"}, + "download_link": {"key": "downloadLink", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + } + + def __init__( + self, + *, + agent_version: Optional[str] = None, + download_link: Optional[str] = None, + os_type: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword agent_version: Represents the agent version. + :paramtype agent_version: str + :keyword download_link: Represents the download link of specific agent version. + :paramtype download_link: str + :keyword os_type: Defines the os type. + :paramtype os_type: str + """ + super().__init__(**kwargs) + self.agent_version = agent_version + self.download_link = download_link + self.os_type = os_type + + +class AgentVersionsList(_serialization.Model): + """Describes AgentVersions List. + + :ivar value: The list of available Agent Versions. + :vartype value: list[~azure.mgmt.hybridcompute.models.AgentVersion] + :ivar next_link: The URI to fetch the next 10 available Agent Versions. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[AgentVersion]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.AgentVersion"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The list of available Agent Versions. + :paramtype value: list[~azure.mgmt.hybridcompute.models.AgentVersion] + :keyword next_link: The URI to fetch the next 10 available Agent Versions. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class AvailablePatchCountByClassification(_serialization.Model): + """Summarization of patches available for installation on the machine by classification. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar security: Number of security patches available for installation. + :vartype security: int + :ivar critical: Number of critical patches available for installation. + :vartype critical: int + :ivar definition: Number of definition patches available for installation. + :vartype definition: int + :ivar update_rollup: Number of update Rollup patches available for installation. + :vartype update_rollup: int + :ivar feature_pack: Number of feature pack patches available for installation. + :vartype feature_pack: int + :ivar service_pack: Number of service pack patches available for installation. + :vartype service_pack: int + :ivar tools: Number of tools patches available for installation. + :vartype tools: int + :ivar updates: Number of updates category patches available for installation. + :vartype updates: int + :ivar other: Number of other patches available for installation. + :vartype other: int + """ + + _validation = { + "security": {"readonly": True}, + "critical": {"readonly": True}, + "definition": {"readonly": True}, + "update_rollup": {"readonly": True}, + "feature_pack": {"readonly": True}, + "service_pack": {"readonly": True}, + "tools": {"readonly": True}, + "updates": {"readonly": True}, + "other": {"readonly": True}, + } + + _attribute_map = { + "security": {"key": "security", "type": "int"}, + "critical": {"key": "critical", "type": "int"}, + "definition": {"key": "definition", "type": "int"}, + "update_rollup": {"key": "updateRollup", "type": "int"}, + "feature_pack": {"key": "featurePack", "type": "int"}, + "service_pack": {"key": "servicePack", "type": "int"}, + "tools": {"key": "tools", "type": "int"}, + "updates": {"key": "updates", "type": "int"}, + "other": {"key": "other", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.security = None + self.critical = None + self.definition = None + self.update_rollup = None + self.feature_pack = None + self.service_pack = None + self.tools = None + self.updates = None + self.other = None class CloudMetadata(_serialization.Model): @@ -250,6 +447,49 @@ def __init__(self, **kwargs: Any) -> None: self.additional_info = None +class ErrorDetailAutoGenerated(_serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.hybridcompute.models.ErrorDetailAutoGenerated] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.hybridcompute.models.ErrorAdditionalInfo] + """ + + _validation = { + "code": {"readonly": True}, + "message": {"readonly": True}, + "target": {"readonly": True}, + "details": {"readonly": True}, + "additional_info": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ErrorDetailAutoGenerated]"}, + "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + class ErrorResponse(_serialization.Model): """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). @@ -271,6 +511,53 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: A self.error = error +class ErrorResponseAutoGenerated(_serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). + + :ivar error: The error object. + :vartype error: ~azure.mgmt.hybridcompute.models.ErrorDetailAutoGenerated + """ + + _attribute_map = { + "error": {"key": "error", "type": "ErrorDetailAutoGenerated"}, + } + + def __init__(self, *, error: Optional["_models.ErrorDetailAutoGenerated"] = None, **kwargs: Any) -> None: + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.hybridcompute.models.ErrorDetailAutoGenerated + """ + super().__init__(**kwargs) + self.error = error + + +class EsuKey(_serialization.Model): + """ESU key. + + :ivar sku: SKU number. + :vartype sku: str + :ivar license_status: The current status of the license profile key. + :vartype license_status: str + """ + + _attribute_map = { + "sku": {"key": "sku", "type": "str"}, + "license_status": {"key": "licenseStatus", "type": "str"}, + } + + def __init__(self, *, sku: Optional[str] = None, license_status: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword sku: SKU number. + :paramtype sku: str + :keyword license_status: The current status of the license profile key. + :paramtype license_status: str + """ + super().__init__(**kwargs) + self.sku = sku + self.license_status = license_status + + class ExtensionTargetProperties(_serialization.Model): """Describes the Machine Extension Target Version Properties. @@ -291,75 +578,63 @@ def __init__(self, *, target_version: Optional[str] = None, **kwargs: Any) -> No self.target_version = target_version -class PrivateLinkScopesResource(_serialization.Model): - """An azure resource object. +class Resource(_serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - - :ivar id: Azure resource Id. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Azure resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Azure 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. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.hybridcompute.models.SystemData """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "location": {"required": True}, + "system_data": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, + "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) self.id = None self.name = None self.type = None - self.location = location - self.tags = tags + self.system_data = None -class HybridComputePrivateLinkScope(PrivateLinkScopesResource): - """An Azure Arc PrivateLinkScope definition. +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. - All required parameters must be populated in order to send to Azure. - - :ivar id: Azure resource Id. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Azure resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Azure 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. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar properties: Properties that define a Azure Arc PrivateLinkScope resource. - :vartype properties: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScopeProperties - :ivar system_data: The system meta data relating to this resource. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.hybridcompute.models.SystemData """ @@ -367,7 +642,6 @@ class HybridComputePrivateLinkScope(PrivateLinkScopesResource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "location": {"required": True}, "system_data": {"readonly": True}, } @@ -375,48 +649,215 @@ class HybridComputePrivateLinkScope(PrivateLinkScopesResource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "properties": {"key": "properties", "type": "HybridComputePrivateLinkScopeProperties"}, "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.HybridComputePrivateLinkScopeProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword properties: Properties that define a Azure Arc PrivateLinkScope resource. - :paramtype properties: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScopeProperties - """ - super().__init__(location=location, tags=tags, **kwargs) - self.properties = properties - self.system_data = None + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) -class HybridComputePrivateLinkScopeListResult(_serialization.Model): - """Describes the list of Azure Arc PrivateLinkScope resources. +class ExtensionValue(ProxyResource): + """Describes a Extension Metadata. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: List of Azure Arc PrivateLinkScope definitions. Required. - :vartype value: list[~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope] - :ivar next_link: The URI to get the next set of Azure Arc PrivateLinkScope definitions if too - many PrivateLinkScopes where returned in the result set. - :vartype next_link: str + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.hybridcompute.models.SystemData + :ivar version: The version of the Extension being received. + :vartype version: str + :ivar extension_type: The type of the Extension being received. + :vartype extension_type: str + :ivar publisher: The publisher of the Extension being received. + :vartype publisher: str """ _validation = { - "value": {"required": True}, - } + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "version": {"readonly": True}, + "extension_type": {"readonly": True}, + "publisher": {"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"}, + "version": {"key": "properties.version", "type": "str"}, + "extension_type": {"key": "properties.extensionType", "type": "str"}, + "publisher": {"key": "properties.publisher", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.version = None + self.extension_type = None + self.publisher = None + + +class ExtensionValueListResult(_serialization.Model): + """The List Extension Metadata response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of extension metadata. + :vartype value: list[~azure.mgmt.hybridcompute.models.ExtensionValue] + """ + + _validation = { + "value": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ExtensionValue]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + + +class PrivateLinkScopesResource(_serialization.Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :ivar location: Resource location. Required. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"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"}, + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword location: Resource location. Required. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class HybridComputePrivateLinkScope(PrivateLinkScopesResource): + """An Azure Arc PrivateLinkScope definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :ivar location: Resource location. Required. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: Properties that define a Azure Arc PrivateLinkScope resource. + :vartype properties: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScopeProperties + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.hybridcompute.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "properties": {"key": "properties", "type": "HybridComputePrivateLinkScopeProperties"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.HybridComputePrivateLinkScopeProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: Resource location. Required. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword properties: Properties that define a Azure Arc PrivateLinkScope resource. + :paramtype properties: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScopeProperties + """ + super().__init__(location=location, tags=tags, **kwargs) + self.properties = properties + self.system_data = None + + +class HybridComputePrivateLinkScopeListResult(_serialization.Model): + """Describes the list of Azure Arc PrivateLinkScope resources. + + All required parameters must be populated in order to send to Azure. + + :ivar value: List of Azure Arc PrivateLinkScope definitions. Required. + :vartype value: list[~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope] + :ivar next_link: The URI to get the next set of Azure Arc PrivateLinkScope definitions if too + many PrivateLinkScopes where returned in the result set. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } _attribute_map = { "value": {"key": "value", "type": "[HybridComputePrivateLinkScope]"}, @@ -490,6 +931,95 @@ def __init__( self.private_endpoint_connections = None +class HybridIdentityMetadata(ProxyResource): + """Defines the HybridIdentityMetadata. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.hybridcompute.models.SystemData + :ivar vm_id: The unique identifier for the resource. + :vartype vm_id: str + :ivar public_key: The Public Key. + :vartype public_key: str + :ivar identity: Identity for the resource. + :vartype identity: ~azure.mgmt.hybridcompute.models.Identity + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "identity": {"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"}, + "vm_id": {"key": "properties.vmId", "type": "str"}, + "public_key": {"key": "properties.publicKey", "type": "str"}, + "identity": {"key": "properties.identity", "type": "Identity"}, + } + + def __init__(self, *, vm_id: Optional[str] = None, public_key: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword vm_id: The unique identifier for the resource. + :paramtype vm_id: str + :keyword public_key: The Public Key. + :paramtype public_key: str + """ + super().__init__(**kwargs) + self.vm_id = vm_id + self.public_key = public_key + self.identity = None + + +class HybridIdentityMetadataList(_serialization.Model): + """List of HybridIdentityMetadata. + + All required parameters must be populated in order to send to Azure. + + :ivar next_link: Url to follow for getting next page of HybridIdentityMetadata. + :vartype next_link: str + :ivar value: Array of HybridIdentityMetadata. Required. + :vartype value: list[~azure.mgmt.hybridcompute.models.HybridIdentityMetadata] + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[HybridIdentityMetadata]"}, + } + + def __init__( + self, *, value: List["_models.HybridIdentityMetadata"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword next_link: Url to follow for getting next page of HybridIdentityMetadata. + :paramtype next_link: str + :keyword value: Array of HybridIdentityMetadata. Required. + :paramtype value: list[~azure.mgmt.hybridcompute.models.HybridIdentityMetadata] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + class Identity(_serialization.Model): """Identity for the resource. @@ -525,63 +1055,52 @@ def __init__(self, *, type: Optional[Literal["SystemAssigned"]] = None, **kwargs self.type = type -class LocationData(_serialization.Model): - """Metadata pertaining to the geographic location of the resource. +class IpAddress(_serialization.Model): + """Describes properties of the IP address. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: A canonical name for the geographic or physical location. Required. - :vartype name: str - :ivar city: The city or locality where the resource is located. - :vartype city: str - :ivar district: The district, state, or province where the resource is located. - :vartype district: str - :ivar country_or_region: The country or region where the resource is located. - :vartype country_or_region: str + :ivar address: Represents the IP Address. + :vartype address: str + :ivar ip_address_version: Represents the Ip Address Version. + :vartype ip_address_version: str + :ivar subnet: The subnet to which this IP address belongs. + :vartype subnet: ~azure.mgmt.hybridcompute.models.Subnet """ _validation = { - "name": {"required": True, "max_length": 256}, + "subnet": {"readonly": True}, } _attribute_map = { - "name": {"key": "name", "type": "str"}, - "city": {"key": "city", "type": "str"}, - "district": {"key": "district", "type": "str"}, - "country_or_region": {"key": "countryOrRegion", "type": "str"}, + "address": {"key": "address", "type": "str"}, + "ip_address_version": {"key": "ipAddressVersion", "type": "str"}, + "subnet": {"key": "subnet", "type": "Subnet"}, } def __init__( - self, - *, - name: str, - city: Optional[str] = None, - district: Optional[str] = None, - country_or_region: Optional[str] = None, - **kwargs: Any + self, *, address: Optional[str] = None, ip_address_version: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword name: A canonical name for the geographic or physical location. Required. - :paramtype name: str - :keyword city: The city or locality where the resource is located. - :paramtype city: str - :keyword district: The district, state, or province where the resource is located. - :paramtype district: str - :keyword country_or_region: The country or region where the resource is located. - :paramtype country_or_region: str + :keyword address: Represents the IP Address. + :paramtype address: str + :keyword ip_address_version: Represents the Ip Address Version. + :paramtype ip_address_version: str """ super().__init__(**kwargs) - self.name = name - self.city = city - self.district = district - self.country_or_region = country_or_region + self.address = address + self.ip_address_version = ip_address_version + self.subnet = None -class Resource(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. + :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str @@ -590,31 +1109,46 @@ class Resource(_serialization.Model): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.hybridcompute.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.tags = tags + self.location = location -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which - has 'tags' and a 'location'. +class License(TrackedResource): + """Describes a license in a hybrid machine. Variables are only populated by the server, and will be ignored when sending a request. @@ -628,40 +1162,746 @@ class TrackedResource(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.hybridcompute.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. :vartype location: str + :ivar provisioning_state: The provisioning state, which only appears in the response. Known + values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Accepted", "Canceled", + and "Deleted". + :vartype provisioning_state: str or ~azure.mgmt.hybridcompute.models.ProvisioningState + :ivar tenant_id: Describes the tenant id. + :vartype tenant_id: str + :ivar license_type: The type of the license resource. "ESU" + :vartype license_type: str or ~azure.mgmt.hybridcompute.models.LicenseType + :ivar license_details: Describes the properties of a License. + :vartype license_details: ~azure.mgmt.hybridcompute.models.LicenseDetails """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "location": {"required": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "tenant_id": {"key": "properties.tenantId", "type": "str"}, + "license_type": {"key": "properties.licenseType", "type": "str"}, + "license_details": {"key": "properties.licenseDetails", "type": "LicenseDetails"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + tenant_id: Optional[str] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, + license_details: Optional["_models.LicenseDetails"] = None, + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword location: The geo-location where the resource lives. Required. :paramtype location: str + :keyword tenant_id: Describes the tenant id. + :paramtype tenant_id: str + :keyword license_type: The type of the license resource. "ESU" + :paramtype license_type: str or ~azure.mgmt.hybridcompute.models.LicenseType + :keyword license_details: Describes the properties of a License. + :paramtype license_details: ~azure.mgmt.hybridcompute.models.LicenseDetails + """ + super().__init__(tags=tags, location=location, **kwargs) + self.provisioning_state = None + self.tenant_id = tenant_id + self.license_type = license_type + self.license_details = license_details + + +class LicenseDetails(_serialization.Model): + """Describes the properties of a License. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar state: Describes the state of the license. Known values are: "Activated" and + "Deactivated". + :vartype state: str or ~azure.mgmt.hybridcompute.models.LicenseState + :ivar target: Describes the license target server. Known values are: "Windows Server 2012" and + "Windows Server 2012 R2". + :vartype target: str or ~azure.mgmt.hybridcompute.models.LicenseTarget + :ivar edition: Describes the edition of the license. The values are either Standard or + Datacenter. Known values are: "Standard" and "Datacenter". + :vartype edition: str or ~azure.mgmt.hybridcompute.models.LicenseEdition + :ivar type: Describes the license core type (pCore or vCore). Known values are: "pCore" and + "vCore". + :vartype type: str or ~azure.mgmt.hybridcompute.models.LicenseCoreType + :ivar processors: Describes the number of processors. + :vartype processors: int + :ivar assigned_licenses: Describes the number of assigned licenses. + :vartype assigned_licenses: int + :ivar immutable_id: Describes the immutable id. + :vartype immutable_id: str + """ + + _validation = { + "assigned_licenses": {"readonly": True}, + "immutable_id": {"readonly": True}, + } + + _attribute_map = { + "state": {"key": "state", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "edition": {"key": "edition", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "processors": {"key": "processors", "type": "int"}, + "assigned_licenses": {"key": "assignedLicenses", "type": "int"}, + "immutable_id": {"key": "immutableId", "type": "str"}, + } + + def __init__( + self, + *, + state: Optional[Union[str, "_models.LicenseState"]] = None, + target: Optional[Union[str, "_models.LicenseTarget"]] = None, + edition: Optional[Union[str, "_models.LicenseEdition"]] = None, + type: Optional[Union[str, "_models.LicenseCoreType"]] = None, + processors: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword state: Describes the state of the license. Known values are: "Activated" and + "Deactivated". + :paramtype state: str or ~azure.mgmt.hybridcompute.models.LicenseState + :keyword target: Describes the license target server. Known values are: "Windows Server 2012" + and "Windows Server 2012 R2". + :paramtype target: str or ~azure.mgmt.hybridcompute.models.LicenseTarget + :keyword edition: Describes the edition of the license. The values are either Standard or + Datacenter. Known values are: "Standard" and "Datacenter". + :paramtype edition: str or ~azure.mgmt.hybridcompute.models.LicenseEdition + :keyword type: Describes the license core type (pCore or vCore). Known values are: "pCore" and + "vCore". + :paramtype type: str or ~azure.mgmt.hybridcompute.models.LicenseCoreType + :keyword processors: Describes the number of processors. + :paramtype processors: int + """ + super().__init__(**kwargs) + self.state = state + self.target = target + self.edition = edition + self.type = type + self.processors = processors + self.assigned_licenses = None + self.immutable_id = None + + +class LicenseProfile(TrackedResource): # pylint: disable=too-many-instance-attributes + """Describes a license profile in a hybrid machine. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.hybridcompute.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar provisioning_state: The provisioning state, which only appears in the response. Known + values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Accepted", "Canceled", + and "Deleted". + :vartype provisioning_state: str or ~azure.mgmt.hybridcompute.models.ProvisioningState + :ivar assigned_license_immutable_id: The guid id of the license. + :vartype assigned_license_immutable_id: str + :ivar esu_keys: The list of ESU keys. + :vartype esu_keys: list[~azure.mgmt.hybridcompute.models.EsuKey] + :ivar server_type: The type of the Esu servers. Known values are: "Standard" and "Datacenter". + :vartype server_type: str or ~azure.mgmt.hybridcompute.models.EsuServerType + :ivar esu_eligibility: Indicates the eligibility state of Esu. Known values are: "Eligible", + "Ineligible", and "Unknown". + :vartype esu_eligibility: str or ~azure.mgmt.hybridcompute.models.EsuEligibility + :ivar esu_key_state: Indicates whether there is an ESU Key currently active for the machine. + Known values are: "Inactive" and "Active". + :vartype esu_key_state: str or ~azure.mgmt.hybridcompute.models.EsuKeyState + :ivar assigned_license: The resource id of the license. + :vartype assigned_license: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "assigned_license_immutable_id": {"readonly": True}, + "esu_keys": {"readonly": True}, + "server_type": {"readonly": True}, + "esu_eligibility": {"readonly": True}, + "esu_key_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "assigned_license_immutable_id": {"key": "properties.esuProfile.assignedLicenseImmutableId", "type": "str"}, + "esu_keys": {"key": "properties.esuProfile.esuKeys", "type": "[EsuKey]"}, + "server_type": {"key": "properties.esuProfile.serverType", "type": "str"}, + "esu_eligibility": {"key": "properties.esuProfile.esuEligibility", "type": "str"}, + "esu_key_state": {"key": "properties.esuProfile.esuKeyState", "type": "str"}, + "assigned_license": {"key": "properties.esuProfile.assignedLicense", "type": "str"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + assigned_license: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword assigned_license: The resource id of the license. + :paramtype assigned_license: str + """ + super().__init__(tags=tags, location=location, **kwargs) + self.provisioning_state = None + self.assigned_license_immutable_id = None + self.esu_keys = None + self.server_type = None + self.esu_eligibility = None + self.esu_key_state = None + self.assigned_license = assigned_license + + +class LicenseProfileStorageModelEsuProperties(_serialization.Model): + """License profile storage model for ESU properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar assigned_license_immutable_id: The guid id of the license. + :vartype assigned_license_immutable_id: str + :ivar esu_keys: The list of ESU keys. + :vartype esu_keys: list[~azure.mgmt.hybridcompute.models.EsuKey] + """ + + _validation = { + "assigned_license_immutable_id": {"readonly": True}, + "esu_keys": {"readonly": True}, + } + + _attribute_map = { + "assigned_license_immutable_id": {"key": "assignedLicenseImmutableId", "type": "str"}, + "esu_keys": {"key": "esuKeys", "type": "[EsuKey]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.assigned_license_immutable_id = None + self.esu_keys = None + + +class LicenseProfileArmEsuPropertiesWithoutAssignedLicense(LicenseProfileStorageModelEsuProperties): + """Describes the properties of a License Profile ARM model. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar assigned_license_immutable_id: The guid id of the license. + :vartype assigned_license_immutable_id: str + :ivar esu_keys: The list of ESU keys. + :vartype esu_keys: list[~azure.mgmt.hybridcompute.models.EsuKey] + :ivar server_type: The type of the Esu servers. Known values are: "Standard" and "Datacenter". + :vartype server_type: str or ~azure.mgmt.hybridcompute.models.EsuServerType + :ivar esu_eligibility: Indicates the eligibility state of Esu. Known values are: "Eligible", + "Ineligible", and "Unknown". + :vartype esu_eligibility: str or ~azure.mgmt.hybridcompute.models.EsuEligibility + :ivar esu_key_state: Indicates whether there is an ESU Key currently active for the machine. + Known values are: "Inactive" and "Active". + :vartype esu_key_state: str or ~azure.mgmt.hybridcompute.models.EsuKeyState + """ + + _validation = { + "assigned_license_immutable_id": {"readonly": True}, + "esu_keys": {"readonly": True}, + "server_type": {"readonly": True}, + "esu_eligibility": {"readonly": True}, + "esu_key_state": {"readonly": True}, + } + + _attribute_map = { + "assigned_license_immutable_id": {"key": "assignedLicenseImmutableId", "type": "str"}, + "esu_keys": {"key": "esuKeys", "type": "[EsuKey]"}, + "server_type": {"key": "serverType", "type": "str"}, + "esu_eligibility": {"key": "esuEligibility", "type": "str"}, + "esu_key_state": {"key": "esuKeyState", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.server_type = None + self.esu_eligibility = None + self.esu_key_state = None + + +class LicenseProfileArmEsuProperties(LicenseProfileArmEsuPropertiesWithoutAssignedLicense): + """Describes the properties of a License Profile ARM model. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar assigned_license_immutable_id: The guid id of the license. + :vartype assigned_license_immutable_id: str + :ivar esu_keys: The list of ESU keys. + :vartype esu_keys: list[~azure.mgmt.hybridcompute.models.EsuKey] + :ivar server_type: The type of the Esu servers. Known values are: "Standard" and "Datacenter". + :vartype server_type: str or ~azure.mgmt.hybridcompute.models.EsuServerType + :ivar esu_eligibility: Indicates the eligibility state of Esu. Known values are: "Eligible", + "Ineligible", and "Unknown". + :vartype esu_eligibility: str or ~azure.mgmt.hybridcompute.models.EsuEligibility + :ivar esu_key_state: Indicates whether there is an ESU Key currently active for the machine. + Known values are: "Inactive" and "Active". + :vartype esu_key_state: str or ~azure.mgmt.hybridcompute.models.EsuKeyState + :ivar assigned_license: The resource id of the license. + :vartype assigned_license: str + """ + + _validation = { + "assigned_license_immutable_id": {"readonly": True}, + "esu_keys": {"readonly": True}, + "server_type": {"readonly": True}, + "esu_eligibility": {"readonly": True}, + "esu_key_state": {"readonly": True}, + } + + _attribute_map = { + "assigned_license_immutable_id": {"key": "assignedLicenseImmutableId", "type": "str"}, + "esu_keys": {"key": "esuKeys", "type": "[EsuKey]"}, + "server_type": {"key": "serverType", "type": "str"}, + "esu_eligibility": {"key": "esuEligibility", "type": "str"}, + "esu_key_state": {"key": "esuKeyState", "type": "str"}, + "assigned_license": {"key": "assignedLicense", "type": "str"}, + } + + def __init__(self, *, assigned_license: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword assigned_license: The resource id of the license. + :paramtype assigned_license: str + """ + super().__init__(**kwargs) + self.assigned_license = assigned_license + + +class LicenseProfileMachineInstanceView(_serialization.Model): + """License Profile Instance View in Machine Properties. + + :ivar esu_profile: Properties for the Machine ESU profile. + :vartype esu_profile: + ~azure.mgmt.hybridcompute.models.LicenseProfileMachineInstanceViewEsuProperties + """ + + _attribute_map = { + "esu_profile": {"key": "esuProfile", "type": "LicenseProfileMachineInstanceViewEsuProperties"}, + } + + def __init__( + self, *, esu_profile: Optional["_models.LicenseProfileMachineInstanceViewEsuProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword esu_profile: Properties for the Machine ESU profile. + :paramtype esu_profile: + ~azure.mgmt.hybridcompute.models.LicenseProfileMachineInstanceViewEsuProperties + """ + super().__init__(**kwargs) + self.esu_profile = esu_profile + + +class LicenseProfileMachineInstanceViewEsuProperties(LicenseProfileArmEsuPropertiesWithoutAssignedLicense): + """Properties for the Machine ESU profile. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar assigned_license_immutable_id: The guid id of the license. + :vartype assigned_license_immutable_id: str + :ivar esu_keys: The list of ESU keys. + :vartype esu_keys: list[~azure.mgmt.hybridcompute.models.EsuKey] + :ivar server_type: The type of the Esu servers. Known values are: "Standard" and "Datacenter". + :vartype server_type: str or ~azure.mgmt.hybridcompute.models.EsuServerType + :ivar esu_eligibility: Indicates the eligibility state of Esu. Known values are: "Eligible", + "Ineligible", and "Unknown". + :vartype esu_eligibility: str or ~azure.mgmt.hybridcompute.models.EsuEligibility + :ivar esu_key_state: Indicates whether there is an ESU Key currently active for the machine. + Known values are: "Inactive" and "Active". + :vartype esu_key_state: str or ~azure.mgmt.hybridcompute.models.EsuKeyState + :ivar assigned_license: The assigned license resource. + :vartype assigned_license: ~azure.mgmt.hybridcompute.models.License + :ivar license_assignment_state: Describes the license assignment state (Assigned or + NotAssigned). Known values are: "Assigned" and "NotAssigned". + :vartype license_assignment_state: str or + ~azure.mgmt.hybridcompute.models.LicenseAssignmentState + """ + + _validation = { + "assigned_license_immutable_id": {"readonly": True}, + "esu_keys": {"readonly": True}, + "server_type": {"readonly": True}, + "esu_eligibility": {"readonly": True}, + "esu_key_state": {"readonly": True}, + } + + _attribute_map = { + "assigned_license_immutable_id": {"key": "assignedLicenseImmutableId", "type": "str"}, + "esu_keys": {"key": "esuKeys", "type": "[EsuKey]"}, + "server_type": {"key": "serverType", "type": "str"}, + "esu_eligibility": {"key": "esuEligibility", "type": "str"}, + "esu_key_state": {"key": "esuKeyState", "type": "str"}, + "assigned_license": {"key": "assignedLicense", "type": "License"}, + "license_assignment_state": {"key": "licenseAssignmentState", "type": "str"}, + } + + def __init__( + self, + *, + assigned_license: Optional["_models.License"] = None, + license_assignment_state: Optional[Union[str, "_models.LicenseAssignmentState"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword assigned_license: The assigned license resource. + :paramtype assigned_license: ~azure.mgmt.hybridcompute.models.License + :keyword license_assignment_state: Describes the license assignment state (Assigned or + NotAssigned). Known values are: "Assigned" and "NotAssigned". + :paramtype license_assignment_state: str or + ~azure.mgmt.hybridcompute.models.LicenseAssignmentState + """ + super().__init__(**kwargs) + self.assigned_license = assigned_license + self.license_assignment_state = license_assignment_state + + +class LicenseProfilesListResult(_serialization.Model): + """The List hybrid machine license profile operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: The list of license profiles. Required. + :vartype value: list[~azure.mgmt.hybridcompute.models.LicenseProfile] + :ivar next_link: The URI to fetch the next page of Machines. Call ListNext() with this URI to + fetch the next page of license profile. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[LicenseProfile]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.LicenseProfile"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The list of license profiles. Required. + :paramtype value: list[~azure.mgmt.hybridcompute.models.LicenseProfile] + :keyword next_link: The URI to fetch the next page of Machines. Call ListNext() with this URI + to fetch the next page of license profile. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ResourceUpdate(_serialization.Model): + """The Update Resource model definition. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] """ super().__init__(**kwargs) self.tags = tags - self.location = location -class Machine(TrackedResource): +class LicenseProfileUpdate(ResourceUpdate): + """Describes a License Profile Update. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar assigned_license: The resource id of the license. + :vartype assigned_license: str + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "assigned_license": {"key": "properties.esuProfile.assignedLicense", "type": "str"}, + } + + def __init__( + self, *, tags: Optional[Dict[str, str]] = None, assigned_license: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword assigned_license: The resource id of the license. + :paramtype assigned_license: str + """ + super().__init__(tags=tags, **kwargs) + self.assigned_license = assigned_license + + +class LicensesListResult(_serialization.Model): + """The List license operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: The list of licenses. Required. + :vartype value: list[~azure.mgmt.hybridcompute.models.License] + :ivar next_link: The URI to fetch the next page of Machines. Call ListNext() with this URI to + fetch the next page of license profile. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[License]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.License"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The list of licenses. Required. + :paramtype value: list[~azure.mgmt.hybridcompute.models.License] + :keyword next_link: The URI to fetch the next page of Machines. Call ListNext() with this URI + to fetch the next page of license profile. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class LicenseUpdate(ResourceUpdate): + """Describes a License Update. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar license_type: The type of the license resource. "ESU" + :vartype license_type: str or ~azure.mgmt.hybridcompute.models.LicenseType + :ivar state: Describes the state of the license. Known values are: "Activated" and + "Deactivated". + :vartype state: str or ~azure.mgmt.hybridcompute.models.LicenseState + :ivar target: Describes the license target server. Known values are: "Windows Server 2012" and + "Windows Server 2012 R2". + :vartype target: str or ~azure.mgmt.hybridcompute.models.LicenseTarget + :ivar edition: Describes the edition of the license. The values are either Standard or + Datacenter. Known values are: "Standard" and "Datacenter". + :vartype edition: str or ~azure.mgmt.hybridcompute.models.LicenseEdition + :ivar type: Describes the license core type (pCore or vCore). Known values are: "pCore" and + "vCore". + :vartype type: str or ~azure.mgmt.hybridcompute.models.LicenseCoreType + :ivar processors: Describes the number of processors. + :vartype processors: int + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "license_type": {"key": "properties.licenseType", "type": "str"}, + "state": {"key": "properties.licenseDetails.state", "type": "str"}, + "target": {"key": "properties.licenseDetails.target", "type": "str"}, + "edition": {"key": "properties.licenseDetails.edition", "type": "str"}, + "type": {"key": "properties.licenseDetails.type", "type": "str"}, + "processors": {"key": "properties.licenseDetails.processors", "type": "int"}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, + state: Optional[Union[str, "_models.LicenseState"]] = None, + target: Optional[Union[str, "_models.LicenseTarget"]] = None, + edition: Optional[Union[str, "_models.LicenseEdition"]] = None, + type: Optional[Union[str, "_models.LicenseCoreType"]] = None, + processors: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword license_type: The type of the license resource. "ESU" + :paramtype license_type: str or ~azure.mgmt.hybridcompute.models.LicenseType + :keyword state: Describes the state of the license. Known values are: "Activated" and + "Deactivated". + :paramtype state: str or ~azure.mgmt.hybridcompute.models.LicenseState + :keyword target: Describes the license target server. Known values are: "Windows Server 2012" + and "Windows Server 2012 R2". + :paramtype target: str or ~azure.mgmt.hybridcompute.models.LicenseTarget + :keyword edition: Describes the edition of the license. The values are either Standard or + Datacenter. Known values are: "Standard" and "Datacenter". + :paramtype edition: str or ~azure.mgmt.hybridcompute.models.LicenseEdition + :keyword type: Describes the license core type (pCore or vCore). Known values are: "pCore" and + "vCore". + :paramtype type: str or ~azure.mgmt.hybridcompute.models.LicenseCoreType + :keyword processors: Describes the number of processors. + :paramtype processors: int + """ + super().__init__(tags=tags, **kwargs) + self.license_type = license_type + self.state = state + self.target = target + self.edition = edition + self.type = type + self.processors = processors + + +class LinuxParameters(_serialization.Model): + """Input for InstallPatches on a Linux VM, as directly received by the API. + + :ivar classifications_to_include: The update classifications to select when installing patches + for Linux. + :vartype classifications_to_include: list[str or + ~azure.mgmt.hybridcompute.models.VMGuestPatchClassificationLinux] + :ivar package_name_masks_to_include: packages to include in the patch operation. Format: + packageName_packageVersion. + :vartype package_name_masks_to_include: list[str] + :ivar package_name_masks_to_exclude: packages to exclude in the patch operation. Format: + packageName_packageVersion. + :vartype package_name_masks_to_exclude: list[str] + """ + + _attribute_map = { + "classifications_to_include": {"key": "classificationsToInclude", "type": "[str]"}, + "package_name_masks_to_include": {"key": "packageNameMasksToInclude", "type": "[str]"}, + "package_name_masks_to_exclude": {"key": "packageNameMasksToExclude", "type": "[str]"}, + } + + def __init__( + self, + *, + classifications_to_include: Optional[List[Union[str, "_models.VMGuestPatchClassificationLinux"]]] = None, + package_name_masks_to_include: Optional[List[str]] = None, + package_name_masks_to_exclude: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword classifications_to_include: The update classifications to select when installing + patches for Linux. + :paramtype classifications_to_include: list[str or + ~azure.mgmt.hybridcompute.models.VMGuestPatchClassificationLinux] + :keyword package_name_masks_to_include: packages to include in the patch operation. Format: + packageName_packageVersion. + :paramtype package_name_masks_to_include: list[str] + :keyword package_name_masks_to_exclude: packages to exclude in the patch operation. Format: + packageName_packageVersion. + :paramtype package_name_masks_to_exclude: list[str] + """ + super().__init__(**kwargs) + self.classifications_to_include = classifications_to_include + self.package_name_masks_to_include = package_name_masks_to_include + self.package_name_masks_to_exclude = package_name_masks_to_exclude + + +class LocationData(_serialization.Model): + """Metadata pertaining to the geographic location of the resource. + + All required parameters must be populated in order to send to Azure. + + :ivar name: A canonical name for the geographic or physical location. Required. + :vartype name: str + :ivar city: The city or locality where the resource is located. + :vartype city: str + :ivar district: The district, state, or province where the resource is located. + :vartype district: str + :ivar country_or_region: The country or region where the resource is located. + :vartype country_or_region: str + """ + + _validation = { + "name": {"required": True, "max_length": 256}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "city": {"key": "city", "type": "str"}, + "district": {"key": "district", "type": "str"}, + "country_or_region": {"key": "countryOrRegion", "type": "str"}, + } + + def __init__( + self, + *, + name: str, + city: Optional[str] = None, + district: Optional[str] = None, + country_or_region: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: A canonical name for the geographic or physical location. Required. + :paramtype name: str + :keyword city: The city or locality where the resource is located. + :paramtype city: str + :keyword district: The district, state, or province where the resource is located. + :paramtype district: str + :keyword country_or_region: The country or region where the resource is located. + :paramtype country_or_region: str + """ + super().__init__(**kwargs) + self.name = name + self.city = city + self.district = district + self.country_or_region = country_or_region + + +class Machine(TrackedResource): # pylint: disable=too-many-instance-attributes """Describes a hybrid machine. Variables are only populated by the server, and will be ignored when sending a request. @@ -676,44 +1916,175 @@ class Machine(TrackedResource): :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.hybridcompute.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. :vartype location: str - :ivar properties: Hybrid Compute Machine properties. - :vartype properties: ~azure.mgmt.hybridcompute.models.MachineProperties + :ivar resources: The list of extensions affiliated to the machine. + :vartype resources: list[~azure.mgmt.hybridcompute.models.MachineExtension] :ivar identity: Identity for the resource. :vartype identity: ~azure.mgmt.hybridcompute.models.Identity - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.hybridcompute.models.SystemData + :ivar kind: Indicates which kind of Arc machine placement on-premises, such as HCI, SCVMM or + VMware etc. Known values are: "AVS", "HCI", "SCVMM", "VMware", "EPS", "GCP", and "AWS". + :vartype kind: str or ~azure.mgmt.hybridcompute.models.ArcKindEnum + :ivar location_data: Metadata pertaining to the geographic location of the resource. + :vartype location_data: ~azure.mgmt.hybridcompute.models.LocationData + :ivar agent_configuration: Configurable properties that the user can set locally via the + azcmagent config command, or remotely via ARM. + :vartype agent_configuration: ~azure.mgmt.hybridcompute.models.AgentConfiguration + :ivar service_statuses: Statuses of dependent services that are reported back to ARM. + :vartype service_statuses: ~azure.mgmt.hybridcompute.models.ServiceStatuses + :ivar cloud_metadata: The metadata of the cloud environment (Azure/GCP/AWS/OCI...). + :vartype cloud_metadata: ~azure.mgmt.hybridcompute.models.CloudMetadata + :ivar agent_upgrade: The info of the machine w.r.t Agent Upgrade. + :vartype agent_upgrade: ~azure.mgmt.hybridcompute.models.AgentUpgrade + :ivar os_profile: Specifies the operating system settings for the hybrid machine. + :vartype os_profile: ~azure.mgmt.hybridcompute.models.OSProfile + :ivar license_profile: Specifies the ESU related properties for a machine. + :vartype license_profile: ~azure.mgmt.hybridcompute.models.LicenseProfileMachineInstanceView + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :ivar status: The status of the hybrid machine agent. Known values are: "Connected", + "Disconnected", and "Error". + :vartype status: str or ~azure.mgmt.hybridcompute.models.StatusTypes + :ivar last_status_change: The time of the last status change. + :vartype last_status_change: ~datetime.datetime + :ivar error_details: Details about the error state. + :vartype error_details: list[~azure.mgmt.hybridcompute.models.ErrorDetail] + :ivar agent_version: The hybrid machine agent full version. + :vartype agent_version: str + :ivar vm_id: Specifies the hybrid machine unique ID. + :vartype vm_id: str + :ivar display_name: Specifies the hybrid machine display name. + :vartype display_name: str + :ivar machine_fqdn: Specifies the hybrid machine FQDN. + :vartype machine_fqdn: str + :ivar client_public_key: Public Key that the client provides to be used during initial resource + onboarding. + :vartype client_public_key: str + :ivar os_name: The Operating System running on the hybrid machine. + :vartype os_name: str + :ivar os_version: The version of Operating System running on the hybrid machine. + :vartype os_version: str + :ivar os_type: The type of Operating System (windows/linux). + :vartype os_type: str + :ivar vm_uuid: Specifies the Arc Machine's unique SMBIOS ID. + :vartype vm_uuid: str + :ivar extensions: Machine Extensions information (deprecated field). + :vartype extensions: list[~azure.mgmt.hybridcompute.models.MachineExtensionInstanceView] + :ivar os_sku: Specifies the Operating System product SKU. + :vartype os_sku: str + :ivar domain_name: Specifies the Windows domain name. + :vartype domain_name: str + :ivar ad_fqdn: Specifies the AD fully qualified display name. + :vartype ad_fqdn: str + :ivar dns_fqdn: Specifies the DNS fully qualified display name. + :vartype dns_fqdn: str + :ivar private_link_scope_resource_id: The resource id of the private link scope this machine is + assigned to, if any. + :vartype private_link_scope_resource_id: str + :ivar parent_cluster_resource_id: The resource id of the parent cluster (Azure HCI) this + machine is assigned to, if any. + :vartype parent_cluster_resource_id: str + :ivar mssql_discovered: Specifies whether any MS SQL instance is discovered on the machine. + :vartype mssql_discovered: str + :ivar detected_properties: Detected properties from the machine. + :vartype detected_properties: dict[str, str] + :ivar network_profile: Information about the network the machine is on. + :vartype network_profile: ~azure.mgmt.hybridcompute.models.NetworkProfile """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "location": {"required": True}, "system_data": {"readonly": True}, + "location": {"required": True}, + "resources": {"readonly": True}, + "agent_configuration": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "status": {"readonly": True}, + "last_status_change": {"readonly": True}, + "error_details": {"readonly": True}, + "agent_version": {"readonly": True}, + "display_name": {"readonly": True}, + "machine_fqdn": {"readonly": True}, + "os_name": {"readonly": True}, + "os_version": {"readonly": True}, + "vm_uuid": {"readonly": True}, + "os_sku": {"readonly": True}, + "domain_name": {"readonly": True}, + "ad_fqdn": {"readonly": True}, + "dns_fqdn": {"readonly": True}, + "detected_properties": {"readonly": True}, + "network_profile": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "MachineProperties"}, + "resources": {"key": "resources", "type": "[MachineExtension]"}, "identity": {"key": "identity", "type": "Identity"}, - "system_data": {"key": "systemData", "type": "SystemData"}, + "kind": {"key": "kind", "type": "str"}, + "location_data": {"key": "properties.locationData", "type": "LocationData"}, + "agent_configuration": {"key": "properties.agentConfiguration", "type": "AgentConfiguration"}, + "service_statuses": {"key": "properties.serviceStatuses", "type": "ServiceStatuses"}, + "cloud_metadata": {"key": "properties.cloudMetadata", "type": "CloudMetadata"}, + "agent_upgrade": {"key": "properties.agentUpgrade", "type": "AgentUpgrade"}, + "os_profile": {"key": "properties.osProfile", "type": "OSProfile"}, + "license_profile": {"key": "properties.licenseProfile", "type": "LicenseProfileMachineInstanceView"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "status": {"key": "properties.status", "type": "str"}, + "last_status_change": {"key": "properties.lastStatusChange", "type": "iso-8601"}, + "error_details": {"key": "properties.errorDetails", "type": "[ErrorDetail]"}, + "agent_version": {"key": "properties.agentVersion", "type": "str"}, + "vm_id": {"key": "properties.vmId", "type": "str"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + "machine_fqdn": {"key": "properties.machineFqdn", "type": "str"}, + "client_public_key": {"key": "properties.clientPublicKey", "type": "str"}, + "os_name": {"key": "properties.osName", "type": "str"}, + "os_version": {"key": "properties.osVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "vm_uuid": {"key": "properties.vmUuid", "type": "str"}, + "extensions": {"key": "properties.extensions", "type": "[MachineExtensionInstanceView]"}, + "os_sku": {"key": "properties.osSku", "type": "str"}, + "domain_name": {"key": "properties.domainName", "type": "str"}, + "ad_fqdn": {"key": "properties.adFqdn", "type": "str"}, + "dns_fqdn": {"key": "properties.dnsFqdn", "type": "str"}, + "private_link_scope_resource_id": {"key": "properties.privateLinkScopeResourceId", "type": "str"}, + "parent_cluster_resource_id": {"key": "properties.parentClusterResourceId", "type": "str"}, + "mssql_discovered": {"key": "properties.mssqlDiscovered", "type": "str"}, + "detected_properties": {"key": "properties.detectedProperties", "type": "{str}"}, + "network_profile": {"key": "properties.networkProfile", "type": "NetworkProfile"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, location: str, tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.MachineProperties"] = None, identity: Optional["_models.Identity"] = None, + kind: Optional[Union[str, "_models.ArcKindEnum"]] = None, + location_data: Optional["_models.LocationData"] = None, + service_statuses: Optional["_models.ServiceStatuses"] = None, + cloud_metadata: Optional["_models.CloudMetadata"] = None, + agent_upgrade: Optional["_models.AgentUpgrade"] = None, + os_profile: Optional["_models.OSProfile"] = None, + license_profile: Optional["_models.LicenseProfileMachineInstanceView"] = None, + vm_id: Optional[str] = None, + client_public_key: Optional[str] = None, + os_type: Optional[str] = None, + extensions: Optional[List["_models.MachineExtensionInstanceView"]] = None, + private_link_scope_resource_id: Optional[str] = None, + parent_cluster_resource_id: Optional[str] = None, + mssql_discovered: Optional[str] = None, **kwargs: Any ) -> None: """ @@ -721,15 +2092,166 @@ def __init__( :paramtype tags: dict[str, str] :keyword location: The geo-location where the resource lives. Required. :paramtype location: str - :keyword properties: Hybrid Compute Machine properties. - :paramtype properties: ~azure.mgmt.hybridcompute.models.MachineProperties :keyword identity: Identity for the resource. :paramtype identity: ~azure.mgmt.hybridcompute.models.Identity + :keyword kind: Indicates which kind of Arc machine placement on-premises, such as HCI, SCVMM or + VMware etc. Known values are: "AVS", "HCI", "SCVMM", "VMware", "EPS", "GCP", and "AWS". + :paramtype kind: str or ~azure.mgmt.hybridcompute.models.ArcKindEnum + :keyword location_data: Metadata pertaining to the geographic location of the resource. + :paramtype location_data: ~azure.mgmt.hybridcompute.models.LocationData + :keyword service_statuses: Statuses of dependent services that are reported back to ARM. + :paramtype service_statuses: ~azure.mgmt.hybridcompute.models.ServiceStatuses + :keyword cloud_metadata: The metadata of the cloud environment (Azure/GCP/AWS/OCI...). + :paramtype cloud_metadata: ~azure.mgmt.hybridcompute.models.CloudMetadata + :keyword agent_upgrade: The info of the machine w.r.t Agent Upgrade. + :paramtype agent_upgrade: ~azure.mgmt.hybridcompute.models.AgentUpgrade + :keyword os_profile: Specifies the operating system settings for the hybrid machine. + :paramtype os_profile: ~azure.mgmt.hybridcompute.models.OSProfile + :keyword license_profile: Specifies the ESU related properties for a machine. + :paramtype license_profile: ~azure.mgmt.hybridcompute.models.LicenseProfileMachineInstanceView + :keyword vm_id: Specifies the hybrid machine unique ID. + :paramtype vm_id: str + :keyword client_public_key: Public Key that the client provides to be used during initial + resource onboarding. + :paramtype client_public_key: str + :keyword os_type: The type of Operating System (windows/linux). + :paramtype os_type: str + :keyword extensions: Machine Extensions information (deprecated field). + :paramtype extensions: list[~azure.mgmt.hybridcompute.models.MachineExtensionInstanceView] + :keyword private_link_scope_resource_id: The resource id of the private link scope this machine + is assigned to, if any. + :paramtype private_link_scope_resource_id: str + :keyword parent_cluster_resource_id: The resource id of the parent cluster (Azure HCI) this + machine is assigned to, if any. + :paramtype parent_cluster_resource_id: str + :keyword mssql_discovered: Specifies whether any MS SQL instance is discovered on the machine. + :paramtype mssql_discovered: str """ super().__init__(tags=tags, location=location, **kwargs) - self.properties = properties + self.resources = None self.identity = identity - self.system_data = None + self.kind = kind + self.location_data = location_data + self.agent_configuration = None + self.service_statuses = service_statuses + self.cloud_metadata = cloud_metadata + self.agent_upgrade = agent_upgrade + self.os_profile = os_profile + self.license_profile = license_profile + self.provisioning_state = None + self.status = None + self.last_status_change = None + self.error_details = None + self.agent_version = None + self.vm_id = vm_id + self.display_name = None + self.machine_fqdn = None + self.client_public_key = client_public_key + self.os_name = None + self.os_version = None + self.os_type = os_type + self.vm_uuid = None + self.extensions = extensions + self.os_sku = None + self.domain_name = None + self.ad_fqdn = None + self.dns_fqdn = None + self.private_link_scope_resource_id = private_link_scope_resource_id + self.parent_cluster_resource_id = parent_cluster_resource_id + self.mssql_discovered = mssql_discovered + self.detected_properties = None + self.network_profile = None + + +class MachineAssessPatchesResult(_serialization.Model): + """Describes the properties of an AssessPatches result. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: The overall success or failure status of the operation. It remains "InProgress" + until the operation completes. At that point it will become "Unknown", "Failed", "Succeeded", + or "CompletedWithWarnings.". Known values are: "Unknown", "InProgress", "Failed", "Succeeded", + and "CompletedWithWarnings". + :vartype status: str or ~azure.mgmt.hybridcompute.models.PatchOperationStatus + :ivar assessment_activity_id: The activity ID of the operation that produced this result. + :vartype assessment_activity_id: str + :ivar reboot_pending: The overall reboot status of the VM. It will be true when partially + installed patches require a reboot to complete installation but the reboot has not yet + occurred. + :vartype reboot_pending: bool + :ivar available_patch_count_by_classification: Summarization of patches available for + installation on the machine by classification. + :vartype available_patch_count_by_classification: + ~azure.mgmt.hybridcompute.models.AvailablePatchCountByClassification + :ivar start_date_time: The UTC timestamp when the operation began. + :vartype start_date_time: ~datetime.datetime + :ivar last_modified_date_time: The UTC timestamp when the operation finished. + :vartype last_modified_date_time: ~datetime.datetime + :ivar started_by: Indicates if operation was triggered by user or by platform. Known values + are: "User" and "Platform". + :vartype started_by: str or ~azure.mgmt.hybridcompute.models.PatchOperationStartedBy + :ivar patch_service_used: Specifies the patch service used for the operation. Known values are: + "Unknown", "WU", "WU_WSUS", "YUM", "APT", and "Zypper". + :vartype patch_service_used: str or ~azure.mgmt.hybridcompute.models.PatchServiceUsed + :ivar os_type: The operating system type of the machine. Known values are: "Windows" and + "Linux". + :vartype os_type: str or ~azure.mgmt.hybridcompute.models.OsType + :ivar error_details: The errors that were encountered during execution of the operation. The + details array contains the list of them. + :vartype error_details: ~azure.mgmt.hybridcompute.models.ErrorDetail + """ + + _validation = { + "status": {"readonly": True}, + "assessment_activity_id": {"readonly": True}, + "reboot_pending": {"readonly": True}, + "start_date_time": {"readonly": True}, + "last_modified_date_time": {"readonly": True}, + "started_by": {"readonly": True}, + "patch_service_used": {"readonly": True}, + "os_type": {"readonly": True}, + "error_details": {"readonly": True}, + } + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + "assessment_activity_id": {"key": "assessmentActivityId", "type": "str"}, + "reboot_pending": {"key": "rebootPending", "type": "bool"}, + "available_patch_count_by_classification": { + "key": "availablePatchCountByClassification", + "type": "AvailablePatchCountByClassification", + }, + "start_date_time": {"key": "startDateTime", "type": "iso-8601"}, + "last_modified_date_time": {"key": "lastModifiedDateTime", "type": "iso-8601"}, + "started_by": {"key": "startedBy", "type": "str"}, + "patch_service_used": {"key": "patchServiceUsed", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "error_details": {"key": "errorDetails", "type": "ErrorDetail"}, + } + + def __init__( + self, + *, + available_patch_count_by_classification: Optional["_models.AvailablePatchCountByClassification"] = None, + **kwargs: Any + ) -> None: + """ + :keyword available_patch_count_by_classification: Summarization of patches available for + installation on the machine by classification. + :paramtype available_patch_count_by_classification: + ~azure.mgmt.hybridcompute.models.AvailablePatchCountByClassification + """ + super().__init__(**kwargs) + self.status = None + self.assessment_activity_id = None + self.reboot_pending = None + self.available_patch_count_by_classification = available_patch_count_by_classification + self.start_date_time = None + self.last_modified_date_time = None + self.started_by = None + self.patch_service_used = None + self.os_type = None + self.error_details = None class MachineExtension(TrackedResource): @@ -747,32 +2269,33 @@ class MachineExtension(TrackedResource): :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.hybridcompute.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. :vartype location: str :ivar properties: Describes Machine Extension Properties. :vartype properties: ~azure.mgmt.hybridcompute.models.MachineExtensionProperties - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.hybridcompute.models.SystemData """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "location": {"required": True}, "system_data": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, "properties": {"key": "properties", "type": "MachineExtensionProperties"}, - "system_data": {"key": "systemData", "type": "SystemData"}, } def __init__( @@ -793,7 +2316,6 @@ def __init__( """ super().__init__(tags=tags, location=location, **kwargs) self.properties = properties - self.system_data = None class MachineExtensionInstanceView(_serialization.Model): @@ -917,10 +2439,10 @@ class MachineExtensionProperties(_serialization.Model): upgrade minor versions unless redeployed, even with this property set to true. :vartype auto_upgrade_minor_version: bool :ivar settings: Json formatted public settings for the extension. - :vartype settings: JSON + :vartype settings: dict[str, any] :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :vartype protected_settings: JSON + :vartype protected_settings: dict[str, any] :ivar provisioning_state: The provisioning state, which only appears in the response. :vartype provisioning_state: str :ivar instance_view: The machine extension instance view. @@ -938,8 +2460,8 @@ class MachineExtensionProperties(_serialization.Model): "type_handler_version": {"key": "typeHandlerVersion", "type": "str"}, "enable_automatic_upgrade": {"key": "enableAutomaticUpgrade", "type": "bool"}, "auto_upgrade_minor_version": {"key": "autoUpgradeMinorVersion", "type": "bool"}, - "settings": {"key": "settings", "type": "object"}, - "protected_settings": {"key": "protectedSettings", "type": "object"}, + "settings": {"key": "settings", "type": "{object}"}, + "protected_settings": {"key": "protectedSettings", "type": "{object}"}, "provisioning_state": {"key": "provisioningState", "type": "str"}, "instance_view": {"key": "instanceView", "type": "MachineExtensionInstanceView"}, } @@ -953,8 +2475,8 @@ def __init__( type_handler_version: Optional[str] = None, enable_automatic_upgrade: Optional[bool] = None, auto_upgrade_minor_version: Optional[bool] = None, - settings: Optional[JSON] = None, - protected_settings: Optional[JSON] = None, + settings: Optional[Dict[str, Any]] = None, + protected_settings: Optional[Dict[str, Any]] = None, instance_view: Optional["_models.MachineExtensionInstanceView"] = None, **kwargs: Any ) -> None: @@ -976,10 +2498,10 @@ def __init__( upgrade minor versions unless redeployed, even with this property set to true. :paramtype auto_upgrade_minor_version: bool :keyword settings: Json formatted public settings for the extension. - :paramtype settings: JSON + :paramtype settings: dict[str, any] :keyword protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :paramtype protected_settings: JSON + :paramtype protected_settings: dict[str, any] :keyword instance_view: The machine extension instance view. :paramtype instance_view: ~azure.mgmt.hybridcompute.models.MachineExtensionInstanceView """ @@ -1030,60 +2552,11 @@ def __init__( self.next_link = next_link -class ResourceUpdate(_serialization.Model): - """The Update Resource model definition. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - class MachineExtensionUpdate(ResourceUpdate): """Describes a Machine Extension Update. :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar properties: Describes Machine Extension Update Properties. - :vartype properties: ~azure.mgmt.hybridcompute.models.MachineExtensionUpdateProperties - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "properties": {"key": "properties", "type": "MachineExtensionUpdateProperties"}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.MachineExtensionUpdateProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword properties: Describes Machine Extension Update Properties. - :paramtype properties: ~azure.mgmt.hybridcompute.models.MachineExtensionUpdateProperties - """ - super().__init__(tags=tags, **kwargs) - self.properties = properties - - -class MachineExtensionUpdateProperties(_serialization.Model): - """Describes the properties of a Machine Extension. - :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. :vartype force_update_tag: str @@ -1093,40 +2566,49 @@ class MachineExtensionUpdateProperties(_serialization.Model): :vartype type: str :ivar type_handler_version: Specifies the version of the script handler. :vartype type_handler_version: str + :ivar enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version available. + :vartype enable_automatic_upgrade: bool :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. :vartype auto_upgrade_minor_version: bool :ivar settings: Json formatted public settings for the extension. - :vartype settings: JSON + :vartype settings: dict[str, any] :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :vartype protected_settings: JSON + :vartype protected_settings: dict[str, any] """ _attribute_map = { - "force_update_tag": {"key": "forceUpdateTag", "type": "str"}, - "publisher": {"key": "publisher", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "type_handler_version": {"key": "typeHandlerVersion", "type": "str"}, - "auto_upgrade_minor_version": {"key": "autoUpgradeMinorVersion", "type": "bool"}, - "settings": {"key": "settings", "type": "object"}, - "protected_settings": {"key": "protectedSettings", "type": "object"}, + "tags": {"key": "tags", "type": "{str}"}, + "force_update_tag": {"key": "properties.forceUpdateTag", "type": "str"}, + "publisher": {"key": "properties.publisher", "type": "str"}, + "type": {"key": "properties.type", "type": "str"}, + "type_handler_version": {"key": "properties.typeHandlerVersion", "type": "str"}, + "enable_automatic_upgrade": {"key": "properties.enableAutomaticUpgrade", "type": "bool"}, + "auto_upgrade_minor_version": {"key": "properties.autoUpgradeMinorVersion", "type": "bool"}, + "settings": {"key": "properties.settings", "type": "{object}"}, + "protected_settings": {"key": "properties.protectedSettings", "type": "{object}"}, } def __init__( self, *, + tags: Optional[Dict[str, str]] = None, force_update_tag: Optional[str] = None, publisher: Optional[str] = None, type: Optional[str] = None, type_handler_version: Optional[str] = None, + enable_automatic_upgrade: Optional[bool] = None, auto_upgrade_minor_version: Optional[bool] = None, - settings: Optional[JSON] = None, - protected_settings: Optional[JSON] = None, + settings: Optional[Dict[str, Any]] = None, + protected_settings: Optional[Dict[str, Any]] = None, **kwargs: Any ) -> None: """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] :keyword force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. :paramtype force_update_tag: str @@ -1136,21 +2618,25 @@ def __init__( :paramtype type: str :keyword type_handler_version: Specifies the version of the script handler. :paramtype type_handler_version: str + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version available. + :paramtype enable_automatic_upgrade: bool :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. :paramtype auto_upgrade_minor_version: bool :keyword settings: Json formatted public settings for the extension. - :paramtype settings: JSON + :paramtype settings: dict[str, any] :keyword protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :paramtype protected_settings: JSON + :paramtype protected_settings: dict[str, any] """ - super().__init__(**kwargs) + super().__init__(tags=tags, **kwargs) self.force_update_tag = force_update_tag self.publisher = publisher self.type = type self.type_handler_version = type_handler_version + self.enable_automatic_upgrade = enable_automatic_upgrade self.auto_upgrade_minor_version = auto_upgrade_minor_version self.settings = settings self.protected_settings = protected_settings @@ -1180,275 +2666,226 @@ def __init__( self.extension_targets = extension_targets -class MachineListResult(_serialization.Model): - """The List hybrid machine operation response. +class MachineInstallPatchesParameters(_serialization.Model): + """Input for InstallPatches as directly received by the API. All required parameters must be populated in order to send to Azure. - :ivar value: The list of hybrid machines. Required. - :vartype value: list[~azure.mgmt.hybridcompute.models.Machine] - :ivar next_link: The URI to fetch the next page of Machines. Call ListNext() with this URI to - fetch the next page of hybrid machines. - :vartype next_link: str + :ivar maximum_duration: Specifies the maximum amount of time that the operation will run. It + must be an ISO 8601-compliant duration string such as PT4H (4 hours). Required. + :vartype maximum_duration: str + :ivar reboot_setting: Defines when it is acceptable to reboot a VM during a software update + operation. Required. Known values are: "IfRequired", "Never", and "Always". + :vartype reboot_setting: str or ~azure.mgmt.hybridcompute.models.VMGuestPatchRebootSetting + :ivar windows_parameters: Input for InstallPatches on a Windows VM, as directly received by the + API. + :vartype windows_parameters: ~azure.mgmt.hybridcompute.models.WindowsParameters + :ivar linux_parameters: Input for InstallPatches on a Linux VM, as directly received by the + API. + :vartype linux_parameters: ~azure.mgmt.hybridcompute.models.LinuxParameters """ _validation = { - "value": {"required": True}, + "maximum_duration": {"required": True}, + "reboot_setting": {"required": True}, } _attribute_map = { - "value": {"key": "value", "type": "[Machine]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.Machine"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The list of hybrid machines. Required. - :paramtype value: list[~azure.mgmt.hybridcompute.models.Machine] - :keyword next_link: The URI to fetch the next page of Machines. Call ListNext() with this URI - to fetch the next page of hybrid machines. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class MachineProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Describes the properties of a hybrid machine. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar location_data: Metadata pertaining to the geographic location of the resource. - :vartype location_data: ~azure.mgmt.hybridcompute.models.LocationData - :ivar agent_configuration: Configurable properties that the user can set locally via the - azcmagent config command, or remotely via ARM. - :vartype agent_configuration: ~azure.mgmt.hybridcompute.models.AgentConfiguration - :ivar service_statuses: Statuses of dependent services that are reported back to ARM. - :vartype service_statuses: ~azure.mgmt.hybridcompute.models.ServiceStatuses - :ivar cloud_metadata: The metadata of the cloud environment (Azure/GCP/AWS/OCI...). - :vartype cloud_metadata: ~azure.mgmt.hybridcompute.models.CloudMetadata - :ivar os_profile: Specifies the operating system settings for the hybrid machine. - :vartype os_profile: ~azure.mgmt.hybridcompute.models.OSProfile - :ivar provisioning_state: The provisioning state, which only appears in the response. - :vartype provisioning_state: str - :ivar status: The status of the hybrid machine agent. Known values are: "Connected", - "Disconnected", and "Error". - :vartype status: str or ~azure.mgmt.hybridcompute.models.StatusTypes - :ivar last_status_change: The time of the last status change. - :vartype last_status_change: ~datetime.datetime - :ivar error_details: Details about the error state. - :vartype error_details: list[~azure.mgmt.hybridcompute.models.ErrorDetail] - :ivar agent_version: The hybrid machine agent full version. - :vartype agent_version: str - :ivar vm_id: Specifies the hybrid machine unique ID. - :vartype vm_id: str - :ivar display_name: Specifies the hybrid machine display name. - :vartype display_name: str - :ivar machine_fqdn: Specifies the hybrid machine FQDN. - :vartype machine_fqdn: str - :ivar client_public_key: Public Key that the client provides to be used during initial resource - onboarding. - :vartype client_public_key: str - :ivar os_name: The Operating System running on the hybrid machine. - :vartype os_name: str - :ivar os_version: The version of Operating System running on the hybrid machine. - :vartype os_version: str - :ivar os_type: The type of Operating System (windows/linux). - :vartype os_type: str - :ivar vm_uuid: Specifies the Arc Machine's unique SMBIOS ID. - :vartype vm_uuid: str - :ivar extensions: Machine Extensions information. - :vartype extensions: list[~azure.mgmt.hybridcompute.models.MachineExtensionInstanceView] - :ivar os_sku: Specifies the Operating System product SKU. - :vartype os_sku: str - :ivar domain_name: Specifies the Windows domain name. - :vartype domain_name: str - :ivar ad_fqdn: Specifies the AD fully qualified display name. - :vartype ad_fqdn: str - :ivar dns_fqdn: Specifies the DNS fully qualified display name. - :vartype dns_fqdn: str - :ivar private_link_scope_resource_id: The resource id of the private link scope this machine is - assigned to, if any. - :vartype private_link_scope_resource_id: str - :ivar parent_cluster_resource_id: The resource id of the parent cluster (Azure HCI) this - machine is assigned to, if any. - :vartype parent_cluster_resource_id: str - :ivar mssql_discovered: Specifies whether any MS SQL instance is discovered on the machine. - :vartype mssql_discovered: str - :ivar detected_properties: Detected properties from the machine. - :vartype detected_properties: dict[str, str] + "maximum_duration": {"key": "maximumDuration", "type": "str"}, + "reboot_setting": {"key": "rebootSetting", "type": "str"}, + "windows_parameters": {"key": "windowsParameters", "type": "WindowsParameters"}, + "linux_parameters": {"key": "linuxParameters", "type": "LinuxParameters"}, + } + + def __init__( + self, + *, + maximum_duration: str, + reboot_setting: Union[str, "_models.VMGuestPatchRebootSetting"], + windows_parameters: Optional["_models.WindowsParameters"] = None, + linux_parameters: Optional["_models.LinuxParameters"] = None, + **kwargs: Any + ) -> None: + """ + :keyword maximum_duration: Specifies the maximum amount of time that the operation will run. It + must be an ISO 8601-compliant duration string such as PT4H (4 hours). Required. + :paramtype maximum_duration: str + :keyword reboot_setting: Defines when it is acceptable to reboot a VM during a software update + operation. Required. Known values are: "IfRequired", "Never", and "Always". + :paramtype reboot_setting: str or ~azure.mgmt.hybridcompute.models.VMGuestPatchRebootSetting + :keyword windows_parameters: Input for InstallPatches on a Windows VM, as directly received by + the API. + :paramtype windows_parameters: ~azure.mgmt.hybridcompute.models.WindowsParameters + :keyword linux_parameters: Input for InstallPatches on a Linux VM, as directly received by the + API. + :paramtype linux_parameters: ~azure.mgmt.hybridcompute.models.LinuxParameters + """ + super().__init__(**kwargs) + self.maximum_duration = maximum_duration + self.reboot_setting = reboot_setting + self.windows_parameters = windows_parameters + self.linux_parameters = linux_parameters + + +class MachineInstallPatchesResult(_serialization.Model): # pylint: disable=too-many-instance-attributes + """The result summary of an installation operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: The overall success or failure status of the operation. It remains "InProgress" + until the operation completes. At that point it will become "Failed", "Succeeded", "Unknown" or + "CompletedWithWarnings.". Known values are: "Unknown", "InProgress", "Failed", "Succeeded", and + "CompletedWithWarnings". + :vartype status: str or ~azure.mgmt.hybridcompute.models.PatchOperationStatus + :ivar installation_activity_id: The activity ID of the operation that produced this result. + :vartype installation_activity_id: str + :ivar reboot_status: The reboot state of the VM following completion of the operation. Known + values are: "Unknown", "NotNeeded", "Required", "Started", "Failed", and "Completed". + :vartype reboot_status: str or ~azure.mgmt.hybridcompute.models.VMGuestPatchRebootStatus + :ivar maintenance_window_exceeded: Whether the operation ran out of time before it completed + all its intended actions. + :vartype maintenance_window_exceeded: bool + :ivar excluded_patch_count: The number of patches that were not installed due to the user + blocking their installation. + :vartype excluded_patch_count: int + :ivar not_selected_patch_count: The number of patches that were detected as available for + install, but did not meet the operation's criteria. + :vartype not_selected_patch_count: int + :ivar pending_patch_count: The number of patches that were identified as meeting the + installation criteria, but were not able to be installed. Typically this happens when + maintenanceWindowExceeded == true. + :vartype pending_patch_count: int + :ivar installed_patch_count: The number of patches successfully installed. + :vartype installed_patch_count: int + :ivar failed_patch_count: The number of patches that could not be installed due to some issue. + See errors for details. + :vartype failed_patch_count: int + :ivar start_date_time: The UTC timestamp when the operation began. + :vartype start_date_time: ~datetime.datetime + :ivar last_modified_date_time: The UTC timestamp when the operation finished. + :vartype last_modified_date_time: ~datetime.datetime + :ivar started_by: Indicates if operation was triggered by user or by platform. Known values + are: "User" and "Platform". + :vartype started_by: str or ~azure.mgmt.hybridcompute.models.PatchOperationStartedBy + :ivar patch_service_used: Specifies the patch service used for the operation. Known values are: + "Unknown", "WU", "WU_WSUS", "YUM", "APT", and "Zypper". + :vartype patch_service_used: str or ~azure.mgmt.hybridcompute.models.PatchServiceUsed + :ivar os_type: The operating system type of the machine. Known values are: "Windows" and + "Linux". + :vartype os_type: str or ~azure.mgmt.hybridcompute.models.OsType + :ivar error_details: The errors that were encountered during execution of the operation. The + details array contains the list of them. + :vartype error_details: ~azure.mgmt.hybridcompute.models.ErrorDetail """ _validation = { - "agent_configuration": {"readonly": True}, - "provisioning_state": {"readonly": True}, "status": {"readonly": True}, - "last_status_change": {"readonly": True}, + "installation_activity_id": {"readonly": True}, + "reboot_status": {"readonly": True}, + "maintenance_window_exceeded": {"readonly": True}, + "excluded_patch_count": {"readonly": True}, + "not_selected_patch_count": {"readonly": True}, + "pending_patch_count": {"readonly": True}, + "installed_patch_count": {"readonly": True}, + "failed_patch_count": {"readonly": True}, + "start_date_time": {"readonly": True}, + "last_modified_date_time": {"readonly": True}, + "started_by": {"readonly": True}, + "patch_service_used": {"readonly": True}, + "os_type": {"readonly": True}, "error_details": {"readonly": True}, - "agent_version": {"readonly": True}, - "display_name": {"readonly": True}, - "machine_fqdn": {"readonly": True}, - "os_name": {"readonly": True}, - "os_version": {"readonly": True}, - "vm_uuid": {"readonly": True}, - "os_sku": {"readonly": True}, - "domain_name": {"readonly": True}, - "ad_fqdn": {"readonly": True}, - "dns_fqdn": {"readonly": True}, - "detected_properties": {"readonly": True}, } _attribute_map = { - "location_data": {"key": "locationData", "type": "LocationData"}, - "agent_configuration": {"key": "agentConfiguration", "type": "AgentConfiguration"}, - "service_statuses": {"key": "serviceStatuses", "type": "ServiceStatuses"}, - "cloud_metadata": {"key": "cloudMetadata", "type": "CloudMetadata"}, - "os_profile": {"key": "osProfile", "type": "OSProfile"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, "status": {"key": "status", "type": "str"}, - "last_status_change": {"key": "lastStatusChange", "type": "iso-8601"}, - "error_details": {"key": "errorDetails", "type": "[ErrorDetail]"}, - "agent_version": {"key": "agentVersion", "type": "str"}, - "vm_id": {"key": "vmId", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "machine_fqdn": {"key": "machineFqdn", "type": "str"}, - "client_public_key": {"key": "clientPublicKey", "type": "str"}, - "os_name": {"key": "osName", "type": "str"}, - "os_version": {"key": "osVersion", "type": "str"}, + "installation_activity_id": {"key": "installationActivityId", "type": "str"}, + "reboot_status": {"key": "rebootStatus", "type": "str"}, + "maintenance_window_exceeded": {"key": "maintenanceWindowExceeded", "type": "bool"}, + "excluded_patch_count": {"key": "excludedPatchCount", "type": "int"}, + "not_selected_patch_count": {"key": "notSelectedPatchCount", "type": "int"}, + "pending_patch_count": {"key": "pendingPatchCount", "type": "int"}, + "installed_patch_count": {"key": "installedPatchCount", "type": "int"}, + "failed_patch_count": {"key": "failedPatchCount", "type": "int"}, + "start_date_time": {"key": "startDateTime", "type": "iso-8601"}, + "last_modified_date_time": {"key": "lastModifiedDateTime", "type": "iso-8601"}, + "started_by": {"key": "startedBy", "type": "str"}, + "patch_service_used": {"key": "patchServiceUsed", "type": "str"}, "os_type": {"key": "osType", "type": "str"}, - "vm_uuid": {"key": "vmUuid", "type": "str"}, - "extensions": {"key": "extensions", "type": "[MachineExtensionInstanceView]"}, - "os_sku": {"key": "osSku", "type": "str"}, - "domain_name": {"key": "domainName", "type": "str"}, - "ad_fqdn": {"key": "adFqdn", "type": "str"}, - "dns_fqdn": {"key": "dnsFqdn", "type": "str"}, - "private_link_scope_resource_id": {"key": "privateLinkScopeResourceId", "type": "str"}, - "parent_cluster_resource_id": {"key": "parentClusterResourceId", "type": "str"}, - "mssql_discovered": {"key": "mssqlDiscovered", "type": "str"}, - "detected_properties": {"key": "detectedProperties", "type": "{str}"}, + "error_details": {"key": "errorDetails", "type": "ErrorDetail"}, } - def __init__( # pylint: disable=too-many-locals - self, - *, - location_data: Optional["_models.LocationData"] = None, - service_statuses: Optional["_models.ServiceStatuses"] = None, - cloud_metadata: Optional["_models.CloudMetadata"] = None, - os_profile: Optional["_models.OSProfile"] = None, - vm_id: Optional[str] = None, - client_public_key: Optional[str] = None, - os_type: Optional[str] = None, - extensions: Optional[List["_models.MachineExtensionInstanceView"]] = None, - private_link_scope_resource_id: Optional[str] = None, - parent_cluster_resource_id: Optional[str] = None, - mssql_discovered: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword location_data: Metadata pertaining to the geographic location of the resource. - :paramtype location_data: ~azure.mgmt.hybridcompute.models.LocationData - :keyword service_statuses: Statuses of dependent services that are reported back to ARM. - :paramtype service_statuses: ~azure.mgmt.hybridcompute.models.ServiceStatuses - :keyword cloud_metadata: The metadata of the cloud environment (Azure/GCP/AWS/OCI...). - :paramtype cloud_metadata: ~azure.mgmt.hybridcompute.models.CloudMetadata - :keyword os_profile: Specifies the operating system settings for the hybrid machine. - :paramtype os_profile: ~azure.mgmt.hybridcompute.models.OSProfile - :keyword vm_id: Specifies the hybrid machine unique ID. - :paramtype vm_id: str - :keyword client_public_key: Public Key that the client provides to be used during initial - resource onboarding. - :paramtype client_public_key: str - :keyword os_type: The type of Operating System (windows/linux). - :paramtype os_type: str - :keyword extensions: Machine Extensions information. - :paramtype extensions: list[~azure.mgmt.hybridcompute.models.MachineExtensionInstanceView] - :keyword private_link_scope_resource_id: The resource id of the private link scope this machine - is assigned to, if any. - :paramtype private_link_scope_resource_id: str - :keyword parent_cluster_resource_id: The resource id of the parent cluster (Azure HCI) this - machine is assigned to, if any. - :paramtype parent_cluster_resource_id: str - :keyword mssql_discovered: Specifies whether any MS SQL instance is discovered on the machine. - :paramtype mssql_discovered: str - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.location_data = location_data - self.agent_configuration = None - self.service_statuses = service_statuses - self.cloud_metadata = cloud_metadata - self.os_profile = os_profile - self.provisioning_state = None self.status = None - self.last_status_change = None + self.installation_activity_id = None + self.reboot_status = None + self.maintenance_window_exceeded = None + self.excluded_patch_count = None + self.not_selected_patch_count = None + self.pending_patch_count = None + self.installed_patch_count = None + self.failed_patch_count = None + self.start_date_time = None + self.last_modified_date_time = None + self.started_by = None + self.patch_service_used = None + self.os_type = None self.error_details = None - self.agent_version = None - self.vm_id = vm_id - self.display_name = None - self.machine_fqdn = None - self.client_public_key = client_public_key - self.os_name = None - self.os_version = None - self.os_type = os_type - self.vm_uuid = None - self.extensions = extensions - self.os_sku = None - self.domain_name = None - self.ad_fqdn = None - self.dns_fqdn = None - self.private_link_scope_resource_id = private_link_scope_resource_id - self.parent_cluster_resource_id = parent_cluster_resource_id - self.mssql_discovered = mssql_discovered - self.detected_properties = None -class MachineUpdate(ResourceUpdate): - """Describes a hybrid machine Update. +class MachineListResult(_serialization.Model): + """The List hybrid machine operation response. - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.hybridcompute.models.Identity - :ivar properties: Hybrid Compute Machine properties. - :vartype properties: ~azure.mgmt.hybridcompute.models.MachineUpdateProperties + All required parameters must be populated in order to send to Azure. + + :ivar value: The list of hybrid machines. Required. + :vartype value: list[~azure.mgmt.hybridcompute.models.Machine] + :ivar next_link: The URI to fetch the next page of Machines. Call ListNext() with this URI to + fetch the next page of hybrid machines. + :vartype next_link: str """ + _validation = { + "value": {"required": True}, + } + _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "Identity"}, - "properties": {"key": "properties", "type": "MachineUpdateProperties"}, + "value": {"key": "value", "type": "[Machine]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.Identity"] = None, - properties: Optional["_models.MachineUpdateProperties"] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, value: List["_models.Machine"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.hybridcompute.models.Identity - :keyword properties: Hybrid Compute Machine properties. - :paramtype properties: ~azure.mgmt.hybridcompute.models.MachineUpdateProperties + :keyword value: The list of hybrid machines. Required. + :paramtype value: list[~azure.mgmt.hybridcompute.models.Machine] + :keyword next_link: The URI to fetch the next page of Machines. Call ListNext() with this URI + to fetch the next page of hybrid machines. + :paramtype next_link: str """ - super().__init__(tags=tags, **kwargs) - self.identity = identity - self.properties = properties + super().__init__(**kwargs) + self.value = value + self.next_link = next_link -class MachineUpdateProperties(_serialization.Model): - """Describes the ARM updatable properties of a hybrid machine. +class MachineUpdate(ResourceUpdate): + """Describes a hybrid machine Update. + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar identity: Identity for the resource. + :vartype identity: ~azure.mgmt.hybridcompute.models.Identity + :ivar kind: Indicates which kind of Arc machine placement on-premises, such as HCI, SCVMM or + VMware etc. Known values are: "AVS", "HCI", "SCVMM", "VMware", "EPS", "GCP", and "AWS". + :vartype kind: str or ~azure.mgmt.hybridcompute.models.ArcKindEnum :ivar location_data: Metadata pertaining to the geographic location of the resource. :vartype location_data: ~azure.mgmt.hybridcompute.models.LocationData :ivar os_profile: Specifies the operating system settings for the hybrid machine. :vartype os_profile: ~azure.mgmt.hybridcompute.models.OSProfile :ivar cloud_metadata: The metadata of the cloud environment (Azure/GCP/AWS/OCI...). :vartype cloud_metadata: ~azure.mgmt.hybridcompute.models.CloudMetadata + :ivar agent_upgrade: The info of the machine w.r.t Agent Upgrade. + :vartype agent_upgrade: ~azure.mgmt.hybridcompute.models.AgentUpgrade :ivar parent_cluster_resource_id: The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any. :vartype parent_cluster_resource_id: str @@ -1458,30 +2895,47 @@ class MachineUpdateProperties(_serialization.Model): """ _attribute_map = { - "location_data": {"key": "locationData", "type": "LocationData"}, - "os_profile": {"key": "osProfile", "type": "OSProfile"}, - "cloud_metadata": {"key": "cloudMetadata", "type": "CloudMetadata"}, - "parent_cluster_resource_id": {"key": "parentClusterResourceId", "type": "str"}, - "private_link_scope_resource_id": {"key": "privateLinkScopeResourceId", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "Identity"}, + "kind": {"key": "kind", "type": "str"}, + "location_data": {"key": "properties.locationData", "type": "LocationData"}, + "os_profile": {"key": "properties.osProfile", "type": "OSProfile"}, + "cloud_metadata": {"key": "properties.cloudMetadata", "type": "CloudMetadata"}, + "agent_upgrade": {"key": "properties.agentUpgrade", "type": "AgentUpgrade"}, + "parent_cluster_resource_id": {"key": "properties.parentClusterResourceId", "type": "str"}, + "private_link_scope_resource_id": {"key": "properties.privateLinkScopeResourceId", "type": "str"}, } def __init__( self, *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.Identity"] = None, + kind: Optional[Union[str, "_models.ArcKindEnum"]] = None, location_data: Optional["_models.LocationData"] = None, os_profile: Optional["_models.OSProfile"] = None, cloud_metadata: Optional["_models.CloudMetadata"] = None, + agent_upgrade: Optional["_models.AgentUpgrade"] = None, parent_cluster_resource_id: Optional[str] = None, private_link_scope_resource_id: Optional[str] = None, **kwargs: Any ) -> None: """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: Identity for the resource. + :paramtype identity: ~azure.mgmt.hybridcompute.models.Identity + :keyword kind: Indicates which kind of Arc machine placement on-premises, such as HCI, SCVMM or + VMware etc. Known values are: "AVS", "HCI", "SCVMM", "VMware", "EPS", "GCP", and "AWS". + :paramtype kind: str or ~azure.mgmt.hybridcompute.models.ArcKindEnum :keyword location_data: Metadata pertaining to the geographic location of the resource. :paramtype location_data: ~azure.mgmt.hybridcompute.models.LocationData :keyword os_profile: Specifies the operating system settings for the hybrid machine. :paramtype os_profile: ~azure.mgmt.hybridcompute.models.OSProfile :keyword cloud_metadata: The metadata of the cloud environment (Azure/GCP/AWS/OCI...). :paramtype cloud_metadata: ~azure.mgmt.hybridcompute.models.CloudMetadata + :keyword agent_upgrade: The info of the machine w.r.t Agent Upgrade. + :paramtype agent_upgrade: ~azure.mgmt.hybridcompute.models.AgentUpgrade :keyword parent_cluster_resource_id: The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any. :paramtype parent_cluster_resource_id: str @@ -1489,14 +2943,57 @@ def __init__( is assigned to, if any. :paramtype private_link_scope_resource_id: str """ - super().__init__(**kwargs) + super().__init__(tags=tags, **kwargs) + self.identity = identity + self.kind = kind self.location_data = location_data self.os_profile = os_profile self.cloud_metadata = cloud_metadata + self.agent_upgrade = agent_upgrade self.parent_cluster_resource_id = parent_cluster_resource_id self.private_link_scope_resource_id = private_link_scope_resource_id +class NetworkInterface(_serialization.Model): + """Describes a network interface. + + :ivar ip_addresses: The list of IP addresses in this interface. + :vartype ip_addresses: list[~azure.mgmt.hybridcompute.models.IpAddress] + """ + + _attribute_map = { + "ip_addresses": {"key": "ipAddresses", "type": "[IpAddress]"}, + } + + def __init__(self, *, ip_addresses: Optional[List["_models.IpAddress"]] = None, **kwargs: Any) -> None: + """ + :keyword ip_addresses: The list of IP addresses in this interface. + :paramtype ip_addresses: list[~azure.mgmt.hybridcompute.models.IpAddress] + """ + super().__init__(**kwargs) + self.ip_addresses = ip_addresses + + +class NetworkProfile(_serialization.Model): + """Describes the network information on this machine. + + :ivar network_interfaces: The list of network interfaces. + :vartype network_interfaces: list[~azure.mgmt.hybridcompute.models.NetworkInterface] + """ + + _attribute_map = { + "network_interfaces": {"key": "networkInterfaces", "type": "[NetworkInterface]"}, + } + + def __init__(self, *, network_interfaces: Optional[List["_models.NetworkInterface"]] = None, **kwargs: Any) -> None: + """ + :keyword network_interfaces: The list of network interfaces. + :paramtype network_interfaces: list[~azure.mgmt.hybridcompute.models.NetworkInterface] + """ + super().__init__(**kwargs) + self.network_interfaces = network_interfaces + + class OperationListResult(_serialization.Model): """The List Compute Operation operation response. @@ -1713,39 +3210,6 @@ def __init__( self.patch_mode = patch_mode -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have - tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _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) - - class PrivateEndpointConnection(ProxyResource): """A private endpoint connection. @@ -1759,10 +3223,11 @@ class PrivateEndpointConnection(ProxyResource): :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.hybridcompute.models.SystemData :ivar properties: Resource properties. :vartype properties: ~azure.mgmt.hybridcompute.models.PrivateEndpointConnectionProperties - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.hybridcompute.models.SystemData """ _validation = { @@ -1776,8 +3241,8 @@ class PrivateEndpointConnection(ProxyResource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "properties": {"key": "properties", "type": "PrivateEndpointConnectionProperties"}, "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "PrivateEndpointConnectionProperties"}, } def __init__( @@ -1789,7 +3254,6 @@ def __init__( """ super().__init__(**kwargs) self.properties = properties - self.system_data = None class PrivateEndpointConnectionDataModel(_serialization.Model): @@ -1949,10 +3413,11 @@ class PrivateLinkResource(ProxyResource): :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.hybridcompute.models.SystemData :ivar properties: Resource properties. :vartype properties: ~azure.mgmt.hybridcompute.models.PrivateLinkResourceProperties - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.hybridcompute.models.SystemData """ _validation = { @@ -1966,8 +3431,8 @@ class PrivateLinkResource(ProxyResource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "properties": {"key": "properties", "type": "PrivateLinkResourceProperties"}, "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "PrivateLinkResourceProperties"}, } def __init__(self, *, properties: Optional["_models.PrivateLinkResourceProperties"] = None, **kwargs: Any) -> None: @@ -1977,7 +3442,6 @@ def __init__(self, *, properties: Optional["_models.PrivateLinkResourcePropertie """ super().__init__(**kwargs) self.properties = properties - self.system_data = None class PrivateLinkResourceListResult(_serialization.Model): @@ -2187,6 +3651,26 @@ def __init__( self.guest_configuration_service = guest_configuration_service +class Subnet(_serialization.Model): + """Describes the subnet. + + :ivar address_prefix: Represents address prefix. + :vartype address_prefix: str + """ + + _attribute_map = { + "address_prefix": {"key": "addressPrefix", "type": "str"}, + } + + def __init__(self, *, address_prefix: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword address_prefix: Represents address prefix. + :paramtype address_prefix: str + """ + super().__init__(**kwargs) + self.address_prefix = address_prefix + + class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. @@ -2270,3 +3754,64 @@ def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> N """ super().__init__(**kwargs) self.tags = tags + + +class WindowsParameters(_serialization.Model): + """Input for InstallPatches on a Windows VM, as directly received by the API. + + :ivar classifications_to_include: The update classifications to select when installing patches + for Windows. + :vartype classifications_to_include: list[str or + ~azure.mgmt.hybridcompute.models.VMGuestPatchClassificationWindows] + :ivar kb_numbers_to_include: Kbs to include in the patch operation. + :vartype kb_numbers_to_include: list[str] + :ivar kb_numbers_to_exclude: Kbs to exclude in the patch operation. + :vartype kb_numbers_to_exclude: list[str] + :ivar exclude_kbs_requiring_reboot: Filters out Kbs that don't have an + InstallationRebootBehavior of 'NeverReboots' when this is set to true. + :vartype exclude_kbs_requiring_reboot: bool + :ivar max_patch_publish_date: This is used to install patches that were published on or before + this given max published date. + :vartype max_patch_publish_date: ~datetime.datetime + """ + + _attribute_map = { + "classifications_to_include": {"key": "classificationsToInclude", "type": "[str]"}, + "kb_numbers_to_include": {"key": "kbNumbersToInclude", "type": "[str]"}, + "kb_numbers_to_exclude": {"key": "kbNumbersToExclude", "type": "[str]"}, + "exclude_kbs_requiring_reboot": {"key": "excludeKbsRequiringReboot", "type": "bool"}, + "max_patch_publish_date": {"key": "maxPatchPublishDate", "type": "iso-8601"}, + } + + def __init__( + self, + *, + classifications_to_include: Optional[List[Union[str, "_models.VMGuestPatchClassificationWindows"]]] = None, + kb_numbers_to_include: Optional[List[str]] = None, + kb_numbers_to_exclude: Optional[List[str]] = None, + exclude_kbs_requiring_reboot: Optional[bool] = None, + max_patch_publish_date: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword classifications_to_include: The update classifications to select when installing + patches for Windows. + :paramtype classifications_to_include: list[str or + ~azure.mgmt.hybridcompute.models.VMGuestPatchClassificationWindows] + :keyword kb_numbers_to_include: Kbs to include in the patch operation. + :paramtype kb_numbers_to_include: list[str] + :keyword kb_numbers_to_exclude: Kbs to exclude in the patch operation. + :paramtype kb_numbers_to_exclude: list[str] + :keyword exclude_kbs_requiring_reboot: Filters out Kbs that don't have an + InstallationRebootBehavior of 'NeverReboots' when this is set to true. + :paramtype exclude_kbs_requiring_reboot: bool + :keyword max_patch_publish_date: This is used to install patches that were published on or + before this given max published date. + :paramtype max_patch_publish_date: ~datetime.datetime + """ + super().__init__(**kwargs) + self.classifications_to_include = classifications_to_include + self.kb_numbers_to_include = kb_numbers_to_include + self.kb_numbers_to_exclude = kb_numbers_to_exclude + self.exclude_kbs_requiring_reboot = exclude_kbs_requiring_reboot + self.max_patch_publish_date = max_patch_publish_date diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/__init__.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/__init__.py index 4709c0d6c162..8f0589115fae 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/__init__.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/__init__.py @@ -6,10 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._licenses_operations import LicensesOperations from ._machines_operations import MachinesOperations +from ._license_profiles_operations import LicenseProfilesOperations from ._machine_extensions_operations import MachineExtensionsOperations from ._hybrid_compute_management_client_operations import HybridComputeManagementClientOperationsMixin +from ._extension_metadata_operations import ExtensionMetadataOperations from ._operations import Operations +from ._network_profile_operations import NetworkProfileOperations +from ._hybrid_identity_metadata_operations import HybridIdentityMetadataOperations +from ._agent_version_operations import AgentVersionOperations from ._private_link_scopes_operations import PrivateLinkScopesOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations @@ -19,10 +25,16 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ + "LicensesOperations", "MachinesOperations", + "LicenseProfilesOperations", "MachineExtensionsOperations", "HybridComputeManagementClientOperationsMixin", + "ExtensionMetadataOperations", "Operations", + "NetworkProfileOperations", + "HybridIdentityMetadataOperations", + "AgentVersionOperations", "PrivateLinkScopesOperations", "PrivateLinkResourcesOperations", "PrivateEndpointConnectionsOperations", diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_agent_version_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_agent_version_operations.py new file mode 100644 index 000000000000..d828f9302186 --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_agent_version_operations.py @@ -0,0 +1,219 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import HybridComputeManagementClientMixinABC, _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request(os_type: 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-06-20-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.HybridCompute/osType/{osType}/agentVersions") + path_format_arguments = { + "osType": _SERIALIZER.url("os_type", os_type, "str"), + } + + _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(os_type: str, version: 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-06-20-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.HybridCompute/osType/{osType}/agentVersions/{version}") + path_format_arguments = { + "osType": _SERIALIZER.url("os_type", os_type, "str"), + "version": _SERIALIZER.url("version", version, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class AgentVersionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s + :attr:`agent_version` 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(self, os_type: str, **kwargs: Any) -> _models.AgentVersionsList: + """Gets all Agent Versions along with the download link currently present. + + :param os_type: Defines the os type. Required. + :type os_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AgentVersionsList or the result of cls(response) + :rtype: ~azure.mgmt.hybridcompute.models.AgentVersionsList + :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.AgentVersionsList] = kwargs.pop("cls", None) + + request = build_list_request( + os_type=os_type, + 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) + + _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.ErrorResponseAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AgentVersionsList", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {"url": "/providers/Microsoft.HybridCompute/osType/{osType}/agentVersions"} + + @distributed_trace + def get(self, os_type: str, version: str, **kwargs: Any) -> _models.AgentVersion: + """Gets an Agent Version along with the download link currently present. + + :param os_type: Defines the os type. Required. + :type os_type: str + :param version: Defines the agent version. To get latest, use latest or else a specific agent + version. Required. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AgentVersion or the result of cls(response) + :rtype: ~azure.mgmt.hybridcompute.models.AgentVersion + :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.AgentVersion] = kwargs.pop("cls", None) + + request = build_get_request( + os_type=os_type, + version=version, + 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.ErrorResponseAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AgentVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {"url": "/providers/Microsoft.HybridCompute/osType/{osType}/agentVersions/{version}"} diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_extension_metadata_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_extension_metadata_operations.py new file mode 100644 index 000000000000..aed5d3d35ce2 --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_extension_metadata_operations.py @@ -0,0 +1,285 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import HybridComputeManagementClientMixinABC, _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + location: str, publisher: str, extension_type: str, version: 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-06-20-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions/{version}", + ) # 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"), + "publisher": _SERIALIZER.url("publisher", publisher, "str"), + "extensionType": _SERIALIZER.url("extension_type", extension_type, "str"), + "version": _SERIALIZER.url("version", version, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request( + location: str, publisher: str, extension_type: 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-06-20-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions", + ) # 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"), + "publisher": _SERIALIZER.url("publisher", publisher, "str"), + "extensionType": _SERIALIZER.url("extension_type", extension_type, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ExtensionMetadataOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s + :attr:`extension_metadata` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, location: str, publisher: str, extension_type: str, version: str, **kwargs: Any + ) -> _models.ExtensionValue: + """Gets an Extension Metadata based on location, publisher, extensionType and version. + + :param location: The location of the Extension being received. Required. + :type location: str + :param publisher: The publisher of the Extension being received. Required. + :type publisher: str + :param extension_type: The extensionType of the Extension being received. Required. + :type extension_type: str + :param version: The version of the Extension being received. Required. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExtensionValue or the result of cls(response) + :rtype: ~azure.mgmt.hybridcompute.models.ExtensionValue + :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.ExtensionValue] = kwargs.pop("cls", None) + + request = build_get_request( + location=location, + publisher=publisher, + extension_type=extension_type, + version=version, + 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("ExtensionValue", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions/{version}" + } + + @distributed_trace + def list( + self, location: str, publisher: str, extension_type: str, **kwargs: Any + ) -> Iterable["_models.ExtensionValue"]: + """Gets all Extension versions based on location, publisher, extensionType. + + :param location: The location of the Extension being received. Required. + :type location: str + :param publisher: The publisher of the Extension being received. Required. + :type publisher: str + :param extension_type: The extensionType of the Extension being received. Required. + :type extension_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExtensionValue or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.ExtensionValue] + :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.ExtensionValueListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + location=location, + publisher=publisher, + extension_type=extension_type, + 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) + + 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("ExtensionValueListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions" + } diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_hybrid_compute_management_client_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_hybrid_compute_management_client_operations.py index 3bf746ea295b..c37e925dee9a 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_hybrid_compute_management_client_operations.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_hybrid_compute_management_client_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -28,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import HybridComputeManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import HybridComputeManagementClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,7 @@ def build_upgrade_extensions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-10")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-20-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -61,10 +57,12 @@ def build_upgrade_extensions_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "machineName": _SERIALIZER.url("machine_name", machine_name, "str"), + "machineName": _SERIALIZER.url( + "machine_name", machine_name, "str", max_length=54, min_length=1, pattern=r"[a-zA-Z0-9-_\.]" + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -96,16 +94,14 @@ def _upgrade_extensions_initial( # pylint: disable=inconsistent-return-statemen _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(extension_upgrade_parameters, (IO, bytes)): + if isinstance(extension_upgrade_parameters, (IOBase, bytes)): _content = extension_upgrade_parameters else: _json = self._serialize.body(extension_upgrade_parameters, "MachineExtensionUpgrade") @@ -125,8 +121,9 @@ def _upgrade_extensions_initial( # pylint: disable=inconsistent-return-statemen request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -136,8 +133,16 @@ def _upgrade_extensions_initial( # pylint: disable=inconsistent-return-statemen error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _upgrade_extensions_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/upgradeExtensions" @@ -231,7 +236,7 @@ def begin_upgrade_extensions( :param machine_name: The name of the hybrid machine. Required. :type machine_name: str :param extension_upgrade_parameters: Parameters supplied to the Upgrade Extensions operation. - Is either a model type or a IO type. Required. + Is either a MachineExtensionUpgrade type or a IO type. Required. :type extension_upgrade_parameters: ~azure.mgmt.hybridcompute.models.MachineExtensionUpgrade or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -252,9 +257,7 @@ def begin_upgrade_extensions( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_hybrid_identity_metadata_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_hybrid_identity_metadata_operations.py new file mode 100644 index 000000000000..23b936ab1314 --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_hybrid_identity_metadata_operations.py @@ -0,0 +1,292 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import HybridComputeManagementClientMixinABC, _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, machine_name: str, metadata_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-20-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/hybridIdentityMetadata/{metadataName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "machineName": _SERIALIZER.url( + "machine_name", machine_name, "str", max_length=54, min_length=1, pattern=r"[a-zA-Z0-9-_\.]" + ), + "metadataName": _SERIALIZER.url("metadata_name", metadata_name, "str", pattern=r"[a-zA-Z0-9-_\.]"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_machines_request( + resource_group_name: str, machine_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-20-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/hybridIdentityMetadata", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "machineName": _SERIALIZER.url( + "machine_name", machine_name, "str", max_length=54, min_length=1, pattern=r"[a-zA-Z0-9-_\.]" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class HybridIdentityMetadataOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s + :attr:`hybrid_identity_metadata` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, machine_name: str, metadata_name: str, **kwargs: Any + ) -> _models.HybridIdentityMetadata: + """Gets HybridIdentityMetadata. + + Implements HybridIdentityMetadata GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param metadata_name: Name of the HybridIdentityMetadata. Required. + :type metadata_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HybridIdentityMetadata or the result of cls(response) + :rtype: ~azure.mgmt.hybridcompute.models.HybridIdentityMetadata + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.HybridIdentityMetadata] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + metadata_name=metadata_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("HybridIdentityMetadata", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/hybridIdentityMetadata/{metadataName}" + } + + @distributed_trace + def list_by_machines( + self, resource_group_name: str, machine_name: str, **kwargs: Any + ) -> Iterable["_models.HybridIdentityMetadata"]: + """Implements GET HybridIdentityMetadata in a machine. + + Returns the list of HybridIdentityMetadata of the given machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HybridIdentityMetadata or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.HybridIdentityMetadata] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.HybridIdentityMetadataList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_machines_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_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 + + def extract_data(pipeline_response): + deserialized = self._deserialize("HybridIdentityMetadataList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_machines.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/hybridIdentityMetadata" + } diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_license_profiles_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_license_profiles_operations.py new file mode 100644 index 000000000000..d9ffc77440dc --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_license_profiles_operations.py @@ -0,0 +1,1009 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import HybridComputeManagementClientMixinABC, _convert_request + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_or_update_request( + resource_group_name: str, machine_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-20-preview")) + license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") + 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.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "machineName": _SERIALIZER.url("machine_name", machine_name, "str", pattern=r"[a-zA-Z0-9-_\.]+"), + "licenseProfileName": _SERIALIZER.url("license_profile_name", license_profile_name, "str"), + } + + _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_update_request( + resource_group_name: str, machine_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-20-preview")) + license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") + 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.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "machineName": _SERIALIZER.url("machine_name", machine_name, "str", pattern=r"[a-zA-Z0-9-_\.]+"), + "licenseProfileName": _SERIALIZER.url("license_profile_name", license_profile_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(resource_group_name: str, machine_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-20-preview")) + license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "machineName": _SERIALIZER.url("machine_name", machine_name, "str", pattern=r"[a-zA-Z0-9-_\.]+"), + "licenseProfileName": _SERIALIZER.url("license_profile_name", license_profile_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, machine_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-20-preview")) + license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "machineName": _SERIALIZER.url("machine_name", machine_name, "str", pattern=r"[a-zA-Z0-9-_\.]+"), + "licenseProfileName": _SERIALIZER.url("license_profile_name", license_profile_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request(resource_group_name: str, machine_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-20-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "machineName": _SERIALIZER.url( + "machine_name", machine_name, "str", max_length=54, min_length=1, pattern=r"[a-zA-Z0-9-_\.]" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class LicenseProfilesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s + :attr:`license_profiles` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _create_or_update_initial( + self, resource_group_name: str, machine_name: str, parameters: Union[_models.LicenseProfile, IO], **kwargs: Any + ) -> _models.LicenseProfile: + 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)) + license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LicenseProfile] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "LicenseProfile") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + license_profile_name=license_profile_name, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("LicenseProfile", 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")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("LicenseProfile", pipeline_response) + + if cls: + 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.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + machine_name: str, + parameters: _models.LicenseProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.LicenseProfile]: + """The operation to create or update a license profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Create license profile operation. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.LicenseProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword license_profile_name: The name of the license profile. Default value is "default". + Note that overriding this default value may result in unsupported behavior. + :paramtype license_profile_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 LicenseProfile or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + machine_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.LicenseProfile]: + """The operation to create or update a license profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Create license profile operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword license_profile_name: The name of the license profile. Default value is "default". + Note that overriding this default value may result in unsupported behavior. + :paramtype license_profile_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 LicenseProfile or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, machine_name: str, parameters: Union[_models.LicenseProfile, IO], **kwargs: Any + ) -> LROPoller[_models.LicenseProfile]: + """The operation to create or update a license profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Create license profile operation. Is either a + LicenseProfile type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.LicenseProfile or IO + :keyword license_profile_name: The name of the license profile. Default value is "default". + Note that overriding this default value may result in unsupported behavior. + :paramtype license_profile_name: str + :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 LicenseProfile or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] + :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)) + license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LicenseProfile] = 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, + machine_name=machine_name, + parameters=parameters, + api_version=api_version, + license_profile_name=license_profile_name, + 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("LicenseProfile", 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_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}" + } + + def _update_initial( + self, + resource_group_name: str, + machine_name: str, + parameters: Union[_models.LicenseProfileUpdate, IO], + **kwargs: Any + ) -> Optional[_models.LicenseProfile]: + 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)) + license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.LicenseProfile]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "LicenseProfileUpdate") + + request = build_update_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + license_profile_name=license_profile_name, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("LicenseProfile", 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")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + machine_name: str, + parameters: _models.LicenseProfileUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.LicenseProfile]: + """The operation to update a license profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Update license profile operation. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.LicenseProfileUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword license_profile_name: The name of the license profile. Default value is "default". + Note that overriding this default value may result in unsupported behavior. + :paramtype license_profile_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 LicenseProfile or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + machine_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.LicenseProfile]: + """The operation to update a license profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Update license profile operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword license_profile_name: The name of the license profile. Default value is "default". + Note that overriding this default value may result in unsupported behavior. + :paramtype license_profile_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 LicenseProfile or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + machine_name: str, + parameters: Union[_models.LicenseProfileUpdate, IO], + **kwargs: Any + ) -> LROPoller[_models.LicenseProfile]: + """The operation to update a license profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Update license profile operation. Is either a + LicenseProfileUpdate type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.LicenseProfileUpdate or IO + :keyword license_profile_name: The name of the license profile. Default value is "default". + Note that overriding this default value may result in unsupported behavior. + :paramtype license_profile_name: str + :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 LicenseProfile or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] + :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)) + license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LicenseProfile] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + machine_name=machine_name, + parameters=parameters, + api_version=api_version, + license_profile_name=license_profile_name, + 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("LicenseProfile", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}" + } + + @distributed_trace + def get(self, resource_group_name: str, machine_name: str, **kwargs: Any) -> _models.LicenseProfile: + """Retrieves information about the view of a license profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :keyword license_profile_name: The name of the license profile. Default value is "default". + Note that overriding this default value may result in unsupported behavior. + :paramtype license_profile_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LicenseProfile or the result of cls(response) + :rtype: ~azure.mgmt.hybridcompute.models.LicenseProfile + :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)) + license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") + cls: ClsType[_models.LicenseProfile] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + license_profile_name=license_profile_name, + 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("LicenseProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, machine_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + license_profile_name=license_profile_name, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, machine_name: str, **kwargs: Any) -> LROPoller[None]: + """The operation to delete a license profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :keyword license_profile_name: The name of the license profile. Default value is "default". + Note that overriding this default value may result in unsupported behavior. + :paramtype license_profile_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") + 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, + machine_name=machine_name, + api_version=api_version, + license_profile_name=license_profile_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}" + } + + @distributed_trace + def list(self, resource_group_name: str, machine_name: str, **kwargs: Any) -> Iterable["_models.LicenseProfile"]: + """The operation to get all license profiles of a non-Azure machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the machine. Required. + :type machine_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LicenseProfile or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.LicenseProfile] + :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.LicenseProfilesListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + machine_name=machine_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) + + 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("LicenseProfilesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles" + } diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_licenses_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_licenses_operations.py new file mode 100644 index 000000000000..f9c4b0b527cd --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_licenses_operations.py @@ -0,0 +1,1223 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import HybridComputeManagementClientMixinABC, _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_validate_license_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-06-20-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/validateLicense" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + 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_create_or_update_request( + resource_group_name: str, license_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-06-20-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/licenses/{licenseName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "licenseName": _SERIALIZER.url("license_name", license_name, "str", pattern=r"[a-zA-Z0-9-_\.]+"), + } + + _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_update_request( + resource_group_name: str, license_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-06-20-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/licenses/{licenseName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "licenseName": _SERIALIZER.url("license_name", license_name, "str", pattern=r"[a-zA-Z0-9-_\.]+"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(resource_group_name: str, license_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-06-20-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/licenses/{licenseName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "licenseName": _SERIALIZER.url("license_name", license_name, "str", pattern=r"[a-zA-Z0-9-_\.]+"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, license_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-06-20-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/licenses/{licenseName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "licenseName": _SERIALIZER.url("license_name", license_name, "str", pattern=r"[a-zA-Z0-9-_\.]+"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-20-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/licenses", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-20-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/licenses") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class LicensesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s + :attr:`licenses` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _validate_license_initial(self, parameters: Union[_models.License, IO], **kwargs: Any) -> _models.License: + 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.License] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "License") + + request = build_validate_license_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._validate_license_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]: + 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("License", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _validate_license_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/validateLicense" + } + + @overload + def begin_validate_license( + self, parameters: _models.License, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.License]: + """The operation to validate a license. + + :param parameters: Parameters supplied to the license validation operation. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.License + :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 License or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.License] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_validate_license( + self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.License]: + """The operation to validate a license. + + :param parameters: Parameters supplied to the license validation operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either License or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.License] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_validate_license( + self, parameters: Union[_models.License, IO], **kwargs: Any + ) -> LROPoller[_models.License]: + """The operation to validate a license. + + :param parameters: Parameters supplied to the license validation operation. Is either a License + type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.License 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 License or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.License] + :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.License] = 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._validate_license_initial( + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("License", 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_validate_license.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/validateLicense" + } + + def _create_or_update_initial( + self, resource_group_name: str, license_name: str, parameters: Union[_models.License, IO], **kwargs: Any + ) -> _models.License: + 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.License] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "License") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + license_name=license_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + 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("License", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/licenses/{licenseName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + license_name: str, + parameters: _models.License, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.License]: + """The operation to create or update a license. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param license_name: The name of the license. Required. + :type license_name: str + :param parameters: Parameters supplied to the Create license operation. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.License + :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 License or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.License] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + license_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.License]: + """The operation to create or update a license. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param license_name: The name of the license. Required. + :type license_name: str + :param parameters: Parameters supplied to the Create license operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either License or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.License] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, license_name: str, parameters: Union[_models.License, IO], **kwargs: Any + ) -> LROPoller[_models.License]: + """The operation to create or update a license. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param license_name: The name of the license. Required. + :type license_name: str + :param parameters: Parameters supplied to the Create license operation. Is either a License + type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.License 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 License or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.License] + :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.License] = 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, + license_name=license_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("License", 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_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/licenses/{licenseName}" + } + + def _update_initial( + self, resource_group_name: str, license_name: str, parameters: Union[_models.LicenseUpdate, IO], **kwargs: Any + ) -> _models.License: + 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.License] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "LicenseUpdate") + + request = build_update_request( + resource_group_name=resource_group_name, + license_name=license_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + 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("License", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/licenses/{licenseName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + license_name: str, + parameters: _models.LicenseUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.License]: + """The operation to update a license. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param license_name: The name of the license. Required. + :type license_name: str + :param parameters: Parameters supplied to the Update license operation. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.LicenseUpdate + :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 License or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.License] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + license_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.License]: + """The operation to update a license. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param license_name: The name of the license. Required. + :type license_name: str + :param parameters: Parameters supplied to the Update license operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either License or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.License] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, resource_group_name: str, license_name: str, parameters: Union[_models.LicenseUpdate, IO], **kwargs: Any + ) -> LROPoller[_models.License]: + """The operation to update a license. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param license_name: The name of the license. Required. + :type license_name: str + :param parameters: Parameters supplied to the Update license operation. Is either a + LicenseUpdate type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.LicenseUpdate 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 License or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.License] + :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.License] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + license_name=license_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("License", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/licenses/{licenseName}" + } + + @distributed_trace + def get(self, resource_group_name: str, license_name: str, **kwargs: Any) -> _models.License: + """Retrieves information about the view of a license. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param license_name: The name of the license. Required. + :type license_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: License or the result of cls(response) + :rtype: ~azure.mgmt.hybridcompute.models.License + :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.License] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + license_name=license_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("License", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/licenses/{licenseName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, license_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + license_name=license_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/licenses/{licenseName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, license_name: str, **kwargs: Any) -> LROPoller[None]: + """The operation to delete a license. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param license_name: The name of the license. Required. + :type license_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + license_name=license_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/licenses/{licenseName}" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.License"]: + """The operation to get all licenses of a non-Azure machine. + + :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 License or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.License] + :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.LicensesListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("LicensesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/licenses" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.License"]: + """The operation to get all licenses of a non-Azure machine. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either License or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.License] + :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.LicensesListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("LicensesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/licenses" + } diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_machine_extensions_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_machine_extensions_operations.py index 1362e42cc39a..57d18921460e 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_machine_extensions_operations.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_machine_extensions_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import HybridComputeManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import HybridComputeManagementClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-10")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-20-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -62,12 +58,14 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "machineName": _SERIALIZER.url("machine_name", machine_name, "str"), + "machineName": _SERIALIZER.url( + "machine_name", machine_name, "str", max_length=54, min_length=1, pattern=r"[a-zA-Z0-9-_\.]" + ), "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -86,7 +84,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-10")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-20-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -99,12 +97,14 @@ def build_update_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "machineName": _SERIALIZER.url("machine_name", machine_name, "str"), + "machineName": _SERIALIZER.url( + "machine_name", machine_name, "str", max_length=54, min_length=1, pattern=r"[a-zA-Z0-9-_\.]" + ), "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -123,7 +123,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-10")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-20-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -135,12 +135,14 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "machineName": _SERIALIZER.url("machine_name", machine_name, "str"), + "machineName": _SERIALIZER.url( + "machine_name", machine_name, "str", max_length=54, min_length=1, pattern=r"[a-zA-Z0-9-_\.]" + ), "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -157,7 +159,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-10")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-20-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -169,12 +171,14 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "machineName": _SERIALIZER.url("machine_name", machine_name, "str"), + "machineName": _SERIALIZER.url( + "machine_name", machine_name, "str", max_length=54, min_length=1, pattern=r"[a-zA-Z0-9-_\.]" + ), "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -191,7 +195,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-10")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-20-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -203,11 +207,13 @@ def build_list_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "machineName": _SERIALIZER.url("machine_name", machine_name, "str"), + "machineName": _SERIALIZER.url( + "machine_name", machine_name, "str", max_length=54, min_length=1, pattern=r"[a-zA-Z0-9-_\.]" + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -258,16 +264,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.MachineExtension]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(extension_parameters, (IO, bytes)): + if isinstance(extension_parameters, (IOBase, bytes)): _content = extension_parameters else: _json = self._serialize.body(extension_parameters, "MachineExtension") @@ -288,8 +292,9 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -414,7 +419,7 @@ def begin_create_or_update( :param extension_name: The name of the machine extension. Required. :type extension_name: str :param extension_parameters: Parameters supplied to the Create Machine Extension operation. Is - either a model type or a IO type. Required. + either a MachineExtension type or a IO type. Required. :type extension_parameters: ~azure.mgmt.hybridcompute.models.MachineExtension or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -435,9 +440,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.MachineExtension] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -502,16 +505,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.MachineExtension]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(extension_parameters, (IO, bytes)): + if isinstance(extension_parameters, (IOBase, bytes)): _content = extension_parameters else: _json = self._serialize.body(extension_parameters, "MachineExtensionUpdate") @@ -532,8 +533,9 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -544,11 +546,19 @@ def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("MachineExtension", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized @@ -658,7 +668,7 @@ def begin_update( :param extension_name: The name of the machine extension. Required. :type extension_name: str :param extension_parameters: Parameters supplied to the Create Machine Extension operation. Is - either a model type or a IO type. Required. + either a MachineExtensionUpdate type or a IO type. Required. :type extension_parameters: ~azure.mgmt.hybridcompute.models.MachineExtensionUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -679,9 +689,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.MachineExtension] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -741,9 +749,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -759,8 +765,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -770,8 +777,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}" @@ -805,9 +820,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -877,9 +890,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MachineExtension] = kwargs.pop("cls", None) request = build_get_request( @@ -895,8 +906,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -938,9 +950,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MachineExtensionsListResult] = kwargs.pop("cls", None) error_map = { @@ -995,8 +1005,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_machines_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_machines_operations.py index 9de684ceaf32..7bd5e95a81f2 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_machines_operations.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_machines_operations.py @@ -6,8 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -21,19 +21,17 @@ 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 HybridComputeManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import HybridComputeManagementClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +45,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-10")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-20-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,10 +58,12 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "machineName": _SERIALIZER.url("machine_name", machine_name, "str"), + "machineName": _SERIALIZER.url( + "machine_name", machine_name, "str", max_length=54, min_length=1, pattern=r"[a-zA-Z0-9-_\.]" + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -85,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: Literal["2022-03-10"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-10")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-20-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,10 +98,12 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "machineName": _SERIALIZER.url("machine_name", machine_name, "str"), + "machineName": _SERIALIZER.url( + "machine_name", machine_name, "str", max_length=54, min_length=1, pattern=r"[a-zA-Z0-9-_\.]" + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,11 +116,78 @@ def build_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_assess_patches_request( + resource_group_name: str, 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-06-20-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{name}/assessPatches", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_install_patches_request( + resource_group_name: str, 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-06-20-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{name}/installPatches", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request( + resource_group_name: str, subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-10")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-20-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -133,10 +202,12 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -148,7 +219,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-10")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-20-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -157,7 +228,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -191,7 +262,7 @@ def __init__(self, *args, **kwargs): def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, machine_name: str, **kwargs: Any ) -> None: - """The operation to remove a hybrid machine identity in Azure. + """The operation to delete a hybrid machine. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -214,9 +285,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -231,8 +300,9 @@ def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -283,9 +353,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Machine] = kwargs.pop("cls", None) request = build_get_request( @@ -301,8 +369,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -323,14 +392,380 @@ def get( "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}" } + def _assess_patches_initial( + self, resource_group_name: str, name: str, **kwargs: Any + ) -> Optional[_models.MachineAssessPatchesResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.MachineAssessPatchesResult]] = kwargs.pop("cls", None) + + request = build_assess_patches_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._assess_patches_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("MachineAssessPatchesResult", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _assess_patches_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{name}/assessPatches" + } + + @distributed_trace + def begin_assess_patches( + self, resource_group_name: str, name: str, **kwargs: Any + ) -> LROPoller[_models.MachineAssessPatchesResult]: + """The operation to assess patches on a hybrid machine identity in Azure. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param name: The name of the hybrid machine. Required. + :type 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 MachineAssessPatchesResult or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.MachineAssessPatchesResult] + :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.MachineAssessPatchesResult] = 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._assess_patches_initial( + resource_group_name=resource_group_name, + name=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): + deserialized = self._deserialize("MachineAssessPatchesResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_assess_patches.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{name}/assessPatches" + } + + def _install_patches_initial( + self, + resource_group_name: str, + name: str, + install_patches_input: Union[_models.MachineInstallPatchesParameters, IO], + **kwargs: Any + ) -> Optional[_models.MachineInstallPatchesResult]: + 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.MachineInstallPatchesResult]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(install_patches_input, (IOBase, bytes)): + _content = install_patches_input + else: + _json = self._serialize.body(install_patches_input, "MachineInstallPatchesParameters") + + request = build_install_patches_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._install_patches_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("MachineInstallPatchesResult", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _install_patches_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{name}/installPatches" + } + + @overload + def begin_install_patches( + self, + resource_group_name: str, + name: str, + install_patches_input: _models.MachineInstallPatchesParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MachineInstallPatchesResult]: + """The operation to install patches on a hybrid machine identity in Azure. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param name: The name of the hybrid machine. Required. + :type name: str + :param install_patches_input: Input for InstallPatches as directly received by the API. + Required. + :type install_patches_input: ~azure.mgmt.hybridcompute.models.MachineInstallPatchesParameters + :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 MachineInstallPatchesResult or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.MachineInstallPatchesResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_install_patches( + self, + resource_group_name: str, + name: str, + install_patches_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MachineInstallPatchesResult]: + """The operation to install patches on a hybrid machine identity in Azure. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param name: The name of the hybrid machine. Required. + :type name: str + :param install_patches_input: Input for InstallPatches as directly received by the API. + Required. + :type install_patches_input: 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 MachineInstallPatchesResult or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.MachineInstallPatchesResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_install_patches( + self, + resource_group_name: str, + name: str, + install_patches_input: Union[_models.MachineInstallPatchesParameters, IO], + **kwargs: Any + ) -> LROPoller[_models.MachineInstallPatchesResult]: + """The operation to install patches on a hybrid machine identity in Azure. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param name: The name of the hybrid machine. Required. + :type name: str + :param install_patches_input: Input for InstallPatches as directly received by the API. Is + either a MachineInstallPatchesParameters type or a IO type. Required. + :type install_patches_input: ~azure.mgmt.hybridcompute.models.MachineInstallPatchesParameters + 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 MachineInstallPatchesResult or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.MachineInstallPatchesResult] + :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.MachineInstallPatchesResult] = 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._install_patches_initial( + resource_group_name=resource_group_name, + name=name, + install_patches_input=install_patches_input, + 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("MachineInstallPatchesResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_install_patches.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{name}/installPatches" + } + @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Machine"]: + def list_by_resource_group( + self, resource_group_name: str, expand: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.Machine"]: """Lists all the hybrid machines in the specified resource group. Use the nextLink property in the response to get the next page of hybrid machines. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str + :param expand: Expands referenced resources. Default value is None. + :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Machine or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.Machine] @@ -339,9 +774,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MachineListResult] = kwargs.pop("cls", None) error_map = { @@ -358,6 +791,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + expand=expand, api_version=api_version, template_url=self.list_by_resource_group.metadata["url"], headers=_headers, @@ -394,8 +828,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -425,9 +860,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Machine"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MachineListResult] = kwargs.pop("cls", None) error_map = { @@ -479,8 +912,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_network_profile_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_network_profile_operations.py new file mode 100644 index 000000000000..ed990b94a06b --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_network_profile_operations.py @@ -0,0 +1,150 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import HybridComputeManagementClientMixinABC, _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request(resource_group_name: str, machine_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-20-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/networkProfile", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "machineName": _SERIALIZER.url( + "machine_name", machine_name, "str", max_length=54, min_length=1, pattern=r"[a-zA-Z0-9-_\.]" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class NetworkProfileOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s + :attr:`network_profile` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, resource_group_name: str, machine_name: str, **kwargs: Any) -> _models.NetworkProfile: + """The operation to get network information of hybrid machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkProfile or the result of cls(response) + :rtype: ~azure.mgmt.hybridcompute.models.NetworkProfile + :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.NetworkProfile] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + machine_name=machine_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("NetworkProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/networkProfile" + } diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_operations.py index ac2c41358c96..6f3c2332f9f7 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_operations.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import HybridComputeManagementClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-10")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-20-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,9 +86,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { @@ -144,8 +137,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_private_endpoint_connections_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_private_endpoint_connections_operations.py index 273666ba7307..4a752a01adcc 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_private_endpoint_connections_operations.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_private_endpoint_connections_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import HybridComputeManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import HybridComputeManagementClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +49,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-10")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-20-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +68,7 @@ def build_get_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -93,7 +89,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-10")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-20-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -113,7 +109,7 @@ def build_create_or_update_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -136,7 +132,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-10")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-20-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -155,7 +151,7 @@ def build_delete_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -172,7 +168,7 @@ def build_list_by_private_link_scope_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-10")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-20-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -188,7 +184,7 @@ def build_list_by_private_link_scope_request( "scopeName": _SERIALIZER.url("scope_name", scope_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -247,9 +243,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) request = build_get_request( @@ -265,8 +259,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -306,16 +301,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PrivateEndpointConnection") @@ -336,8 +329,9 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -458,7 +452,7 @@ def begin_create_or_update( :type scope_name: str :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a PrivateEndpointConnection type or a IO type. Required. :type parameters: ~azure.mgmt.hybridcompute.models.PrivateEndpointConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -480,9 +474,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -542,9 +534,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -560,8 +550,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -571,8 +562,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}" @@ -606,9 +605,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -670,9 +667,7 @@ def list_by_private_link_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { @@ -726,8 +721,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_private_link_resources_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_private_link_resources_operations.py index 1996f1c9bba4..cc0cdfd86999 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_private_link_resources_operations.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_private_link_resources_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import HybridComputeManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import HybridComputeManagementClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +42,7 @@ def build_list_by_private_link_scope_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-10")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-20-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +58,7 @@ def build_list_by_private_link_scope_request( "scopeName": _SERIALIZER.url("scope_name", scope_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -80,7 +75,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-10")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-20-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +92,7 @@ def build_get_request( "groupName": _SERIALIZER.url("group_name", group_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -146,9 +141,7 @@ def list_by_private_link_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) error_map = { @@ -202,8 +195,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -249,9 +243,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) request = build_get_request( @@ -267,8 +259,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_private_link_scopes_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_private_link_scopes_operations.py index f67a6360fb4c..4952b702c903 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_private_link_scopes_operations.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_private_link_scopes_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import HybridComputeManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import HybridComputeManagementClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-10")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-20-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +54,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,7 +69,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-10")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-20-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88,7 +84,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -103,7 +99,7 @@ def build_delete_request(resource_group_name: str, scope_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-10")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-20-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -119,7 +115,7 @@ def build_delete_request(resource_group_name: str, scope_name: str, subscription "scopeName": _SERIALIZER.url("scope_name", scope_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -134,7 +130,7 @@ def build_get_request(resource_group_name: str, scope_name: str, subscription_id _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-10")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-20-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -150,7 +146,7 @@ def build_get_request(resource_group_name: str, scope_name: str, subscription_id "scopeName": _SERIALIZER.url("scope_name", scope_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -167,7 +163,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-10")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-20-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -184,7 +180,7 @@ def build_create_or_update_request( "scopeName": _SERIALIZER.url("scope_name", scope_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -203,7 +199,7 @@ def build_update_tags_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-10")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-20-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -220,7 +216,7 @@ def build_update_tags_request( "scopeName": _SERIALIZER.url("scope_name", scope_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -239,7 +235,7 @@ def build_get_validation_details_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-10")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-20-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -253,7 +249,7 @@ def build_get_validation_details_request( "privateLinkScopeId": _SERIALIZER.url("private_link_scope_id", private_link_scope_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -270,7 +266,7 @@ def build_get_validation_details_for_machine_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-10")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-20-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -286,7 +282,7 @@ def build_get_validation_details_for_machine_request( "machineName": _SERIALIZER.url("machine_name", machine_name, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -330,9 +326,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.HybridComputePrivateLinkScope _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HybridComputePrivateLinkScopeListResult] = kwargs.pop("cls", None) error_map = { @@ -384,8 +378,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -419,9 +414,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HybridComputePrivateLinkScopeListResult] = kwargs.pop("cls", None) error_map = { @@ -474,8 +467,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -506,9 +500,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -523,8 +515,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -534,8 +527,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}" @@ -565,9 +566,7 @@ def begin_delete(self, resource_group_name: str, scope_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -632,9 +631,7 @@ def get(self, resource_group_name: str, scope_name: str, **kwargs: Any) -> _mode _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HybridComputePrivateLinkScope] = kwargs.pop("cls", None) request = build_get_request( @@ -649,8 +646,9 @@ def get(self, resource_group_name: str, scope_name: str, **kwargs: Any) -> _mode request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -748,7 +746,8 @@ def create_or_update( :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. :type scope_name: str :param parameters: Properties that need to be specified to create or update a Azure Arc for - Servers and Clusters PrivateLinkScope. Is either a model type or a IO type. Required. + Servers and Clusters PrivateLinkScope. Is either a HybridComputePrivateLinkScope type or a IO + type. Required. :type parameters: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -769,16 +768,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.HybridComputePrivateLinkScope] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "HybridComputePrivateLinkScope") @@ -798,8 +795,9 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -901,7 +899,7 @@ def update_tags( :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. :type scope_name: str :param private_link_scope_tags: Updated tag information to set into the PrivateLinkScope - instance. Is either a model type or a IO type. Required. + instance. Is either a TagsResource type or a IO type. Required. :type private_link_scope_tags: ~azure.mgmt.hybridcompute.models.TagsResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -922,16 +920,14 @@ def update_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.HybridComputePrivateLinkScope] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(private_link_scope_tags, (IO, bytes)): + if isinstance(private_link_scope_tags, (IOBase, bytes)): _content = private_link_scope_tags else: _json = self._serialize.body(private_link_scope_tags, "TagsResource") @@ -951,8 +947,9 @@ def update_tags( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1000,9 +997,7 @@ def get_validation_details( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkScopeValidationDetails] = kwargs.pop("cls", None) request = build_get_validation_details_request( @@ -1017,8 +1012,9 @@ def get_validation_details( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1067,9 +1063,7 @@ def get_validation_details_for_machine( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-10"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkScopeValidationDetails] = kwargs.pop("cls", None) request = build_get_validation_details_for_machine_request( @@ -1084,8 +1078,9 @@ def get_validation_details_for_machine( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/dev_requirements.txt b/sdk/hybridcompute/azure-mgmt-hybridcompute/dev_requirements.txt index 1a1c8d8fc379..e9e110a3684f 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/dev_requirements.txt +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/dev_requirements.txt @@ -1,2 +1,4 @@ -e ../../../tools/azure-sdk-tools --e ../../../tools/azure-devtools \ No newline at end of file +-e ../../../tools/azure-devtools +-e ../../resources/azure-mgmt-resource +../../identity/azure-identity diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/agent_version_get_latest.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/agent_version_get_latest.py new file mode 100644 index 000000000000..5e34570de480 --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/agent_version_get_latest.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.hybridcompute import HybridComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridcompute +# USAGE + python agent_version_get_latest.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 = HybridComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.agent_version.get( + os_type="myOsType", + version="1.27", + ) + print(response) + + +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/AgentVersion_GetLatest.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/agent_versions_get.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/agent_versions_get.py new file mode 100644 index 000000000000..c02ec03b4210 --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/agent_versions_get.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.hybridcompute import HybridComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridcompute +# USAGE + python agent_versions_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 = HybridComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.agent_version.list( + os_type="myOsType", + ) + print(response) + + +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/AgentVersions_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/put_extension.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_create_or_update.py similarity index 93% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/put_extension.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_create_or_update.py index f0c1acd58846..1254956673b9 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/put_extension.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_create_or_update.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridcompute # USAGE - python put_extension.py + python extension_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, @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PUTExtension.json +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/extension/Extension_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/delete_extension.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_delete.py similarity index 88% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/delete_extension.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_delete.py index 815837a8162d..aa20a4da9d50 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/delete_extension.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_delete.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridcompute # USAGE - python delete_extension.py + python extension_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, @@ -29,14 +29,13 @@ def main(): subscription_id="{subscriptionId}", ) - response = client.machine_extensions.begin_delete( + client.machine_extensions.begin_delete( resource_group_name="myResourceGroup", machine_name="myMachine", extension_name="MMA", ).result() - print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/DELETEExtension.json +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/extension/Extension_Delete.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/get_extension.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_get.py similarity index 92% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/get_extension.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_get.py index 3810ab40ff02..2ab5fbbebbbf 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/get_extension.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_get.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridcompute # USAGE - python get_extension.py + python extension_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, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/GETExtension.json +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/extension/Extension_Get.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/list_extension.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_list.py similarity index 92% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/list_extension.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_list.py index d08aeda3992c..4f70efb6aea2 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/list_extension.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridcompute # USAGE - python list_extension.py + python extension_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, @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/LISTExtension.json +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/extension/Extension_List.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_metadata_get.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_metadata_get.py new file mode 100644 index 000000000000..ad19dc6d001b --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_metadata_get.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.hybridcompute import HybridComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridcompute +# USAGE + python extension_metadata_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 = HybridComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + ) + + response = client.extension_metadata.get( + location="EastUS", + publisher="microsoft.azure.monitor", + extension_type="azuremonitorlinuxagent", + version="1.9.1", + ) + print(response) + + +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/extension/ExtensionMetadata_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_metadata_list.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_metadata_list.py new file mode 100644 index 000000000000..a1c89bcb2ee5 --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_metadata_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.hybridcompute import HybridComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridcompute +# USAGE + python extension_metadata_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + 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 = HybridComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + ) + + response = client.extension_metadata.list( + location="EastUS", + publisher="microsoft.azure.monitor", + extension_type="azuremonitorlinuxagent", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/extension/ExtensionMetadata_List.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/update_extension.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_update.py similarity index 91% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/update_extension.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_update.py index 59f1c0959211..2e13c0d45699 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/update_extension.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_update.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridcompute # USAGE - python update_extension.py + python extension_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, @@ -35,6 +35,7 @@ def main(): extension_name="CustomScriptExtension", extension_parameters={ "properties": { + "enableAutomaticUpgrade": True, "publisher": "Microsoft.Compute", "settings": {"commandToExecute": 'powershell.exe -c "Get-Process | Where-Object { $_.CPU -lt 100 }"'}, "type": "CustomScriptExtension", @@ -45,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/UpdateExtension.json +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/extension/Extension_Update.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extensions_upgrade.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extensions_upgrade.py similarity index 92% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extensions_upgrade.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extensions_upgrade.py index bc32f852f1be..b04e5dd59191 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extensions_upgrade.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extensions_upgrade.py @@ -29,7 +29,7 @@ def main(): subscription_id="{subscriptionId}", ) - response = client.begin_upgrade_extensions( + client.begin_upgrade_extensions( resource_group_name="myResourceGroup", machine_name="myMachine", extension_upgrade_parameters={ @@ -39,9 +39,8 @@ def main(): } }, ).result() - print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/Extensions_Upgrade.json +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/extension/Extensions_Upgrade.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/hybrid_identity_metadata_get.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/hybrid_identity_metadata_get.py new file mode 100644 index 000000000000..e3753633aba1 --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/hybrid_identity_metadata_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.hybridcompute import HybridComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridcompute +# USAGE + python hybrid_identity_metadata_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 = HybridComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + ) + + response = client.hybrid_identity_metadata.get( + resource_group_name="testrg", + machine_name="ContosoVm", + metadata_name="default", + ) + print(response) + + +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/HybridIdentityMetadata_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/hybrid_identity_metadata_list_by_virtual_machines.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/hybrid_identity_metadata_list_by_virtual_machines.py new file mode 100644 index 000000000000..ddd4c0ed1332 --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/hybrid_identity_metadata_list_by_virtual_machines.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.hybridcompute import HybridComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridcompute +# USAGE + python hybrid_identity_metadata_list_by_virtual_machines.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = HybridComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + ) + + response = client.hybrid_identity_metadata.list_by_machines( + resource_group_name="testrg", + machine_name="ContosoVm", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/HybridIdentityMetadata_ListByVirtualMachines.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_create_or_update.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_create_or_update.py new file mode 100644 index 000000000000..d917a5a1c1f3 --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_create_or_update.py @@ -0,0 +1,54 @@ +# 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.hybridcompute import HybridComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridcompute +# USAGE + python license_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 = HybridComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.licenses.begin_create_or_update( + resource_group_name="myResourceGroup", + license_name="{licenseName}", + parameters={ + "location": "eastus2euap", + "properties": { + "licenseDetails": { + "edition": "Datacenter", + "processors": 6, + "state": "Activated", + "target": "Windows Server 2012", + "type": "pCore", + }, + "licenseType": "ESU", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/license/License_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_delete.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_delete.py new file mode 100644 index 000000000000..a89d3869ea84 --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_delete.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.hybridcompute import HybridComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridcompute +# USAGE + python license_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 = HybridComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + client.licenses.begin_delete( + resource_group_name="myResourceGroup", + license_name="{licenseName}", + ).result() + + +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/license/License_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_get.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_get.py new file mode 100644 index 000000000000..0cacd126fbda --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_get.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.hybridcompute import HybridComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridcompute +# USAGE + python license_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 = HybridComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.licenses.get( + resource_group_name="myResourceGroup", + license_name="{licenseName}", + ) + print(response) + + +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/license/License_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_list_by_resource_group.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_list_by_resource_group.py new file mode 100644 index 000000000000..8f9e5527be67 --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_list_by_resource_group.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.hybridcompute import HybridComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridcompute +# USAGE + python license_list_by_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = HybridComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.licenses.list_by_resource_group( + resource_group_name="myResourceGroup", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/license/License_ListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_list_by_subscription.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_list_by_subscription.py new file mode 100644 index 000000000000..4b8eff112033 --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_list_by_subscription.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.hybridcompute import HybridComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridcompute +# USAGE + python license_list_by_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = HybridComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.licenses.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/license/License_ListBySubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_update.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_update.py new file mode 100644 index 000000000000..d9506607072e --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_update.py @@ -0,0 +1,53 @@ +# 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.hybridcompute import HybridComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridcompute +# USAGE + python license_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 = HybridComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.licenses.begin_update( + resource_group_name="myResourceGroup", + license_name="{licenseName}", + parameters={ + "properties": { + "licenseDetails": { + "edition": "Datacenter", + "processors": 6, + "state": "Activated", + "target": "Windows Server 2012", + "type": "pCore", + }, + "licenseType": "ESU", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/license/License_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_validate_license.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_validate_license.py new file mode 100644 index 000000000000..c9080f2f48c7 --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_validate_license.py @@ -0,0 +1,52 @@ +# 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.hybridcompute import HybridComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridcompute +# USAGE + python license_validate_license.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 = HybridComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.licenses.begin_validate_license( + parameters={ + "location": "eastus2euap", + "properties": { + "licenseDetails": { + "edition": "Datacenter", + "processors": 6, + "state": "Activated", + "target": "Windows Server 2012", + "type": "pCore", + }, + "licenseType": "ESU", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/license/License_ValidateLicense.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile/license_profile_create_or_update.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile/license_profile_create_or_update.py new file mode 100644 index 000000000000..8b06992af15d --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile/license_profile_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 azure.identity import DefaultAzureCredential +from azure.mgmt.hybridcompute import HybridComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridcompute +# USAGE + python license_profile_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 = HybridComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.license_profiles.begin_create_or_update( + resource_group_name="myResourceGroup", + machine_name="myMachine", + parameters={ + "location": "eastus2euap", + "properties": {"esuProfile": {"assignedLicense": "{LicenseResourceId}"}}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/licenseProfile/LicenseProfile_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile/license_profile_delete.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile/license_profile_delete.py new file mode 100644 index 000000000000..7adb76b9e235 --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile/license_profile_delete.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.hybridcompute import HybridComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridcompute +# USAGE + python license_profile_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 = HybridComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + client.license_profiles.begin_delete( + resource_group_name="myResourceGroup", + machine_name="myMachine", + ).result() + + +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/licenseProfile/LicenseProfile_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile/license_profile_get.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile/license_profile_get.py new file mode 100644 index 000000000000..babf3d75dda7 --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile/license_profile_get.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.hybridcompute import HybridComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridcompute +# USAGE + python license_profile_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 = HybridComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.license_profiles.get( + resource_group_name="myResourceGroup", + machine_name="myMachine", + ) + print(response) + + +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/licenseProfile/LicenseProfile_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile/license_profile_list.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile/license_profile_list.py new file mode 100644 index 000000000000..6995ee8db3c3 --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile/license_profile_list.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.hybridcompute import HybridComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridcompute +# USAGE + python license_profile_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 = HybridComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.license_profiles.list( + resource_group_name="myResourceGroup", + machine_name="myMachine", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/licenseProfile/LicenseProfile_List.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile/license_profile_update.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile/license_profile_update.py new file mode 100644 index 000000000000..53737b40a77e --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile/license_profile_update.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.hybridcompute import HybridComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridcompute +# USAGE + python license_profile_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 = HybridComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.license_profiles.begin_update( + resource_group_name="myResourceGroup", + machine_name="myMachine", + parameters={"properties": {"esuProfile": {"assignedLicense": "{LicenseResourceId}"}}}, + ).result() + print(response) + + +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/licenseProfile/LicenseProfile_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machine_assess_patches.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machine_assess_patches.py new file mode 100644 index 000000000000..332043dfec7e --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machine_assess_patches.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.hybridcompute import HybridComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridcompute +# USAGE + python machine_assess_patches.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 = HybridComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.machines.begin_assess_patches( + resource_group_name="myResourceGroupName", + name="myMachineName", + ).result() + print(response) + + +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/machine/Machine_AssessPatches.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machine_install_patches.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machine_install_patches.py new file mode 100644 index 000000000000..2c58025062f5 --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machine_install_patches.py @@ -0,0 +1,49 @@ +# 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.hybridcompute import HybridComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridcompute +# USAGE + python machine_install_patches.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 = HybridComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.machines.begin_install_patches( + resource_group_name="myResourceGroupName", + name="myMachineName", + install_patches_input={ + "maximumDuration": "PT4H", + "rebootSetting": "IfRequired", + "windowsParameters": { + "classificationsToInclude": ["Critical", "Security"], + "maxPatchPublishDate": "2021-08-19T02:36:43.0539904+00:00", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/machine/Machine_InstallPatches.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machines_delete.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machines_delete.py similarity index 91% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machines_delete.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machines_delete.py index 45849dd24257..7aec28e93b26 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machines_delete.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machines_delete.py @@ -29,13 +29,12 @@ def main(): subscription_id="{subscriptionId}", ) - response = client.machines.delete( + client.machines.delete( resource_group_name="myResourceGroup", machine_name="myMachine", ) - print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/Machines_Delete.json +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/machine/Machines_Delete.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machines_get.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machines_get.py similarity index 94% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machines_get.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machines_get.py index 1823a3c4d527..3e437a0334f7 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machines_get.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machines_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/Machines_Get.json +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/machine/Machines_Get.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machines_get_license_profile_instance_view.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machines_get_license_profile_instance_view.py new file mode 100644 index 000000000000..cef3c4d66e8e --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machines_get_license_profile_instance_view.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.hybridcompute import HybridComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridcompute +# USAGE + python machines_get_license_profile_instance_view.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 = HybridComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.machines.get( + resource_group_name="myResourceGroup", + machine_name="myMachine", + ) + print(response) + + +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/machine/Machines_Get_LicenseProfileInstanceView.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machines_list_by_resource_group.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machines_list_by_resource_group.py similarity index 93% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machines_list_by_resource_group.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machines_list_by_resource_group.py index 15bfc7fb6ab2..5db63e356caa 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machines_list_by_resource_group.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machines_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/Machines_ListByResourceGroup.json +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/machine/Machines_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machines_list_by_subscription.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machines_list_by_subscription.py similarity index 93% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machines_list_by_subscription.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machines_list_by_subscription.py index c63d3cf642d7..011b4eeeb59b 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machines_list_by_subscription.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machines_list_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/Machines_ListBySubscription.json +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/machine/Machines_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/network_profile_get.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/network_profile_get.py new file mode 100644 index 000000000000..bfb93bbe2697 --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/network_profile_get.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.hybridcompute import HybridComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridcompute +# USAGE + python network_profile_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 = HybridComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.network_profile.get( + resource_group_name="myResourceGroup", + machine_name="myMachine", + ) + print(response) + + +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/NetworkProfile_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/operations_list.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/operations_list.py index e6329473690d..ca07eb075b7f 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/operations_list.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/operations_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/Operations_List.json +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint_connection_delete.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint/private_endpoint_connection_delete.py similarity index 89% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint_connection_delete.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint/private_endpoint_connection_delete.py index 7bcd012c70fe..aa7b076a45e4 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint_connection_delete.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint/private_endpoint_connection_delete.py @@ -29,14 +29,13 @@ def main(): subscription_id="00000000-1111-2222-3333-444444444444", ) - response = client.private_endpoint_connections.begin_delete( + client.private_endpoint_connections.begin_delete( resource_group_name="myResourceGroup", scope_name="myPrivateLinkScope", private_endpoint_connection_name="private-endpoint-connection-name", ).result() - print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateEndpointConnectionDelete.json +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/privateEndpoint/PrivateEndpointConnection_Delete.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint_connection_get.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint/private_endpoint_connection_get.py similarity index 93% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint_connection_get.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint/private_endpoint_connection_get.py index be41316b1d8a..2def51534b83 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint_connection_get.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint/private_endpoint_connection_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateEndpointConnectionGet.json +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/privateEndpoint/PrivateEndpointConnection_Get.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint_connection_list.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint/private_endpoint_connection_list.py similarity index 93% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint_connection_list.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint/private_endpoint_connection_list.py index 468ae8970a10..5106e82a642b 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint_connection_list.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint/private_endpoint_connection_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateEndpointConnectionList.json +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/privateEndpoint/PrivateEndpointConnection_List.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint_connection_update.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint/private_endpoint_connection_update.py similarity index 94% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint_connection_update.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint/private_endpoint_connection_update.py index b3cf25f2dbae..45b1d270b62d 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint_connection_update.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint/private_endpoint_connection_update.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateEndpointConnectionUpdate.json +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/privateEndpoint/PrivateEndpointConnection_Update.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope_private_link_resource_get.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scope_private_link_resource_get.py similarity index 92% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope_private_link_resource_get.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scope_private_link_resource_get.py index 2260809654e9..2589788e4f99 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope_private_link_resource_get.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scope_private_link_resource_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopePrivateLinkResourceGet.json +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/privateLinkScope/PrivateLinkScopePrivateLinkResource_Get.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope_private_link_resource_list_get.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scope_private_link_resource_list_get.py similarity index 92% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope_private_link_resource_list_get.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scope_private_link_resource_list_get.py index f2ebf4d78f9a..d3e7261e0ede 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope_private_link_resource_list_get.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scope_private_link_resource_list_get.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopePrivateLinkResourceListGet.json +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/privateLinkScope/PrivateLinkScopePrivateLinkResource_ListGet.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_create.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_create.py similarity index 93% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_create.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_create.py index 884fbc9f0054..cee426c598f6 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_create.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_create.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopesCreate.json +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/privateLinkScope/PrivateLinkScopes_Create.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_delete.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_delete.py similarity index 90% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_delete.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_delete.py index 95f6bd430319..1e4d26ea61ea 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_delete.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_delete.py @@ -29,13 +29,12 @@ def main(): subscription_id="86dc51d3-92ed-4d7e-947a-775ea79b4919", ) - response = client.private_link_scopes.begin_delete( + client.private_link_scopes.begin_delete( resource_group_name="my-resource-group", scope_name="my-privatelinkscope", ).result() - print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopesDelete.json +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/privateLinkScope/PrivateLinkScopes_Delete.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_get.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_get.py similarity index 93% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_get.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_get.py index 2ea1de7c6a66..ff19934432b6 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_get.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopesGet.json +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/privateLinkScope/PrivateLinkScopes_Get.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_get_validation.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_get_validation.py similarity index 93% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_get_validation.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_get_validation.py index a5fa356f2030..1771d8b75f72 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_get_validation.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_get_validation.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopesGetValidation.json +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/privateLinkScope/PrivateLinkScopes_GetValidation.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_get_validation_for_machine.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_get_validation_for_machine.py similarity index 92% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_get_validation_for_machine.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_get_validation_for_machine.py index 73d51134638a..13f5f6293d19 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_get_validation_for_machine.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_get_validation_for_machine.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopesGetValidationForMachine.json +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/privateLinkScope/PrivateLinkScopes_GetValidationForMachine.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_list.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_list.py similarity index 93% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_list.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_list.py index a54f4093e333..dadf8f78aaeb 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_list.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopesList.json +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/privateLinkScope/PrivateLinkScopes_List.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_list_by_resource_group.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_list_by_resource_group.py similarity index 92% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_list_by_resource_group.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_list_by_resource_group.py index 716c781d68a3..6e8fbf7c6d12 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_list_by_resource_group.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopesListByResourceGroup.json +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/privateLinkScope/PrivateLinkScopes_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_update.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_update.py similarity index 93% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_update.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_update.py index 9bd9543f150e..23dfc9f60afb 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_update.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_update.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopesUpdate.json +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/privateLinkScope/PrivateLinkScopes_Update.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_update_tags_only.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_update_tags_only.py new file mode 100644 index 000000000000..2b9842004d9f --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_update_tags_only.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.hybridcompute import HybridComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridcompute +# USAGE + python private_link_scopes_update_tags_only.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 = HybridComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.private_link_scopes.update_tags( + resource_group_name="my-resource-group", + scope_name="my-privatelinkscope", + private_link_scope_tags={"tags": {"Tag1": "Value1", "Tag2": "Value2"}}, + ) + print(response) + + +# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/privateLinkScope/PrivateLinkScopes_UpdateTagsOnly.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/setup.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/setup.py index 2f8f064f0455..dad90396b88c 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/setup.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/setup.py @@ -1,10 +1,10 @@ #!/usr/bin/env python -#------------------------------------------------------------------------- +# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- import re import os.path @@ -16,64 +16,68 @@ PACKAGE_PPRINT_NAME = "Hybrid Compute Management" # a-b-c => a/b/c -package_folder_path = PACKAGE_NAME.replace('-', '/') +package_folder_path = PACKAGE_NAME.replace("-", "/") # a-b-c => a.b.c -namespace_name = PACKAGE_NAME.replace('-', '.') +namespace_name = PACKAGE_NAME.replace("-", ".") # Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, 'version.py') - if os.path.exists(os.path.join(package_folder_path, 'version.py')) - else os.path.join(package_folder_path, '_version.py'), 'r') as fd: - version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', - fd.read(), re.MULTILINE).group(1) +with open( + os.path.join(package_folder_path, "version.py") + if os.path.exists(os.path.join(package_folder_path, "version.py")) + else os.path.join(package_folder_path, "_version.py"), + "r", +) as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) if not version: - raise RuntimeError('Cannot find version information') + raise RuntimeError("Cannot find version information") -with open('README.md', encoding='utf-8') as f: +with open("README.md", encoding="utf-8") as f: readme = f.read() -with open('CHANGELOG.md', encoding='utf-8') as f: +with open("CHANGELOG.md", encoding="utf-8") as f: changelog = f.read() setup( name=PACKAGE_NAME, version=version, - description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), - long_description=readme + '\n\n' + changelog, - long_description_content_type='text/markdown', - license='MIT License', - author='Microsoft Corporation', - author_email='azpysdkhelp@microsoft.com', - url='https://github.com/Azure/azure-sdk-for-python', + description="Microsoft Azure {} Client Library for Python".format(PACKAGE_PPRINT_NAME), + long_description=readme + "\n\n" + changelog, + long_description_content_type="text/markdown", + license="MIT License", + author="Microsoft Corporation", + author_email="azpysdkhelp@microsoft.com", + url="https://github.com/Azure/azure-sdk-for-python", keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product classifiers=[ - 'Development Status :: 4 - Beta', - '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', - 'License :: OSI Approved :: MIT License', + "Development Status :: 4 - Beta", + "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", + "License :: OSI Approved :: MIT License", ], zip_safe=False, - packages=find_packages(exclude=[ - 'tests', - # Exclude packages that will be covered by PEP420 or nspkg - 'azure', - 'azure.mgmt', - ]), + packages=find_packages( + exclude=[ + "tests", + # Exclude packages that will be covered by PEP420 or nspkg + "azure", + "azure.mgmt", + ] + ), include_package_data=True, package_data={ - 'pytyped': ['py.typed'], + "pytyped": ["py.typed"], }, install_requires=[ - "msrest>=0.7.1", + "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'", ], - python_requires=">=3.7" + python_requires=">=3.7", ) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/tests/conftest.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/tests/conftest.py new file mode 100644 index 000000000000..587e126e50b0 --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/tests/conftest.py @@ -0,0 +1,50 @@ +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- +import os +import platform +import pytest +import sys + +from dotenv import load_dotenv + +from devtools_testutils import test_proxy, add_general_regex_sanitizer +from devtools_testutils import add_header_regex_sanitizer, add_body_key_sanitizer + +load_dotenv() + +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") + tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=subscription_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=client_secret, value="00000000-0000-0000-0000-000000000000") + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") \ No newline at end of file diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/tests/test_hybridcompute.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/tests/disable_test_hybridcompute.py similarity index 99% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/tests/test_hybridcompute.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/tests/disable_test_hybridcompute.py index 07688d3302a1..5fd6c818e902 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/tests/test_hybridcompute.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/tests/disable_test_hybridcompute.py @@ -48,4 +48,3 @@ def test_delete(self): ) with self.assertRaises(ErrorResponseException): self.client.machines.get(resource_group_name,machine_name) - diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/tests/test_mgmt_hybridcompute.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/tests/test_mgmt_hybridcompute.py new file mode 100644 index 000000000000..c25dc7fb4590 --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/tests/test_mgmt_hybridcompute.py @@ -0,0 +1,24 @@ +# 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. +#-------------------------------------------------------------------------- + +from azure.mgmt.hybridcompute import HybridComputeManagementClient +from devtools_testutils import AzureMgmtRecordedTestCase, ResourceGroupPreparer, recorded_by_proxy + +class TestMgmtHybridCompute(AzureMgmtRecordedTestCase): + + def setup_method(self, method): + self.client = self.create_mgmt_client(HybridComputeManagementClient) + + @ResourceGroupPreparer() + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + assert list(self.client.machines.list_by_resource_group(resource_group.name)) == [] + + @recorded_by_proxy + def test_list_operations(self): + assert list(self.client.operations.list()) \ No newline at end of file diff --git a/sdk/hybridcompute/ci.yml b/sdk/hybridcompute/ci.yml index c5698e8d2bec..aa5bf8fb4094 100644 --- a/sdk/hybridcompute/ci.yml +++ b/sdk/hybridcompute/ci.yml @@ -28,6 +28,7 @@ extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: ServiceDirectory: hybridcompute + TestProxy: true Artifacts: - name: azure-mgmt-hybridcompute safeName: azuremgmthybridcompute