Skip to content

[AutoPR track2_azure-mgmt-hdinsight] hdinsight: documenting the cluster kind #5453

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions sdk/hdinsight/azure-mgmt-hdinsight/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"commit": "237afa17929313c909f72f2fea59f4437e305c99",
"commit": "20425c42c014920cd25672bbd1d3c5190ef106fc",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.2",
"autorest": "3.9.7",
"use": [
"@autorest/python@6.6.0",
"@autorest/modelerfour@4.24.3"
"@autorest/python@6.7.1",
"@autorest/modelerfour@4.26.2"
],
"autorest_command": "autorest specification/hdinsight/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.6.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
"autorest_command": "autorest specification/hdinsight/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False",
"readme": "specification/hdinsight/resource-manager/readme.md"
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ class HDInsightManagementClientConfiguration(Configuration): # pylint: disable=
:param subscription_id: The subscription credentials which uniquely identify Microsoft Azure
subscription. The subscription ID forms part of the URI for every service call. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2023-04-15-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2023-08-15-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(HDInsightManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2023-04-15-preview")
api_version: str = kwargs.pop("api_version", "2023-08-15-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 @@ -68,7 +68,7 @@ class HDInsightManagementClient: # pylint: disable=client-accepts-api-version-k
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: Api Version. Default value is "2023-04-15-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2023-08-15-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
Expand Down
Original file line number Diff line number Diff line change
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
14 changes: 0 additions & 14 deletions sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_vendor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import List, cast

from azure.core.pipeline.transport import HttpRequest


Expand All @@ -16,15 +14,3 @@ def _convert_request(request, files=None):
if files:
request.set_formdata_body(files)
return request


def _format_url_section(template, **kwargs):
components = template.split("/")
while components:
try:
return template.format(**kwargs)
except KeyError as key:
# 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)
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 = "9.0.0b2"
VERSION = "1.0.0b1"
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ class HDInsightManagementClientConfiguration(Configuration): # pylint: disable=
:param subscription_id: The subscription credentials which uniquely identify Microsoft Azure
subscription. The subscription ID forms part of the URI for every service call. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2023-04-15-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2023-08-15-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(HDInsightManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2023-04-15-preview")
api_version: str = kwargs.pop("api_version", "2023-08-15-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 @@ -69,7 +69,7 @@ class HDInsightManagementClient: # pylint: disable=client-accepts-api-version-k
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: Api Version. Default value is "2023-04-15-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2023-08-15-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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,15 @@
from ._models_py3 import VmSizeProperty

from ._hd_insight_management_client_enums import AsyncOperationState
from ._hd_insight_management_client_enums import ClusterKind
from ._hd_insight_management_client_enums import CreatedByType
from ._hd_insight_management_client_enums import DaysOfWeek
from ._hd_insight_management_client_enums import DirectoryType
from ._hd_insight_management_client_enums import FilterMode
from ._hd_insight_management_client_enums import HDInsightClusterProvisioningState
from ._hd_insight_management_client_enums import JsonWebKeyEncryptionAlgorithm
from ._hd_insight_management_client_enums import OSType
from ._hd_insight_management_client_enums import OutboundDependenciesManagedType
from ._hd_insight_management_client_enums import PrivateEndpointConnectionProvisioningState
from ._hd_insight_management_client_enums import PrivateIPAllocationMethod
from ._hd_insight_management_client_enums import PrivateLink
Expand Down Expand Up @@ -248,13 +250,15 @@
"VmSizeCompatibilityFilterV2",
"VmSizeProperty",
"AsyncOperationState",
"ClusterKind",
"CreatedByType",
"DaysOfWeek",
"DirectoryType",
"FilterMode",
"HDInsightClusterProvisioningState",
"JsonWebKeyEncryptionAlgorithm",
"OSType",
"OutboundDependenciesManagedType",
"PrivateEndpointConnectionProvisioningState",
"PrivateIPAllocationMethod",
"PrivateLink",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ class AsyncOperationState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
FAILED = "Failed"


class ClusterKind(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The type of cluster."""

HADOOP = "HADOOP"
HBASE = "HBASE"
KAFKA = "KAFKA"
INTERACTIVEHIVE = "INTERACTIVEHIVE"
SPARK = "SPARK"


class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The type of identity that created the resource."""

Expand Down Expand Up @@ -81,6 +91,16 @@ class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
LINUX = "Linux"


class OutboundDependenciesManagedType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""A value to describe how the outbound dependencies of a HDInsight cluster are managed. 'Managed'
means that the outbound dependencies are managed by the HDInsight service. 'External' means
that the outbound dependencies are managed by a customer specific solution.
"""

MANAGED = "Managed"
EXTERNAL = "External"


class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The provisioning state, which only appears in the response."""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1534,8 +1534,9 @@ class ClusterDefinition(_serialization.Model):

:ivar blueprint: The link to the blueprint.
:vartype blueprint: str
:ivar kind: The type of cluster.
:vartype kind: str
:ivar kind: The type of cluster. Known values are: "HADOOP", "HBASE", "KAFKA",
"INTERACTIVEHIVE", and "SPARK".
:vartype kind: str or ~azure.mgmt.hdinsight.models.ClusterKind
:ivar component_version: The versions of different services in the cluster.
:vartype component_version: dict[str, str]
:ivar configurations: The cluster configurations.
Expand All @@ -1553,16 +1554,17 @@ def __init__(
self,
*,
blueprint: Optional[str] = None,
kind: Optional[str] = None,
kind: Optional[Union[str, "_models.ClusterKind"]] = None,
component_version: Optional[Dict[str, str]] = None,
configurations: Optional[JSON] = None,
**kwargs: Any
) -> None:
"""
:keyword blueprint: The link to the blueprint.
:paramtype blueprint: str
:keyword kind: The type of cluster.
:paramtype kind: str
:keyword kind: The type of cluster. Known values are: "HADOOP", "HBASE", "KAFKA",
"INTERACTIVEHIVE", and "SPARK".
:paramtype kind: str or ~azure.mgmt.hdinsight.models.ClusterKind
:keyword component_version: The versions of different services in the cluster.
:paramtype component_version: dict[str, str]
:keyword configurations: The cluster configurations.
Expand Down Expand Up @@ -2975,6 +2977,12 @@ def __init__(self, *, name_available: Optional[bool] = None, **kwargs: Any) -> N
class NetworkProperties(_serialization.Model):
"""The network properties.

:ivar outbound_dependencies_managed_type: A value to describe how the outbound dependencies of
a HDInsight cluster are managed. 'Managed' means that the outbound dependencies are managed by
the HDInsight service. 'External' means that the outbound dependencies are managed by a
customer specific solution. Known values are: "Managed" and "External".
:vartype outbound_dependencies_managed_type: str or
~azure.mgmt.hdinsight.models.OutboundDependenciesManagedType
:ivar resource_provider_connection: The direction for the resource provider connection. Known
values are: "Inbound" and "Outbound".
:vartype resource_provider_connection: str or
Expand All @@ -2985,18 +2993,26 @@ class NetworkProperties(_serialization.Model):
"""

_attribute_map = {
"outbound_dependencies_managed_type": {"key": "outboundDependenciesManagedType", "type": "str"},
"resource_provider_connection": {"key": "resourceProviderConnection", "type": "str"},
"private_link": {"key": "privateLink", "type": "str"},
}

def __init__(
self,
*,
outbound_dependencies_managed_type: Optional[Union[str, "_models.OutboundDependenciesManagedType"]] = None,
resource_provider_connection: Optional[Union[str, "_models.ResourceProviderConnection"]] = None,
private_link: Optional[Union[str, "_models.PrivateLink"]] = None,
**kwargs: Any
) -> None:
"""
:keyword outbound_dependencies_managed_type: A value to describe how the outbound dependencies
of a HDInsight cluster are managed. 'Managed' means that the outbound dependencies are managed
by the HDInsight service. 'External' means that the outbound dependencies are managed by a
customer specific solution. Known values are: "Managed" and "External".
:paramtype outbound_dependencies_managed_type: str or
~azure.mgmt.hdinsight.models.OutboundDependenciesManagedType
:keyword resource_provider_connection: The direction for the resource provider connection.
Known values are: "Inbound" and "Outbound".
:paramtype resource_provider_connection: str or
Expand All @@ -3006,6 +3022,7 @@ def __init__(
:paramtype private_link: str or ~azure.mgmt.hdinsight.models.PrivateLink
"""
super().__init__(**kwargs)
self.outbound_dependencies_managed_type = outbound_dependencies_managed_type
self.resource_provider_connection = resource_provider_connection
self.private_link = private_link

Expand Down
Loading