Skip to content

Commit

Permalink
[AutoRelease] t2-hybridcompute-2023-11-07-31553(can only be merged by…
Browse files Browse the repository at this point in the history
… SDK owner) (#33007)

* code and test

* Update ci.yml

* Update CHANGELOG.md

* Update CHANGELOG.md

* fix-test-case

* Update dev_requirements.txt

---------

Co-authored-by: azure-sdk <PythonSdkPipelines>
Co-authored-by: ChenxiJiang333 <[email protected]>
Co-authored-by: Yuchao Yan <[email protected]>
Co-authored-by: ChenxiJiang333 <[email protected]>
  • Loading branch information
4 people authored Nov 21, 2023
1 parent 1e263eb commit 8568050
Show file tree
Hide file tree
Showing 96 changed files with 10,625 additions and 1,048 deletions.
71 changes: 71 additions & 0 deletions sdk/hybridcompute/azure-mgmt-hybridcompute/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
8 changes: 3 additions & 5 deletions sdk/hybridcompute/azure-mgmt-hybridcompute/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
10 changes: 5 additions & 5 deletions sdk/hybridcompute/azure-mgmt-hybridcompute/_meta.json
Original file line number Diff line number Diff line change
@@ -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"
}
6 changes: 6 additions & 0 deletions sdk/hybridcompute/azure-mgmt-hybridcompute/assets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "python",
"TagPrefix": "python/hybridcompute/azure-mgmt-hybridcompute",
"Tag": "python/hybridcompute/azure-mgmt-hybridcompute_9bab93f309"
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand All @@ -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.
Expand All @@ -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
)
Expand Down Expand Up @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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):
Expand All @@ -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)
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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


Expand All @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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."""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Loading

0 comments on commit 8568050

Please sign in to comment.