зеркало из
1
0
Форкнуть 0

[AutoRelease] t2-hdinsightcontainers-2024-04-03-01484(can only be merged by SDK owner) (#35051)

* code and test

* Update CHANGELOG.md

---------

Co-authored-by: azure-sdk <PythonSdkPipelines>
Co-authored-by: ChenxiJiang333 <119990644+ChenxiJiang333@users.noreply.github.com>
This commit is contained in:
Azure SDK Bot 2024-04-06 20:08:45 -07:00 коммит произвёл GitHub
Родитель fd1712278e
Коммит 5ec2049804
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
66 изменённых файлов: 5247 добавлений и 1985 удалений

Просмотреть файл

@ -1,5 +1,96 @@
# Release History
## 1.0.0b2 (2024-04-07)
### Features Added
- Added operation ClusterPoolsOperations.begin_upgrade
- Added operation ClustersOperations.begin_upgrade
- Added operation group ClusterAvailableUpgradesOperations
- Added operation group ClusterPoolAvailableUpgradesOperations
- Model Cluster has a new parameter properties
- Model ClusterPatch has a new parameter properties
- Model ClusterPool has a new parameter properties
- Model ClusterPoolNetworkProfile has a new parameter api_server_authorized_ip_ranges
- Model ClusterPoolNetworkProfile has a new parameter enable_private_api_server
- Model ClusterPoolNetworkProfile has a new parameter outbound_type
- Model ClusterPoolResourcePropertiesNetworkProfile has a new parameter api_server_authorized_ip_ranges
- Model ClusterPoolResourcePropertiesNetworkProfile has a new parameter enable_private_api_server
- Model ClusterPoolResourcePropertiesNetworkProfile has a new parameter outbound_type
- Model ClusterPoolVersion has a new parameter properties
- Model ClusterProfile has a new parameter cluster_access_profile
- Model ClusterProfile has a new parameter ranger_plugin_profile
- Model ClusterProfile has a new parameter ranger_profile
- Model ClusterResizeData has a new parameter properties
- Model ClusterVersion has a new parameter properties
- Model ConnectivityProfileWeb has a new parameter private_fqdn
- Model FlinkHiveCatalogOption has a new parameter metastore_db_connection_authentication_mode
- Model FlinkJobProperties has a new parameter run_id
- Model FlinkProfile has a new parameter deployment_mode
- Model FlinkProfile has a new parameter job_spec
- Model HiveCatalogOption has a new parameter metastore_db_connection_authentication_mode
- Model ServiceConfigResult has a new parameter properties
- Model SparkMetastoreSpec has a new parameter db_connection_authentication_mode
- Model SshConnectivityEndpoint has a new parameter private_ssh_endpoint
- Model TrinoCoordinator has a new parameter debug
- Model TrinoWorker has a new parameter debug
- Model UpdatableClusterProfile has a new parameter ranger_plugin_profile
- Model UpdatableClusterProfile has a new parameter ranger_profile
- Model WebConnectivityEndpoint has a new parameter private_fqdn
- Operation ClusterJobsOperations.list has a new optional parameter filter
### Breaking Changes
- Model Cluster no longer has parameter cluster_profile
- Model Cluster no longer has parameter cluster_type
- Model Cluster no longer has parameter compute_profile
- Model Cluster no longer has parameter deployment_id
- Model Cluster no longer has parameter provisioning_state
- Model Cluster no longer has parameter status
- Model ClusterInstanceViewResult has a new required parameter properties
- Model ClusterInstanceViewResult no longer has parameter service_statuses
- Model ClusterInstanceViewResult no longer has parameter status
- Model ClusterPatch no longer has parameter cluster_profile
- Model ClusterPatch no longer has parameter id
- Model ClusterPatch no longer has parameter location
- Model ClusterPatch no longer has parameter name
- Model ClusterPatch no longer has parameter system_data
- Model ClusterPatch no longer has parameter type
- Model ClusterPool no longer has parameter aks_cluster_profile
- Model ClusterPool no longer has parameter aks_managed_resource_group_name
- Model ClusterPool no longer has parameter cluster_pool_profile
- Model ClusterPool no longer has parameter compute_profile
- Model ClusterPool no longer has parameter deployment_id
- Model ClusterPool no longer has parameter log_analytics_profile
- Model ClusterPool no longer has parameter managed_resource_group_name
- Model ClusterPool no longer has parameter network_profile
- Model ClusterPool no longer has parameter provisioning_state
- Model ClusterPool no longer has parameter status
- Model ClusterPoolVersion no longer has parameter aks_version
- Model ClusterPoolVersion no longer has parameter cluster_pool_version
- Model ClusterPoolVersion no longer has parameter is_preview
- Model ClusterResizeData no longer has parameter target_worker_node_count
- Model ClusterVersion no longer has parameter cluster_pool_version
- Model ClusterVersion no longer has parameter cluster_type
- Model ClusterVersion no longer has parameter cluster_version
- Model ClusterVersion no longer has parameter components
- Model ClusterVersion no longer has parameter is_preview
- Model ClusterVersion no longer has parameter oss_version
- Model ServiceConfigResult no longer has parameter component_name
- Model ServiceConfigResult no longer has parameter content
- Model ServiceConfigResult no longer has parameter custom_keys
- Model ServiceConfigResult no longer has parameter default_keys
- Model ServiceConfigResult no longer has parameter file_name
- Model ServiceConfigResult no longer has parameter path
- Model ServiceConfigResult no longer has parameter service_name
- Model ServiceConfigResult no longer has parameter type
- Model TrinoCoordinator no longer has parameter enable
- Model TrinoCoordinator no longer has parameter port
- Model TrinoCoordinator no longer has parameter suspend
- Model TrinoWorker no longer has parameter enable
- Model TrinoWorker no longer has parameter port
- Model TrinoWorker no longer has parameter suspend
## 1.0.0b1 (2023-08-18)
* Initial Release

Просмотреть файл

@ -1,7 +1,7 @@
# Microsoft Azure SDK for Python
This is the Microsoft Azure Hdinsightcontainers Management Client Library.
This package has been tested with Python 3.7+.
This package has been tested with Python 3.8+.
For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all).
## _Disclaimer_
@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For
### Prerequisites
- Python 3.7+ is required to use this package.
- Python 3.8+ is required to use this package.
- [Azure subscription](https://azure.microsoft.com/free/)
### Install the package
@ -59,6 +59,3 @@ Code samples for this package can be found at:
If you encounter any bugs or have suggestions, please file an issue in the
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
section of the project.
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-hdinsightcontainers%2FREADME.png)

Просмотреть файл

@ -1,11 +1,11 @@
{
"commit": "ec882de9043fe225777bbf5fd28ed5259b0949db",
"commit": "92de53a5f1e0e03c94b40475d2135d97148ed014",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.7",
"use": [
"@autorest/python@6.7.1",
"@autorest/modelerfour@4.26.2"
"@autorest/python@6.13.7",
"@autorest/modelerfour@4.27.0"
],
"autorest_command": "autorest specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False",
"autorest_command": "autorest specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --tag=package-preview-2023-11 --use=@autorest/python@6.13.7 --use=@autorest/modelerfour@4.27.0 --version=3.9.7 --version-tolerant=False",
"readme": "specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/readme.md"
}

Просмотреть файл

@ -8,7 +8,6 @@
from typing import Any, TYPE_CHECKING
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
@ -19,7 +18,7 @@ if TYPE_CHECKING:
from azure.core.credentials import TokenCredential
class HDInsightContainersMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
class HDInsightContainersMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for HDInsightContainersMgmtClient.
Note that all parameters used to create this instance are saved as instance
@ -29,14 +28,13 @@ class HDInsightContainersMgmtClientConfiguration(Configuration): # pylint: disa
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2023-06-01-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2023-11-01-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(HDInsightContainersMgmtClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2023-06-01-preview")
api_version: str = kwargs.pop("api_version", "2023-11-01-preview")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
@ -48,6 +46,7 @@ class HDInsightContainersMgmtClientConfiguration(Configuration): # pylint: disa
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-hdinsightcontainers/{}".format(VERSION))
self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@ -56,9 +55,9 @@ class HDInsightContainersMgmtClientConfiguration(Configuration): # pylint: disa
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = ARMChallengeAuthenticationPolicy(

Просмотреть файл

@ -9,8 +9,10 @@
from copy import deepcopy
from typing import Any, TYPE_CHECKING
from azure.core.pipeline import policies
from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
from . import models as _models
from ._configuration import HDInsightContainersMgmtClientConfiguration
@ -18,7 +20,9 @@ from ._serialization import Deserializer, Serializer
from .operations import (
AvailableClusterPoolVersionsOperations,
AvailableClusterVersionsOperations,
ClusterAvailableUpgradesOperations,
ClusterJobsOperations,
ClusterPoolAvailableUpgradesOperations,
ClusterPoolsOperations,
ClustersOperations,
LocationsOperations,
@ -31,12 +35,18 @@ if TYPE_CHECKING:
class HDInsightContainersMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
"""HDInsight On Aks Management Client.
"""HDInsight Containers Management Client.
:ivar cluster_pools: ClusterPoolsOperations operations
:vartype cluster_pools: azure.mgmt.hdinsightcontainers.operations.ClusterPoolsOperations
:ivar cluster_pool_available_upgrades: ClusterPoolAvailableUpgradesOperations operations
:vartype cluster_pool_available_upgrades:
azure.mgmt.hdinsightcontainers.operations.ClusterPoolAvailableUpgradesOperations
:ivar clusters: ClustersOperations operations
:vartype clusters: azure.mgmt.hdinsightcontainers.operations.ClustersOperations
:ivar cluster_available_upgrades: ClusterAvailableUpgradesOperations operations
:vartype cluster_available_upgrades:
azure.mgmt.hdinsightcontainers.operations.ClusterAvailableUpgradesOperations
:ivar cluster_jobs: ClusterJobsOperations operations
:vartype cluster_jobs: azure.mgmt.hdinsightcontainers.operations.ClusterJobsOperations
:ivar locations: LocationsOperations operations
@ -55,7 +65,7 @@ class HDInsightContainersMgmtClient: # pylint: disable=client-accepts-api-versi
: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-06-01-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2023-11-01-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
@ -72,14 +82,38 @@ class HDInsightContainersMgmtClient: # pylint: disable=client-accepts-api-versi
self._config = HDInsightContainersMgmtClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
_policies = kwargs.pop("policies", None)
if _policies is None:
_policies = [
policies.RequestIdPolicy(**kwargs),
self._config.headers_policy,
self._config.user_agent_policy,
self._config.proxy_policy,
policies.ContentDecodePolicy(**kwargs),
ARMAutoResourceProviderRegistrationPolicy(),
self._config.redirect_policy,
self._config.retry_policy,
self._config.authentication_policy,
self._config.custom_hook_policy,
self._config.logging_policy,
policies.DistributedTracingPolicy(**kwargs),
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
self._config.http_logging_policy,
]
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.cluster_pools = ClusterPoolsOperations(self._client, self._config, self._serialize, self._deserialize)
self.cluster_pool_available_upgrades = ClusterPoolAvailableUpgradesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.clusters = ClustersOperations(self._client, self._config, self._serialize, self._deserialize)
self.cluster_available_upgrades = ClusterAvailableUpgradesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.cluster_jobs = ClusterJobsOperations(self._client, self._config, self._serialize, self._deserialize)
self.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize)
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
@ -90,7 +124,7 @@ class HDInsightContainersMgmtClient: # pylint: disable=client-accepts-api-versi
self._client, self._config, self._serialize, self._deserialize
)
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
@ -110,7 +144,7 @@ class HDInsightContainersMgmtClient: # pylint: disable=client-accepts-api-versi
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
return self._client.send_request(request_copy, **kwargs)
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
def close(self) -> None:
self._client.close()

Просмотреть файл

@ -63,8 +63,8 @@ import xml.etree.ElementTree as ET
import isodate # type: ignore
from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback
from azure.core.serialization import NULL as AzureCoreNull
from azure.core.exceptions import DeserializationError, SerializationError
from azure.core.serialization import NULL as CoreNull
_BOM = codecs.BOM_UTF8.decode(encoding="utf-8")
@ -124,7 +124,7 @@ class RawDeserializer:
pass
return ET.fromstring(data_as_str) # nosec
except ET.ParseError:
except ET.ParseError as err:
# It might be because the server has an issue, and returned JSON with
# content-type XML....
# So let's try a JSON load, and if it's still broken
@ -143,7 +143,7 @@ class RawDeserializer:
# The function hack is because Py2.7 messes up with exception
# context otherwise.
_LOGGER.critical("Wasn't XML not JSON, failing")
raise_with_traceback(DeserializationError, "XML is invalid")
raise DeserializationError("XML is invalid") from err
raise DeserializationError("Cannot deserialize content-type: {}".format(content_type))
@classmethod
@ -170,13 +170,6 @@ class RawDeserializer:
return None
try:
basestring # type: ignore
unicode_str = unicode # type: ignore
except NameError:
basestring = str
unicode_str = str
_LOGGER = logging.getLogger(__name__)
try:
@ -295,7 +288,7 @@ class Model(object):
_validation: Dict[str, Dict[str, Any]] = {}
def __init__(self, **kwargs: Any) -> None:
self.additional_properties: Dict[str, Any] = {}
self.additional_properties: Optional[Dict[str, Any]] = {}
for k in kwargs:
if k not in self._attribute_map:
_LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__)
@ -340,7 +333,7 @@ class Model(object):
return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None))
def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON:
"""Return the JSON that would be sent to azure from this model.
"""Return the JSON that would be sent to server from this model.
This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`.
@ -351,7 +344,7 @@ class Model(object):
:rtype: dict
"""
serializer = Serializer(self._infer_class_models())
return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs)
return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore
def as_dict(
self,
@ -390,7 +383,7 @@ class Model(object):
:rtype: dict
"""
serializer = Serializer(self._infer_class_models())
return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs)
return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore
@classmethod
def _infer_class_models(cls):
@ -415,7 +408,7 @@ class Model(object):
:raises: DeserializationError if something went wrong
"""
deserializer = Deserializer(cls._infer_class_models())
return deserializer(cls.__name__, data, content_type=content_type)
return deserializer(cls.__name__, data, content_type=content_type) # type: ignore
@classmethod
def from_dict(
@ -445,7 +438,7 @@ class Model(object):
if key_extractors is None
else key_extractors
)
return deserializer(cls.__name__, data, content_type=content_type)
return deserializer(cls.__name__, data, content_type=content_type) # type: ignore
@classmethod
def _flatten_subtype(cls, key, objects):
@ -545,7 +538,7 @@ class Serializer(object):
"multiple": lambda x, y: x % y != 0,
}
def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None):
def __init__(self, classes: Optional[Mapping[str, type]] = None):
self.serialize_type = {
"iso-8601": Serializer.serialize_iso,
"rfc-1123": Serializer.serialize_rfc,
@ -561,7 +554,7 @@ class Serializer(object):
"[]": self.serialize_iter,
"{}": self.serialize_dict,
}
self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {}
self.dependencies: Dict[str, type] = dict(classes) if classes else {}
self.key_transformer = full_restapi_key_transformer
self.client_side_validation = True
@ -649,7 +642,7 @@ class Serializer(object):
else: # That's a basic type
# Integrate namespace if necessary
local_node = _create_xml_node(xml_name, xml_prefix, xml_ns)
local_node.text = unicode_str(new_attr)
local_node.text = str(new_attr)
serialized.append(local_node) # type: ignore
else: # JSON
for k in reversed(keys): # type: ignore
@ -668,7 +661,7 @@ class Serializer(object):
except (AttributeError, KeyError, TypeError) as err:
msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj))
raise_with_traceback(SerializationError, msg, err)
raise SerializationError(msg) from err
else:
return serialized
@ -710,7 +703,7 @@ class Serializer(object):
]
data = deserializer._deserialize(data_type, data)
except DeserializationError as err:
raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err)
raise SerializationError("Unable to build a model: " + str(err)) from err
return self._serialize(data, data_type, **kwargs)
@ -730,6 +723,7 @@ class Serializer(object):
if kwargs.get("skip_quote") is True:
output = str(output)
output = output.replace("{", quote("{")).replace("}", quote("}"))
else:
output = quote(str(output), safe="")
except SerializationError:
@ -744,7 +738,7 @@ class Serializer(object):
:param str data_type: The type to be serialized from.
:keyword bool skip_quote: Whether to skip quote the serialized result.
Defaults to False.
:rtype: str
:rtype: str, list
:raises: TypeError if serialization fails.
:raises: ValueError if data is None
"""
@ -753,7 +747,7 @@ class Serializer(object):
if data_type.startswith("["):
internal_data_type = data_type[1:-1]
do_quote = not kwargs.get("skip_quote", False)
return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs))
return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)
# Not a list, regular serialization
output = self.serialize_data(data, data_type, **kwargs)
@ -804,7 +798,7 @@ class Serializer(object):
raise ValueError("No value for given attribute")
try:
if data is AzureCoreNull:
if data is CoreNull:
return None
if data_type in self.basic_types.values():
return self.serialize_basic(data, data_type, **kwargs)
@ -824,7 +818,7 @@ class Serializer(object):
except (ValueError, TypeError) as err:
msg = "Unable to serialize value: {!r} as type: {!r}."
raise_with_traceback(SerializationError, msg.format(data, data_type), err)
raise SerializationError(msg.format(data, data_type)) from err
else:
return self._serialize(data, **kwargs)
@ -993,7 +987,7 @@ class Serializer(object):
return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs)
if obj_type is _long_type:
return self.serialize_long(attr)
if obj_type is unicode_str:
if obj_type is str:
return self.serialize_unicode(attr)
if obj_type is datetime.datetime:
return self.serialize_iso(attr)
@ -1170,10 +1164,10 @@ class Serializer(object):
return date + microseconds + "Z"
except (ValueError, OverflowError) as err:
msg = "Unable to serialize datetime object."
raise_with_traceback(SerializationError, msg, err)
raise SerializationError(msg) from err
except AttributeError as err:
msg = "ISO-8601 object must be valid Datetime object."
raise_with_traceback(TypeError, msg, err)
raise TypeError(msg) from err
@staticmethod
def serialize_unix(attr, **kwargs):
@ -1209,7 +1203,6 @@ def rest_key_extractor(attr, attr_desc, data):
if working_data is None:
# If at any point while following flatten JSON path see None, it means
# that all properties under are None as well
# https://github.com/Azure/msrest-for-python/issues/197
return None
key = ".".join(dict_keys[1:])
@ -1230,7 +1223,6 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data):
if working_data is None:
# If at any point while following flatten JSON path see None, it means
# that all properties under are None as well
# https://github.com/Azure/msrest-for-python/issues/197
return None
key = ".".join(dict_keys[1:])
@ -1371,7 +1363,7 @@ class Deserializer(object):
valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?")
def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None):
def __init__(self, classes: Optional[Mapping[str, type]] = None):
self.deserialize_type = {
"iso-8601": Deserializer.deserialize_iso,
"rfc-1123": Deserializer.deserialize_rfc,
@ -1391,7 +1383,7 @@ class Deserializer(object):
"duration": (isodate.Duration, datetime.timedelta),
"iso-8601": (datetime.datetime),
}
self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {}
self.dependencies: Dict[str, type] = dict(classes) if classes else {}
self.key_extractors = [rest_key_extractor, xml_key_extractor]
# Additional properties only works if the "rest_key_extractor" is used to
# extract the keys. Making it to work whatever the key extractor is too much
@ -1444,7 +1436,7 @@ class Deserializer(object):
response, class_name = self._classify_target(target_obj, data)
if isinstance(response, basestring):
if isinstance(response, str):
return self.deserialize_data(data, response)
elif isinstance(response, type) and issubclass(response, Enum):
return self.deserialize_enum(data, response)
@ -1481,7 +1473,7 @@ class Deserializer(object):
d_attrs[attr] = value
except (AttributeError, TypeError, KeyError) as err:
msg = "Unable to deserialize to object: " + class_name # type: ignore
raise_with_traceback(DeserializationError, msg, err)
raise DeserializationError(msg) from err
else:
additional_properties = self._build_additional_properties(attributes, data)
return self._instantiate_model(response, d_attrs, additional_properties)
@ -1515,14 +1507,14 @@ class Deserializer(object):
if target is None:
return None, None
if isinstance(target, basestring):
if isinstance(target, str):
try:
target = self.dependencies[target]
except KeyError:
return target, target
try:
target = target._classify(data, self.dependencies)
target = target._classify(data, self.dependencies) # type: ignore
except AttributeError:
pass # Target is not a Model, no classify
return target, target.__class__.__name__ # type: ignore
@ -1578,7 +1570,7 @@ class Deserializer(object):
if hasattr(raw_data, "_content_consumed"):
return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers)
if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"):
if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"):
return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore
return raw_data
@ -1652,7 +1644,7 @@ class Deserializer(object):
except (ValueError, TypeError, AttributeError) as err:
msg = "Unable to deserialize response data."
msg += " Data: {}, {}".format(data, data_type)
raise_with_traceback(DeserializationError, msg, err)
raise DeserializationError(msg) from err
else:
return self._deserialize(obj_type, data)
@ -1700,7 +1692,7 @@ class Deserializer(object):
if isinstance(attr, ET.Element):
# Do no recurse on XML, just return the tree as-is
return attr
if isinstance(attr, basestring):
if isinstance(attr, str):
return self.deserialize_basic(attr, "str")
obj_type = type(attr)
if obj_type in self.basic_types:
@ -1757,7 +1749,7 @@ class Deserializer(object):
if data_type == "bool":
if attr in [True, False, 1, 0]:
return bool(attr)
elif isinstance(attr, basestring):
elif isinstance(attr, str):
if attr.lower() in ["true", "1"]:
return True
elif attr.lower() in ["false", "0"]:
@ -1808,7 +1800,6 @@ class Deserializer(object):
data = data.value
if isinstance(data, int):
# Workaround. We might consider remove it in the future.
# https://github.com/Azure/azure-rest-api-specs/issues/141
try:
return list(enum_obj.__members__.values())[data]
except IndexError:
@ -1862,10 +1853,10 @@ class Deserializer(object):
if isinstance(attr, ET.Element):
attr = attr.text
try:
return decimal.Decimal(attr) # type: ignore
return decimal.Decimal(str(attr)) # type: ignore
except decimal.DecimalException as err:
msg = "Invalid decimal {}".format(attr)
raise_with_traceback(DeserializationError, msg, err)
raise DeserializationError(msg) from err
@staticmethod
def deserialize_long(attr):
@ -1893,7 +1884,7 @@ class Deserializer(object):
duration = isodate.parse_duration(attr)
except (ValueError, OverflowError, AttributeError) as err:
msg = "Cannot deserialize duration object."
raise_with_traceback(DeserializationError, msg, err)
raise DeserializationError(msg) from err
else:
return duration
@ -1910,7 +1901,7 @@ class Deserializer(object):
if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore
raise DeserializationError("Date must have only digits and -. Received: %s" % attr)
# This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception.
return isodate.parse_date(attr, defaultmonth=None, defaultday=None)
return isodate.parse_date(attr, defaultmonth=0, defaultday=0)
@staticmethod
def deserialize_time(attr):
@ -1945,7 +1936,7 @@ class Deserializer(object):
date_obj = date_obj.astimezone(tz=TZ_UTC)
except ValueError as err:
msg = "Cannot deserialize to rfc datetime object."
raise_with_traceback(DeserializationError, msg, err)
raise DeserializationError(msg) from err
else:
return date_obj
@ -1982,7 +1973,7 @@ class Deserializer(object):
raise OverflowError("Hit max or min date")
except (ValueError, OverflowError, AttributeError) as err:
msg = "Cannot deserialize datetime object."
raise_with_traceback(DeserializationError, msg, err)
raise DeserializationError(msg) from err
else:
return date_obj
@ -1998,9 +1989,10 @@ class Deserializer(object):
if isinstance(attr, ET.Element):
attr = int(attr.text) # type: ignore
try:
attr = int(attr)
date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC)
except ValueError as err:
msg = "Cannot deserialize to unix datetime object."
raise_with_traceback(DeserializationError, msg, err)
raise DeserializationError(msg) from err
else:
return date_obj

Просмотреть файл

@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
VERSION = "1.0.0b1"
VERSION = "1.0.0b2"

Просмотреть файл

@ -8,7 +8,6 @@
from typing import Any, TYPE_CHECKING
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy
@ -19,7 +18,7 @@ if TYPE_CHECKING:
from azure.core.credentials_async import AsyncTokenCredential
class HDInsightContainersMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
class HDInsightContainersMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for HDInsightContainersMgmtClient.
Note that all parameters used to create this instance are saved as instance
@ -29,14 +28,13 @@ class HDInsightContainersMgmtClientConfiguration(Configuration): # pylint: disa
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2023-06-01-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2023-11-01-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(HDInsightContainersMgmtClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2023-06-01-preview")
api_version: str = kwargs.pop("api_version", "2023-11-01-preview")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
@ -48,6 +46,7 @@ class HDInsightContainersMgmtClientConfiguration(Configuration): # pylint: disa
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-hdinsightcontainers/{}".format(VERSION))
self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@ -56,9 +55,9 @@ class HDInsightContainersMgmtClientConfiguration(Configuration): # pylint: disa
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs)
self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(

Просмотреть файл

@ -9,8 +9,10 @@
from copy import deepcopy
from typing import Any, Awaitable, TYPE_CHECKING
from azure.core.pipeline import policies
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.mgmt.core import AsyncARMPipelineClient
from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy
from .. import models as _models
from .._serialization import Deserializer, Serializer
@ -18,7 +20,9 @@ from ._configuration import HDInsightContainersMgmtClientConfiguration
from .operations import (
AvailableClusterPoolVersionsOperations,
AvailableClusterVersionsOperations,
ClusterAvailableUpgradesOperations,
ClusterJobsOperations,
ClusterPoolAvailableUpgradesOperations,
ClusterPoolsOperations,
ClustersOperations,
LocationsOperations,
@ -31,12 +35,18 @@ if TYPE_CHECKING:
class HDInsightContainersMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
"""HDInsight On Aks Management Client.
"""HDInsight Containers Management Client.
:ivar cluster_pools: ClusterPoolsOperations operations
:vartype cluster_pools: azure.mgmt.hdinsightcontainers.aio.operations.ClusterPoolsOperations
:ivar cluster_pool_available_upgrades: ClusterPoolAvailableUpgradesOperations operations
:vartype cluster_pool_available_upgrades:
azure.mgmt.hdinsightcontainers.aio.operations.ClusterPoolAvailableUpgradesOperations
:ivar clusters: ClustersOperations operations
:vartype clusters: azure.mgmt.hdinsightcontainers.aio.operations.ClustersOperations
:ivar cluster_available_upgrades: ClusterAvailableUpgradesOperations operations
:vartype cluster_available_upgrades:
azure.mgmt.hdinsightcontainers.aio.operations.ClusterAvailableUpgradesOperations
:ivar cluster_jobs: ClusterJobsOperations operations
:vartype cluster_jobs: azure.mgmt.hdinsightcontainers.aio.operations.ClusterJobsOperations
:ivar locations: LocationsOperations operations
@ -55,7 +65,7 @@ class HDInsightContainersMgmtClient: # pylint: disable=client-accepts-api-versi
: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-06-01-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2023-11-01-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
@ -72,14 +82,38 @@ class HDInsightContainersMgmtClient: # pylint: disable=client-accepts-api-versi
self._config = HDInsightContainersMgmtClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
_policies = kwargs.pop("policies", None)
if _policies is None:
_policies = [
policies.RequestIdPolicy(**kwargs),
self._config.headers_policy,
self._config.user_agent_policy,
self._config.proxy_policy,
policies.ContentDecodePolicy(**kwargs),
AsyncARMAutoResourceProviderRegistrationPolicy(),
self._config.redirect_policy,
self._config.retry_policy,
self._config.authentication_policy,
self._config.custom_hook_policy,
self._config.logging_policy,
policies.DistributedTracingPolicy(**kwargs),
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
self._config.http_logging_policy,
]
self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.cluster_pools = ClusterPoolsOperations(self._client, self._config, self._serialize, self._deserialize)
self.cluster_pool_available_upgrades = ClusterPoolAvailableUpgradesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.clusters = ClustersOperations(self._client, self._config, self._serialize, self._deserialize)
self.cluster_available_upgrades = ClusterAvailableUpgradesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.cluster_jobs = ClusterJobsOperations(self._client, self._config, self._serialize, self._deserialize)
self.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize)
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
@ -90,7 +124,9 @@ class HDInsightContainersMgmtClient: # pylint: disable=client-accepts-api-versi
self._client, self._config, self._serialize, self._deserialize
)
def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
def _send_request(
self, request: HttpRequest, *, stream: bool = False, **kwargs: Any
) -> Awaitable[AsyncHttpResponse]:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
@ -110,7 +146,7 @@ class HDInsightContainersMgmtClient: # pylint: disable=client-accepts-api-versi
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
return self._client.send_request(request_copy, **kwargs)
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
async def close(self) -> None:
await self._client.close()

Просмотреть файл

@ -7,7 +7,9 @@
# --------------------------------------------------------------------------
from ._cluster_pools_operations import ClusterPoolsOperations
from ._cluster_pool_available_upgrades_operations import ClusterPoolAvailableUpgradesOperations
from ._clusters_operations import ClustersOperations
from ._cluster_available_upgrades_operations import ClusterAvailableUpgradesOperations
from ._cluster_jobs_operations import ClusterJobsOperations
from ._locations_operations import LocationsOperations
from ._operations import Operations
@ -20,7 +22,9 @@ from ._patch import patch_sdk as _patch_sdk
__all__ = [
"ClusterPoolsOperations",
"ClusterPoolAvailableUpgradesOperations",
"ClustersOperations",
"ClusterAvailableUpgradesOperations",
"ClusterJobsOperations",
"LocationsOperations",
"Operations",

Просмотреть файл

@ -1,4 +1,4 @@
# pylint: disable=too-many-lines
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@ -58,7 +58,6 @@ class AvailableClusterPoolVersionsOperations:
:param location: The name of the Azure region. Required.
:type location: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ClusterPoolVersion or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hdinsightcontainers.models.ClusterPoolVersion]
@ -81,16 +80,15 @@ class AvailableClusterPoolVersionsOperations:
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_location_request(
_request = build_list_by_location_request(
location=location,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_by_location.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@ -102,13 +100,13 @@ class AvailableClusterPoolVersionsOperations:
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ClusterPoolVersionsListResult", pipeline_response)
@ -118,11 +116,11 @@ class AvailableClusterPoolVersionsOperations:
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -134,7 +132,3 @@ class AvailableClusterPoolVersionsOperations:
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list_by_location.metadata = {
"url": "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/availableClusterPoolVersions"
}

Просмотреть файл

@ -1,4 +1,4 @@
# pylint: disable=too-many-lines
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@ -58,7 +58,6 @@ class AvailableClusterVersionsOperations:
:param location: The name of the Azure region. Required.
:type location: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ClusterVersion or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hdinsightcontainers.models.ClusterVersion]
@ -81,16 +80,15 @@ class AvailableClusterVersionsOperations:
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_location_request(
_request = build_list_by_location_request(
location=location,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_by_location.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@ -102,13 +100,13 @@ class AvailableClusterVersionsOperations:
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ClusterVersionsListResult", pipeline_response)
@ -118,11 +116,11 @@ class AvailableClusterVersionsOperations:
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -134,7 +132,3 @@ class AvailableClusterVersionsOperations:
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list_by_location.metadata = {
"url": "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/availableClusterVersions"
}

Просмотреть файл

@ -0,0 +1,144 @@
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from 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.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._cluster_available_upgrades_operations import build_list_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class ClusterAvailableUpgradesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.hdinsightcontainers.aio.HDInsightContainersMgmtClient`'s
:attr:`cluster_available_upgrades` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, cluster_pool_name: str, cluster_name: str, **kwargs: Any
) -> AsyncIterable["_models.ClusterAvailableUpgrade"]:
"""List a cluster available upgrade.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_pool_name: The name of the cluster pool. Required.
:type cluster_pool_name: str
:param cluster_name: The name of the HDInsight cluster. Required.
:type cluster_name: str
:return: An iterator like instance of either ClusterAvailableUpgrade or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hdinsightcontainers.models.ClusterAvailableUpgrade]
: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.ClusterAvailableUpgradeList] = 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,
cluster_pool_name=cluster_pool_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ClusterAvailableUpgradeList", 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)

Просмотреть файл

@ -1,4 +1,4 @@
# pylint: disable=too-many-lines
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@ -61,7 +61,7 @@ class ClusterJobsOperations:
resource_group_name: str,
cluster_pool_name: str,
cluster_name: str,
cluster_job: Union[_models.ClusterJob, IO],
cluster_job: Union[_models.ClusterJob, IO[bytes]],
**kwargs: Any
) -> Optional[_models.ClusterJob]:
error_map = {
@ -87,7 +87,7 @@ class ClusterJobsOperations:
else:
_json = self._serialize.body(cluster_job, "ClusterJob")
request = build_run_job_request(
_request = build_run_job_request(
resource_group_name=resource_group_name,
cluster_pool_name=cluster_pool_name,
cluster_name=cluster_name,
@ -96,16 +96,15 @@ class ClusterJobsOperations:
content_type=content_type,
json=_json,
content=_content,
template_url=self._run_job_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -124,13 +123,9 @@ class ClusterJobsOperations:
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
if cls:
return cls(pipeline_response, deserialized, response_headers)
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
_run_job_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/clusters/{clusterName}/runJob"
}
return deserialized # type: ignore
@overload
async def begin_run_job(
@ -157,14 +152,6 @@ class ClusterJobsOperations:
: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 ClusterJob or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hdinsightcontainers.models.ClusterJob]
@ -177,7 +164,7 @@ class ClusterJobsOperations:
resource_group_name: str,
cluster_pool_name: str,
cluster_name: str,
cluster_job: IO,
cluster_job: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@ -192,18 +179,10 @@ class ClusterJobsOperations:
:param cluster_name: The name of the HDInsight cluster. Required.
:type cluster_name: str
:param cluster_job: The Cluster job. Required.
:type cluster_job: IO
:type cluster_job: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either ClusterJob or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hdinsightcontainers.models.ClusterJob]
@ -216,7 +195,7 @@ class ClusterJobsOperations:
resource_group_name: str,
cluster_pool_name: str,
cluster_name: str,
cluster_job: Union[_models.ClusterJob, IO],
cluster_job: Union[_models.ClusterJob, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.ClusterJob]:
"""Operations on jobs of HDInsight on AKS cluster.
@ -228,19 +207,8 @@ class ClusterJobsOperations:
:type cluster_pool_name: str
:param cluster_name: The name of the HDInsight cluster. Required.
:type cluster_name: str
:param cluster_job: The Cluster job. Is either a ClusterJob type or a IO type. Required.
:type cluster_job: ~azure.mgmt.hdinsightcontainers.models.ClusterJob or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:param cluster_job: The Cluster job. Is either a ClusterJob type or a IO[bytes] type. Required.
:type cluster_job: ~azure.mgmt.hdinsightcontainers.models.ClusterJob or IO[bytes]
:return: An instance of AsyncLROPoller that returns either ClusterJob or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hdinsightcontainers.models.ClusterJob]
@ -273,7 +241,7 @@ class ClusterJobsOperations:
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ClusterJob", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@ -285,21 +253,24 @@ class ClusterJobsOperations:
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
return AsyncLROPoller[_models.ClusterJob].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_run_job.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/clusters/{clusterName}/runJob"
}
return AsyncLROPoller[_models.ClusterJob](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
@distributed_trace
def list(
self, resource_group_name: str, cluster_pool_name: str, cluster_name: str, **kwargs: Any
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_name: str,
filter: Optional[str] = None,
**kwargs: Any
) -> AsyncIterable["_models.ClusterJob"]:
"""Get jobs of HDInsight on AKS cluster.
@ -310,7 +281,9 @@ class ClusterJobsOperations:
:type cluster_pool_name: str
:param cluster_name: The name of the HDInsight cluster. Required.
:type cluster_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:param filter: The system query option to filter job returned in the response. Allowed value is
'jobName eq {jobName}' or 'jarName eq {jarName}'. Default value is None.
:type filter: str
:return: An iterator like instance of either ClusterJob or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hdinsightcontainers.models.ClusterJob]
@ -333,18 +306,18 @@ class ClusterJobsOperations:
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
_request = build_list_request(
resource_group_name=resource_group_name,
cluster_pool_name=cluster_pool_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
filter=filter,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@ -356,13 +329,13 @@ class ClusterJobsOperations:
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ClusterJobList", pipeline_response)
@ -372,11 +345,11 @@ class ClusterJobsOperations:
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -388,7 +361,3 @@ class ClusterJobsOperations:
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/clusters/{clusterName}/jobs"
}

Просмотреть файл

@ -0,0 +1,141 @@
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from 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.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._cluster_pool_available_upgrades_operations import build_list_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class ClusterPoolAvailableUpgradesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.hdinsightcontainers.aio.HDInsightContainersMgmtClient`'s
:attr:`cluster_pool_available_upgrades` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, cluster_pool_name: str, **kwargs: Any
) -> AsyncIterable["_models.ClusterPoolAvailableUpgrade"]:
"""List a cluster pool available upgrade.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_pool_name: The name of the cluster pool. Required.
:type cluster_pool_name: str
:return: An iterator like instance of either ClusterPoolAvailableUpgrade or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hdinsightcontainers.models.ClusterPoolAvailableUpgrade]
: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.ClusterPoolAvailableUpgradeList] = 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,
cluster_pool_name=cluster_pool_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ClusterPoolAvailableUpgradeList", 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)

Просмотреть файл

@ -1,4 +1,4 @@
# pylint: disable=too-many-lines
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@ -38,6 +38,7 @@ from ...operations._cluster_pools_operations import (
build_list_by_resource_group_request,
build_list_by_subscription_request,
build_update_tags_request,
build_upgrade_request,
)
T = TypeVar("T")
@ -72,7 +73,6 @@ class ClusterPoolsOperations:
:type resource_group_name: str
:param cluster_pool_name: The name of the cluster pool. Required.
:type cluster_pool_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ClusterPool or the result of cls(response)
:rtype: ~azure.mgmt.hdinsightcontainers.models.ClusterPool
:raises ~azure.core.exceptions.HttpResponseError:
@ -91,21 +91,20 @@ class ClusterPoolsOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ClusterPool] = kwargs.pop("cls", None)
request = build_get_request(
_request = build_get_request(
resource_group_name=resource_group_name,
cluster_pool_name=cluster_pool_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -118,19 +117,15 @@ class ClusterPoolsOperations:
deserialized = self._deserialize("ClusterPool", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}"
}
return deserialized # type: ignore
async def _create_or_update_initial(
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_pool: Union[_models.ClusterPool, IO],
cluster_pool: Union[_models.ClusterPool, IO[bytes]],
**kwargs: Any
) -> _models.ClusterPool:
error_map = {
@ -156,7 +151,7 @@ class ClusterPoolsOperations:
else:
_json = self._serialize.body(cluster_pool, "ClusterPool")
request = build_create_or_update_request(
_request = build_create_or_update_request(
resource_group_name=resource_group_name,
cluster_pool_name=cluster_pool_name,
subscription_id=self._config.subscription_id,
@ -164,16 +159,15 @@ class ClusterPoolsOperations:
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -194,10 +188,6 @@ class ClusterPoolsOperations:
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}"
}
@overload
async def begin_create_or_update(
self,
@ -220,14 +210,6 @@ class ClusterPoolsOperations:
: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 ClusterPool or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hdinsightcontainers.models.ClusterPool]
@ -239,7 +221,7 @@ class ClusterPoolsOperations:
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_pool: IO,
cluster_pool: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@ -252,18 +234,10 @@ class ClusterPoolsOperations:
:param cluster_pool_name: The name of the cluster pool. Required.
:type cluster_pool_name: str
:param cluster_pool: The Cluster Pool to create. Required.
:type cluster_pool: IO
:type cluster_pool: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either ClusterPool or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hdinsightcontainers.models.ClusterPool]
@ -275,7 +249,7 @@ class ClusterPoolsOperations:
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_pool: Union[_models.ClusterPool, IO],
cluster_pool: Union[_models.ClusterPool, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.ClusterPool]:
"""Creates or updates a cluster pool.
@ -285,20 +259,9 @@ class ClusterPoolsOperations:
:type resource_group_name: str
:param cluster_pool_name: The name of the cluster pool. Required.
:type cluster_pool_name: str
:param cluster_pool: The Cluster Pool to create. Is either a ClusterPool type or a IO type.
Required.
:type cluster_pool: ~azure.mgmt.hdinsightcontainers.models.ClusterPool or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:param cluster_pool: The Cluster Pool to create. Is either a ClusterPool type or a IO[bytes]
type. Required.
:type cluster_pool: ~azure.mgmt.hdinsightcontainers.models.ClusterPool or IO[bytes]
:return: An instance of AsyncLROPoller that returns either ClusterPool or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hdinsightcontainers.models.ClusterPool]
@ -330,7 +293,7 @@ class ClusterPoolsOperations:
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ClusterPool", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@ -343,23 +306,21 @@ class ClusterPoolsOperations:
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
return AsyncLROPoller[_models.ClusterPool].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.HDInsight/clusterpools/{clusterPoolName}"
}
return AsyncLROPoller[_models.ClusterPool](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
async def _update_tags_initial(
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_pool_tags: Union[_models.TagsObject, IO],
cluster_pool_tags: Union[_models.TagsObject, IO[bytes]],
**kwargs: Any
) -> _models.ClusterPool:
error_map = {
@ -385,7 +346,7 @@ class ClusterPoolsOperations:
else:
_json = self._serialize.body(cluster_pool_tags, "TagsObject")
request = build_update_tags_request(
_request = build_update_tags_request(
resource_group_name=resource_group_name,
cluster_pool_name=cluster_pool_name,
subscription_id=self._config.subscription_id,
@ -393,16 +354,15 @@ class ClusterPoolsOperations:
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_tags_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -426,10 +386,6 @@ class ClusterPoolsOperations:
return deserialized # type: ignore
_update_tags_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}"
}
@overload
async def begin_update_tags(
self,
@ -452,14 +408,6 @@ class ClusterPoolsOperations:
: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 ClusterPool or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hdinsightcontainers.models.ClusterPool]
@ -471,7 +419,7 @@ class ClusterPoolsOperations:
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_pool_tags: IO,
cluster_pool_tags: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@ -484,18 +432,10 @@ class ClusterPoolsOperations:
:param cluster_pool_name: The name of the cluster pool. Required.
:type cluster_pool_name: str
:param cluster_pool_tags: Parameters supplied to update tags. Required.
:type cluster_pool_tags: IO
:type cluster_pool_tags: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either ClusterPool or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hdinsightcontainers.models.ClusterPool]
@ -507,7 +447,7 @@ class ClusterPoolsOperations:
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_pool_tags: Union[_models.TagsObject, IO],
cluster_pool_tags: Union[_models.TagsObject, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.ClusterPool]:
"""Updates an existing Cluster Pool Tags.
@ -518,19 +458,8 @@ class ClusterPoolsOperations:
:param cluster_pool_name: The name of the cluster pool. Required.
:type cluster_pool_name: str
:param cluster_pool_tags: Parameters supplied to update tags. Is either a TagsObject type or a
IO type. Required.
:type cluster_pool_tags: ~azure.mgmt.hdinsightcontainers.models.TagsObject 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.
IO[bytes] type. Required.
:type cluster_pool_tags: ~azure.mgmt.hdinsightcontainers.models.TagsObject or IO[bytes]
:return: An instance of AsyncLROPoller that returns either ClusterPool or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hdinsightcontainers.models.ClusterPool]
@ -562,7 +491,7 @@ class ClusterPoolsOperations:
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ClusterPool", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@ -575,17 +504,15 @@ class ClusterPoolsOperations:
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
return AsyncLROPoller[_models.ClusterPool].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_tags.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}"
}
return AsyncLROPoller[_models.ClusterPool](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, cluster_pool_name: str, **kwargs: Any
@ -604,21 +531,20 @@ class ClusterPoolsOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
_request = build_delete_request(
resource_group_name=resource_group_name,
cluster_pool_name=cluster_pool_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -633,11 +559,7 @@ class ClusterPoolsOperations:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
if cls:
return cls(pipeline_response, None, response_headers)
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}"
}
return cls(pipeline_response, None, response_headers) # type: ignore
@distributed_trace_async
async def begin_delete(
@ -650,14 +572,6 @@ class ClusterPoolsOperations:
:type resource_group_name: str
:param cluster_pool_name: The name of the cluster pool. Required.
:type cluster_pool_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:
@ -684,7 +598,7 @@ class ClusterPoolsOperations:
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
@ -693,23 +607,18 @@ class ClusterPoolsOperations:
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}"
}
return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ClusterPool"]:
"""Gets the list of Cluster Pools within a Subscription.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ClusterPool or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hdinsightcontainers.models.ClusterPool]
@ -732,15 +641,14 @@ class ClusterPoolsOperations:
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_subscription_request(
_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)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@ -752,13 +660,13 @@ class ClusterPoolsOperations:
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ClusterPoolListResult", pipeline_response)
@ -768,11 +676,11 @@ class ClusterPoolsOperations:
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -785,10 +693,6 @@ class ClusterPoolsOperations:
return AsyncItemPaged(get_next, extract_data)
list_by_subscription.metadata = {
"url": "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/clusterpools"
}
@distributed_trace
def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.ClusterPool"]:
"""Lists the HDInsight cluster pools under a resource group.
@ -796,7 +700,6 @@ class ClusterPoolsOperations:
: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 ClusterPool or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hdinsightcontainers.models.ClusterPool]
@ -819,16 +722,15 @@ class ClusterPoolsOperations:
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_resource_group_request(
_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)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@ -840,13 +742,13 @@ class ClusterPoolsOperations:
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ClusterPoolListResult", pipeline_response)
@ -856,11 +758,11 @@ class ClusterPoolsOperations:
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -873,6 +775,199 @@ class ClusterPoolsOperations:
return AsyncItemPaged(get_next, extract_data)
list_by_resource_group.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools"
}
async def _upgrade_initial(
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_pool_upgrade_request: Union[_models.ClusterPoolUpgrade, IO[bytes]],
**kwargs: Any
) -> Optional[_models.ClusterPool]:
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.ClusterPool]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(cluster_pool_upgrade_request, (IOBase, bytes)):
_content = cluster_pool_upgrade_request
else:
_json = self._serialize.body(cluster_pool_upgrade_request, "ClusterPoolUpgrade")
_request = build_upgrade_request(
resource_group_name=resource_group_name,
cluster_pool_name=cluster_pool_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 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("ClusterPool", 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) # type: ignore
return deserialized # type: ignore
@overload
async def begin_upgrade(
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_pool_upgrade_request: _models.ClusterPoolUpgrade,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ClusterPool]:
"""Upgrade a cluster pool.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_pool_name: The name of the cluster pool. Required.
:type cluster_pool_name: str
:param cluster_pool_upgrade_request: Upgrade a cluster pool. Required.
:type cluster_pool_upgrade_request: ~azure.mgmt.hdinsightcontainers.models.ClusterPoolUpgrade
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either ClusterPool or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hdinsightcontainers.models.ClusterPool]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_upgrade(
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_pool_upgrade_request: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ClusterPool]:
"""Upgrade a cluster pool.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_pool_name: The name of the cluster pool. Required.
:type cluster_pool_name: str
:param cluster_pool_upgrade_request: Upgrade a cluster pool. Required.
:type cluster_pool_upgrade_request: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns either ClusterPool or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hdinsightcontainers.models.ClusterPool]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_upgrade(
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_pool_upgrade_request: Union[_models.ClusterPoolUpgrade, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.ClusterPool]:
"""Upgrade a cluster pool.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_pool_name: The name of the cluster pool. Required.
:type cluster_pool_name: str
:param cluster_pool_upgrade_request: Upgrade a cluster pool. Is either a ClusterPoolUpgrade
type or a IO[bytes] type. Required.
:type cluster_pool_upgrade_request: ~azure.mgmt.hdinsightcontainers.models.ClusterPoolUpgrade
or IO[bytes]
:return: An instance of AsyncLROPoller that returns either ClusterPool or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hdinsightcontainers.models.ClusterPool]
: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.ClusterPool] = 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._upgrade_initial(
resource_group_name=resource_group_name,
cluster_pool_name=cluster_pool_name,
cluster_pool_upgrade_request=cluster_pool_upgrade_request,
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("ClusterPool", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(
AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
)
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller[_models.ClusterPool].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller[_models.ClusterPool](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,4 +1,4 @@
# pylint: disable=too-many-lines
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@ -70,7 +70,6 @@ class LocationsOperations:
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: NameAvailabilityResult or the result of cls(response)
:rtype: ~azure.mgmt.hdinsightcontainers.models.NameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
@ -78,18 +77,22 @@ class LocationsOperations:
@overload
async def check_name_availability(
self, location: str, name_availability_parameters: IO, *, content_type: str = "application/json", **kwargs: Any
self,
location: str,
name_availability_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.NameAvailabilityResult:
"""Check the availability of the resource name.
:param location: The name of the Azure region. Required.
:type location: str
:param name_availability_parameters: The name and type of the resource. Required.
:type name_availability_parameters: IO
:type name_availability_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: NameAvailabilityResult or the result of cls(response)
:rtype: ~azure.mgmt.hdinsightcontainers.models.NameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
@ -97,20 +100,19 @@ class LocationsOperations:
@distributed_trace_async
async def check_name_availability(
self, location: str, name_availability_parameters: Union[_models.NameAvailabilityParameters, IO], **kwargs: Any
self,
location: str,
name_availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]],
**kwargs: Any
) -> _models.NameAvailabilityResult:
"""Check the availability of the resource name.
:param location: The name of the Azure region. Required.
:type location: str
:param name_availability_parameters: The name and type of the resource. Is either a
NameAvailabilityParameters type or a IO type. Required.
NameAvailabilityParameters type or a IO[bytes] type. Required.
:type name_availability_parameters:
~azure.mgmt.hdinsightcontainers.models.NameAvailabilityParameters 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
~azure.mgmt.hdinsightcontainers.models.NameAvailabilityParameters or IO[bytes]
:return: NameAvailabilityResult or the result of cls(response)
:rtype: ~azure.mgmt.hdinsightcontainers.models.NameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
@ -138,23 +140,22 @@ class LocationsOperations:
else:
_json = self._serialize.body(name_availability_parameters, "NameAvailabilityParameters")
request = build_check_name_availability_request(
_request = build_check_name_availability_request(
location=location,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self.check_name_availability.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -167,10 +168,6 @@ class LocationsOperations:
deserialized = self._deserialize("NameAvailabilityResult", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
check_name_availability.metadata = {
"url": "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/checkNameAvailability"
}
return deserialized # type: ignore

Просмотреть файл

@ -1,4 +1,4 @@
# pylint: disable=too-many-lines
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@ -56,7 +56,6 @@ class Operations:
def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]:
"""Returns list of operations.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Operation or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hdinsightcontainers.models.Operation]
@ -79,14 +78,13 @@ class Operations:
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
_request = build_list_request(
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@ -98,13 +96,13 @@ class Operations:
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("OperationListResult", pipeline_response)
@ -114,11 +112,11 @@ class Operations:
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -130,5 +128,3 @@ class Operations:
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {"url": "/providers/Microsoft.HDInsight/operations"}

Просмотреть файл

@ -12,8 +12,16 @@ from ._models_py3 import AuthorizationProfile
from ._models_py3 import AutoscaleProfile
from ._models_py3 import CatalogOptions
from ._models_py3 import Cluster
from ._models_py3 import ClusterAKSPatchVersionUpgradeProperties
from ._models_py3 import ClusterAccessProfile
from ._models_py3 import ClusterAvailableUpgrade
from ._models_py3 import ClusterAvailableUpgradeAksPatchUpgradeProperties
from ._models_py3 import ClusterAvailableUpgradeHotfixUpgradeProperties
from ._models_py3 import ClusterAvailableUpgradeList
from ._models_py3 import ClusterAvailableUpgradeProperties
from ._models_py3 import ClusterComponentsItem
from ._models_py3 import ClusterConfigFile
from ._models_py3 import ClusterHotfixUpgradeProperties
from ._models_py3 import ClusterInstanceViewProperties
from ._models_py3 import ClusterInstanceViewPropertiesStatus
from ._models_py3 import ClusterInstanceViewResult
@ -27,41 +35,63 @@ from ._models_py3 import ClusterListResult
from ._models_py3 import ClusterLogAnalyticsApplicationLogs
from ._models_py3 import ClusterLogAnalyticsProfile
from ._models_py3 import ClusterPatch
from ._models_py3 import ClusterPatchProperties
from ._models_py3 import ClusterPool
from ._models_py3 import ClusterPoolAKSPatchVersionUpgradeProperties
from ._models_py3 import ClusterPoolAvailableUpgrade
from ._models_py3 import ClusterPoolAvailableUpgradeAksPatchUpgradeProperties
from ._models_py3 import ClusterPoolAvailableUpgradeList
from ._models_py3 import ClusterPoolAvailableUpgradeNodeOsUpgradeProperties
from ._models_py3 import ClusterPoolAvailableUpgradeProperties
from ._models_py3 import ClusterPoolComputeProfile
from ._models_py3 import ClusterPoolListResult
from ._models_py3 import ClusterPoolLogAnalyticsProfile
from ._models_py3 import ClusterPoolNetworkProfile
from ._models_py3 import ClusterPoolNodeOsImageUpdateProperties
from ._models_py3 import ClusterPoolProfile
from ._models_py3 import ClusterPoolResourceProperties
from ._models_py3 import ClusterPoolResourcePropertiesAksClusterProfile
from ._models_py3 import ClusterPoolResourcePropertiesClusterPoolProfile
from ._models_py3 import ClusterPoolResourcePropertiesComputeProfile
from ._models_py3 import ClusterPoolResourcePropertiesLogAnalyticsProfile
from ._models_py3 import ClusterPoolResourcePropertiesNetworkProfile
from ._models_py3 import ClusterPoolUpgrade
from ._models_py3 import ClusterPoolUpgradeProperties
from ._models_py3 import ClusterPoolVersion
from ._models_py3 import ClusterPoolVersionProperties
from ._models_py3 import ClusterPoolVersionsListResult
from ._models_py3 import ClusterProfile
from ._models_py3 import ClusterPrometheusProfile
from ._models_py3 import ClusterRangerPluginProfile
from ._models_py3 import ClusterResizeData
from ._models_py3 import ClusterResizeProperties
from ._models_py3 import ClusterResourceProperties
from ._models_py3 import ClusterServiceConfig
from ._models_py3 import ClusterServiceConfigsProfile
from ._models_py3 import ClusterUpgrade
from ._models_py3 import ClusterUpgradeProperties
from ._models_py3 import ClusterVersion
from ._models_py3 import ClusterVersionProperties
from ._models_py3 import ClusterVersionsListResult
from ._models_py3 import ComparisonRule
from ._models_py3 import ComputeProfile
from ._models_py3 import ComputeResourceDefinition
from ._models_py3 import ConnectivityProfile
from ._models_py3 import ConnectivityProfileWeb
from ._models_py3 import DiskStorageProfile
from ._models_py3 import ErrorAdditionalInfo
from ._models_py3 import ErrorDetail
from ._models_py3 import ErrorResponse
from ._models_py3 import FlinkCatalogOptions
from ._models_py3 import FlinkHiveCatalogOption
from ._models_py3 import FlinkJobProfile
from ._models_py3 import FlinkJobProperties
from ._models_py3 import FlinkProfile
from ._models_py3 import FlinkStorageProfile
from ._models_py3 import HiveCatalogOption
from ._models_py3 import IdentityProfile
from ._models_py3 import KafkaConnectivityEndpoints
from ._models_py3 import KafkaProfile
from ._models_py3 import LoadBasedConfig
from ._models_py3 import NameAvailabilityParameters
from ._models_py3 import NameAvailabilityResult
@ -70,6 +100,11 @@ from ._models_py3 import Operation
from ._models_py3 import OperationDisplay
from ._models_py3 import OperationListResult
from ._models_py3 import ProxyResource
from ._models_py3 import RangerAdminSpec
from ._models_py3 import RangerAdminSpecDatabase
from ._models_py3 import RangerAuditSpec
from ._models_py3 import RangerProfile
from ._models_py3 import RangerUsersyncSpec
from ._models_py3 import Resource
from ._models_py3 import ScalingRule
from ._models_py3 import Schedule
@ -93,6 +128,7 @@ from ._models_py3 import SystemData
from ._models_py3 import TagsObject
from ._models_py3 import TrackedResource
from ._models_py3 import TrinoCoordinator
from ._models_py3 import TrinoDebugConfig
from ._models_py3 import TrinoProfile
from ._models_py3 import TrinoTelemetryConfig
from ._models_py3 import TrinoUserPlugin
@ -105,15 +141,29 @@ from ._models_py3 import WebConnectivityEndpoint
from ._hd_insight_containers_mgmt_client_enums import Action
from ._hd_insight_containers_mgmt_client_enums import ActionType
from ._hd_insight_containers_mgmt_client_enums import AutoscaleType
from ._hd_insight_containers_mgmt_client_enums import ClusterAvailableUpgradeType
from ._hd_insight_containers_mgmt_client_enums import ClusterPoolAvailableUpgradeType
from ._hd_insight_containers_mgmt_client_enums import ClusterPoolUpgradeType
from ._hd_insight_containers_mgmt_client_enums import ClusterUpgradeType
from ._hd_insight_containers_mgmt_client_enums import ComparisonOperator
from ._hd_insight_containers_mgmt_client_enums import ContentEncoding
from ._hd_insight_containers_mgmt_client_enums import CreatedByType
from ._hd_insight_containers_mgmt_client_enums import CurrentClusterAksVersionStatus
from ._hd_insight_containers_mgmt_client_enums import CurrentClusterPoolAksVersionStatus
from ._hd_insight_containers_mgmt_client_enums import DataDiskType
from ._hd_insight_containers_mgmt_client_enums import DbConnectionAuthenticationMode
from ._hd_insight_containers_mgmt_client_enums import DeploymentMode
from ._hd_insight_containers_mgmt_client_enums import JobType
from ._hd_insight_containers_mgmt_client_enums import KeyVaultObjectType
from ._hd_insight_containers_mgmt_client_enums import MetastoreDbConnectionAuthenticationMode
from ._hd_insight_containers_mgmt_client_enums import Origin
from ._hd_insight_containers_mgmt_client_enums import OutboundType
from ._hd_insight_containers_mgmt_client_enums import ProvisioningStatus
from ._hd_insight_containers_mgmt_client_enums import RangerUsersyncMode
from ._hd_insight_containers_mgmt_client_enums import ScaleActionType
from ._hd_insight_containers_mgmt_client_enums import ScheduleDay
from ._hd_insight_containers_mgmt_client_enums import Severity
from ._hd_insight_containers_mgmt_client_enums import UpgradeMode
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
from ._patch import patch_sdk as _patch_sdk
@ -125,8 +175,16 @@ __all__ = [
"AutoscaleProfile",
"CatalogOptions",
"Cluster",
"ClusterAKSPatchVersionUpgradeProperties",
"ClusterAccessProfile",
"ClusterAvailableUpgrade",
"ClusterAvailableUpgradeAksPatchUpgradeProperties",
"ClusterAvailableUpgradeHotfixUpgradeProperties",
"ClusterAvailableUpgradeList",
"ClusterAvailableUpgradeProperties",
"ClusterComponentsItem",
"ClusterConfigFile",
"ClusterHotfixUpgradeProperties",
"ClusterInstanceViewProperties",
"ClusterInstanceViewPropertiesStatus",
"ClusterInstanceViewResult",
@ -140,41 +198,63 @@ __all__ = [
"ClusterLogAnalyticsApplicationLogs",
"ClusterLogAnalyticsProfile",
"ClusterPatch",
"ClusterPatchProperties",
"ClusterPool",
"ClusterPoolAKSPatchVersionUpgradeProperties",
"ClusterPoolAvailableUpgrade",
"ClusterPoolAvailableUpgradeAksPatchUpgradeProperties",
"ClusterPoolAvailableUpgradeList",
"ClusterPoolAvailableUpgradeNodeOsUpgradeProperties",
"ClusterPoolAvailableUpgradeProperties",
"ClusterPoolComputeProfile",
"ClusterPoolListResult",
"ClusterPoolLogAnalyticsProfile",
"ClusterPoolNetworkProfile",
"ClusterPoolNodeOsImageUpdateProperties",
"ClusterPoolProfile",
"ClusterPoolResourceProperties",
"ClusterPoolResourcePropertiesAksClusterProfile",
"ClusterPoolResourcePropertiesClusterPoolProfile",
"ClusterPoolResourcePropertiesComputeProfile",
"ClusterPoolResourcePropertiesLogAnalyticsProfile",
"ClusterPoolResourcePropertiesNetworkProfile",
"ClusterPoolUpgrade",
"ClusterPoolUpgradeProperties",
"ClusterPoolVersion",
"ClusterPoolVersionProperties",
"ClusterPoolVersionsListResult",
"ClusterProfile",
"ClusterPrometheusProfile",
"ClusterRangerPluginProfile",
"ClusterResizeData",
"ClusterResizeProperties",
"ClusterResourceProperties",
"ClusterServiceConfig",
"ClusterServiceConfigsProfile",
"ClusterUpgrade",
"ClusterUpgradeProperties",
"ClusterVersion",
"ClusterVersionProperties",
"ClusterVersionsListResult",
"ComparisonRule",
"ComputeProfile",
"ComputeResourceDefinition",
"ConnectivityProfile",
"ConnectivityProfileWeb",
"DiskStorageProfile",
"ErrorAdditionalInfo",
"ErrorDetail",
"ErrorResponse",
"FlinkCatalogOptions",
"FlinkHiveCatalogOption",
"FlinkJobProfile",
"FlinkJobProperties",
"FlinkProfile",
"FlinkStorageProfile",
"HiveCatalogOption",
"IdentityProfile",
"KafkaConnectivityEndpoints",
"KafkaProfile",
"LoadBasedConfig",
"NameAvailabilityParameters",
"NameAvailabilityResult",
@ -183,6 +263,11 @@ __all__ = [
"OperationDisplay",
"OperationListResult",
"ProxyResource",
"RangerAdminSpec",
"RangerAdminSpecDatabase",
"RangerAuditSpec",
"RangerProfile",
"RangerUsersyncSpec",
"Resource",
"ScalingRule",
"Schedule",
@ -206,6 +291,7 @@ __all__ = [
"TagsObject",
"TrackedResource",
"TrinoCoordinator",
"TrinoDebugConfig",
"TrinoProfile",
"TrinoTelemetryConfig",
"TrinoUserPlugin",
@ -217,15 +303,29 @@ __all__ = [
"Action",
"ActionType",
"AutoscaleType",
"ClusterAvailableUpgradeType",
"ClusterPoolAvailableUpgradeType",
"ClusterPoolUpgradeType",
"ClusterUpgradeType",
"ComparisonOperator",
"ContentEncoding",
"CreatedByType",
"CurrentClusterAksVersionStatus",
"CurrentClusterPoolAksVersionStatus",
"DataDiskType",
"DbConnectionAuthenticationMode",
"DeploymentMode",
"JobType",
"KeyVaultObjectType",
"MetastoreDbConnectionAuthenticationMode",
"Origin",
"OutboundType",
"ProvisioningStatus",
"RangerUsersyncMode",
"ScaleActionType",
"ScheduleDay",
"Severity",
"UpgradeMode",
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()

Просмотреть файл

@ -25,6 +25,8 @@ class Action(str, Enum, metaclass=CaseInsensitiveEnumMeta):
SAVEPOINT = "SAVEPOINT"
LIST_SAVEPOINT = "LIST_SAVEPOINT"
DELETE = "DELETE"
LAST_STATE_UPDATE = "LAST_STATE_UPDATE"
RE_LAUNCH = "RE_LAUNCH"
class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
@ -40,6 +42,34 @@ class AutoscaleType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
LOAD_BASED = "LoadBased"
class ClusterAvailableUpgradeType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Type of upgrade."""
AKS_PATCH_UPGRADE = "AKSPatchUpgrade"
HOTFIX_UPGRADE = "HotfixUpgrade"
class ClusterPoolAvailableUpgradeType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Type of upgrade."""
AKS_PATCH_UPGRADE = "AKSPatchUpgrade"
NODE_OS_UPGRADE = "NodeOsUpgrade"
class ClusterPoolUpgradeType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Type of upgrade."""
AKS_PATCH_UPGRADE = "AKSPatchUpgrade"
NODE_OS_UPGRADE = "NodeOsUpgrade"
class ClusterUpgradeType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Type of upgrade."""
AKS_PATCH_UPGRADE = "AKSPatchUpgrade"
HOTFIX_UPGRADE = "HotfixUpgrade"
class ComparisonOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The comparison operator."""
@ -68,6 +98,51 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
KEY = "Key"
class CurrentClusterAksVersionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Current AKS version's status: whether it is deprecated or supported."""
DEPRECATED = "Deprecated"
SUPPORTED = "Supported"
class CurrentClusterPoolAksVersionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Current AKS version's status: whether it is deprecated or supported."""
DEPRECATED = "Deprecated"
SUPPORTED = "Supported"
class DataDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Managed Disk Type."""
STANDARD_HDD_LRS = "Standard_HDD_LRS"
STANDARD_SSD_LRS = "Standard_SSD_LRS"
STANDARD_SSD_ZRS = "Standard_SSD_ZRS"
PREMIUM_SSD_LRS = "Premium_SSD_LRS"
PREMIUM_SSD_ZRS = "Premium_SSD_ZRS"
PREMIUM_SSD_V2_LRS = "Premium_SSD_v2_LRS"
class DbConnectionAuthenticationMode(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The authentication mode to connect to your Hive metastore database. More details:
https://learn.microsoft.com/en-us/azure/azure-sql/database/logins-create-manage?view=azuresql#authentication-and-authorization.
"""
SQL_AUTH = "SqlAuth"
"""The password-based authentication to connect to your Hive metastore database."""
IDENTITY_AUTH = "IdentityAuth"
"""The managed-identity-based authentication to connect to your Hive metastore database."""
class DeploymentMode(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""A string property that indicates the deployment mode of Flink cluster. It can have one of the
following enum values => Application, Session. Default value is Session.
"""
APPLICATION = "Application"
SESSION = "Session"
class JobType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Type of cluster job."""
@ -82,6 +157,17 @@ class KeyVaultObjectType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
CERTIFICATE = "Certificate"
class MetastoreDbConnectionAuthenticationMode(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The authentication mode to connect to your Hive metastore database. More details:
https://learn.microsoft.com/en-us/azure/azure-sql/database/logins-create-manage?view=azuresql#authentication-and-authorization.
"""
SQL_AUTH = "SqlAuth"
"""The password-based authentication to connect to your Hive metastore database."""
IDENTITY_AUTH = "IdentityAuth"
"""The managed-identity-based authentication to connect to your Hive metastore database."""
class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit
logs UX. Default value is "user,system".
@ -92,6 +178,17 @@ class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta):
USER_SYSTEM = "user,system"
class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""This can only be set at cluster pool creation time and cannot be changed later."""
LOAD_BALANCER = "loadBalancer"
"""The load balancer is used for egress through an AKS assigned public IP. This supports
Kubernetes services of type 'loadBalancer'."""
USER_DEFINED_ROUTING = "userDefinedRouting"
"""Egress paths must be defined by the user. This is an advanced scenario and requires proper
network configuration."""
class ProvisioningStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Provisioning state of the resource."""
@ -101,6 +198,13 @@ class ProvisioningStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta):
FAILED = "Failed"
class RangerUsersyncMode(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""User & groups can be synced automatically or via a static list that's refreshed."""
STATIC = "static"
AUTOMATIC = "automatic"
class ScaleActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The action type."""
@ -118,3 +222,22 @@ class ScheduleDay(str, Enum, metaclass=CaseInsensitiveEnumMeta):
THURSDAY = "Thursday"
FRIDAY = "Friday"
SATURDAY = "Saturday"
class Severity(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Severity of this upgrade."""
LOW = "low"
MEDIUM = "medium"
HIGH = "high"
CRITICAL = "critical"
class UpgradeMode(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""A string property that indicates the upgrade mode to be performed on the Flink job. It can have
one of the following enum values => STATELESS_UPDATE, UPDATE, LAST_STATE_UPDATE.
"""
STATELESS_UPDATE = "STATELESS_UPDATE"
UPDATE = "UPDATE"
LAST_STATE_UPDATE = "LAST_STATE_UPDATE"

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -7,7 +7,9 @@
# --------------------------------------------------------------------------
from ._cluster_pools_operations import ClusterPoolsOperations
from ._cluster_pool_available_upgrades_operations import ClusterPoolAvailableUpgradesOperations
from ._clusters_operations import ClustersOperations
from ._cluster_available_upgrades_operations import ClusterAvailableUpgradesOperations
from ._cluster_jobs_operations import ClusterJobsOperations
from ._locations_operations import LocationsOperations
from ._operations import Operations
@ -20,7 +22,9 @@ from ._patch import patch_sdk as _patch_sdk
__all__ = [
"ClusterPoolsOperations",
"ClusterPoolAvailableUpgradesOperations",
"ClustersOperations",
"ClusterAvailableUpgradesOperations",
"ClusterJobsOperations",
"LocationsOperations",
"Operations",

Просмотреть файл

@ -1,4 +1,4 @@
# pylint: disable=too-many-lines
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@ -40,7 +40,7 @@ def build_list_by_location_request(location: str, subscription_id: str, **kwargs
_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-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -89,7 +89,6 @@ class AvailableClusterPoolVersionsOperations:
:param location: The name of the Azure region. Required.
:type location: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ClusterPoolVersion or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hdinsightcontainers.models.ClusterPoolVersion]
:raises ~azure.core.exceptions.HttpResponseError:
@ -111,16 +110,15 @@ class AvailableClusterPoolVersionsOperations:
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_location_request(
_request = build_list_by_location_request(
location=location,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_by_location.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@ -132,13 +130,13 @@ class AvailableClusterPoolVersionsOperations:
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ClusterPoolVersionsListResult", pipeline_response)
@ -148,11 +146,11 @@ class AvailableClusterPoolVersionsOperations:
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -164,7 +162,3 @@ class AvailableClusterPoolVersionsOperations:
return pipeline_response
return ItemPaged(get_next, extract_data)
list_by_location.metadata = {
"url": "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/availableClusterPoolVersions"
}

Просмотреть файл

@ -1,4 +1,4 @@
# pylint: disable=too-many-lines
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@ -40,7 +40,7 @@ def build_list_by_location_request(location: str, subscription_id: str, **kwargs
_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-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -89,7 +89,6 @@ class AvailableClusterVersionsOperations:
:param location: The name of the Azure region. Required.
:type location: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ClusterVersion or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hdinsightcontainers.models.ClusterVersion]
:raises ~azure.core.exceptions.HttpResponseError:
@ -111,16 +110,15 @@ class AvailableClusterVersionsOperations:
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_location_request(
_request = build_list_by_location_request(
location=location,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_by_location.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@ -132,13 +130,13 @@ class AvailableClusterVersionsOperations:
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ClusterVersionsListResult", pipeline_response)
@ -148,11 +146,11 @@ class AvailableClusterVersionsOperations:
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -164,7 +162,3 @@ class AvailableClusterVersionsOperations:
return pipeline_response
return ItemPaged(get_next, extract_data)
list_by_location.metadata = {
"url": "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/availableClusterVersions"
}

Просмотреть файл

@ -0,0 +1,181 @@
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from 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 _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(
resource_group_name: str, cluster_pool_name: str, cluster_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/clusters/{clusterName}/availableUpgrades",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"clusterPoolName": _SERIALIZER.url("cluster_pool_name", cluster_pool_name, "str"),
"clusterName": _SERIALIZER.url("cluster_name", cluster_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)
class ClusterAvailableUpgradesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.hdinsightcontainers.HDInsightContainersMgmtClient`'s
:attr:`cluster_available_upgrades` 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, resource_group_name: str, cluster_pool_name: str, cluster_name: str, **kwargs: Any
) -> Iterable["_models.ClusterAvailableUpgrade"]:
"""List a cluster available upgrade.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_pool_name: The name of the cluster pool. Required.
:type cluster_pool_name: str
:param cluster_name: The name of the HDInsight cluster. Required.
:type cluster_name: str
:return: An iterator like instance of either ClusterAvailableUpgrade or the result of
cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.hdinsightcontainers.models.ClusterAvailableUpgrade]
: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.ClusterAvailableUpgradeList] = 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,
cluster_pool_name=cluster_pool_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ClusterAvailableUpgradeList", 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)

Просмотреть файл

@ -1,4 +1,4 @@
# pylint: disable=too-many-lines
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@ -45,7 +45,7 @@ def build_run_job_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -77,12 +77,18 @@ def build_run_job_request(
def build_list_request(
resource_group_name: str, cluster_pool_name: str, cluster_name: str, subscription_id: str, **kwargs: Any
resource_group_name: str,
cluster_pool_name: str,
cluster_name: str,
subscription_id: str,
*,
filter: Optional[str] = None,
**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-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -103,6 +109,8 @@ def build_list_request(
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
if filter is not None:
_params["$filter"] = _SERIALIZER.query("filter", filter, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
@ -134,7 +142,7 @@ class ClusterJobsOperations:
resource_group_name: str,
cluster_pool_name: str,
cluster_name: str,
cluster_job: Union[_models.ClusterJob, IO],
cluster_job: Union[_models.ClusterJob, IO[bytes]],
**kwargs: Any
) -> Optional[_models.ClusterJob]:
error_map = {
@ -160,7 +168,7 @@ class ClusterJobsOperations:
else:
_json = self._serialize.body(cluster_job, "ClusterJob")
request = build_run_job_request(
_request = build_run_job_request(
resource_group_name=resource_group_name,
cluster_pool_name=cluster_pool_name,
cluster_name=cluster_name,
@ -169,16 +177,15 @@ class ClusterJobsOperations:
content_type=content_type,
json=_json,
content=_content,
template_url=self._run_job_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -197,13 +204,9 @@ class ClusterJobsOperations:
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
if cls:
return cls(pipeline_response, deserialized, response_headers)
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
_run_job_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/clusters/{clusterName}/runJob"
}
return deserialized # type: ignore
@overload
def begin_run_job(
@ -230,14 +233,6 @@ class ClusterJobsOperations:
: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 ClusterJob or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hdinsightcontainers.models.ClusterJob]
:raises ~azure.core.exceptions.HttpResponseError:
@ -249,7 +244,7 @@ class ClusterJobsOperations:
resource_group_name: str,
cluster_pool_name: str,
cluster_name: str,
cluster_job: IO,
cluster_job: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@ -264,18 +259,10 @@ class ClusterJobsOperations:
:param cluster_name: The name of the HDInsight cluster. Required.
:type cluster_name: str
:param cluster_job: The Cluster job. Required.
:type cluster_job: IO
:type cluster_job: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either ClusterJob or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hdinsightcontainers.models.ClusterJob]
:raises ~azure.core.exceptions.HttpResponseError:
@ -287,7 +274,7 @@ class ClusterJobsOperations:
resource_group_name: str,
cluster_pool_name: str,
cluster_name: str,
cluster_job: Union[_models.ClusterJob, IO],
cluster_job: Union[_models.ClusterJob, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.ClusterJob]:
"""Operations on jobs of HDInsight on AKS cluster.
@ -299,19 +286,8 @@ class ClusterJobsOperations:
:type cluster_pool_name: str
:param cluster_name: The name of the HDInsight cluster. Required.
:type cluster_name: str
:param cluster_job: The Cluster job. Is either a ClusterJob type or a IO type. Required.
:type cluster_job: ~azure.mgmt.hdinsightcontainers.models.ClusterJob or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:param cluster_job: The Cluster job. Is either a ClusterJob type or a IO[bytes] type. Required.
:type cluster_job: ~azure.mgmt.hdinsightcontainers.models.ClusterJob or IO[bytes]
:return: An instance of LROPoller that returns either ClusterJob or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hdinsightcontainers.models.ClusterJob]
:raises ~azure.core.exceptions.HttpResponseError:
@ -343,7 +319,7 @@ class ClusterJobsOperations:
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ClusterJob", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@ -355,21 +331,24 @@ class ClusterJobsOperations:
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
return LROPoller[_models.ClusterJob].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_run_job.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/clusters/{clusterName}/runJob"
}
return LROPoller[_models.ClusterJob](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
@distributed_trace
def list(
self, resource_group_name: str, cluster_pool_name: str, cluster_name: str, **kwargs: Any
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_name: str,
filter: Optional[str] = None,
**kwargs: Any
) -> Iterable["_models.ClusterJob"]:
"""Get jobs of HDInsight on AKS cluster.
@ -380,7 +359,9 @@ class ClusterJobsOperations:
:type cluster_pool_name: str
:param cluster_name: The name of the HDInsight cluster. Required.
:type cluster_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:param filter: The system query option to filter job returned in the response. Allowed value is
'jobName eq {jobName}' or 'jarName eq {jarName}'. Default value is None.
:type filter: str
:return: An iterator like instance of either ClusterJob or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hdinsightcontainers.models.ClusterJob]
:raises ~azure.core.exceptions.HttpResponseError:
@ -402,18 +383,18 @@ class ClusterJobsOperations:
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
_request = build_list_request(
resource_group_name=resource_group_name,
cluster_pool_name=cluster_pool_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
filter=filter,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@ -425,13 +406,13 @@ class ClusterJobsOperations:
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ClusterJobList", pipeline_response)
@ -441,11 +422,11 @@ class ClusterJobsOperations:
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -457,7 +438,3 @@ class ClusterJobsOperations:
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/clusters/{clusterName}/jobs"
}

Просмотреть файл

@ -0,0 +1,177 @@
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from 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 _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(
resource_group_name: str, cluster_pool_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-11-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/availableUpgrades",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"clusterPoolName": _SERIALIZER.url("cluster_pool_name", cluster_pool_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)
class ClusterPoolAvailableUpgradesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.hdinsightcontainers.HDInsightContainersMgmtClient`'s
:attr:`cluster_pool_available_upgrades` 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, resource_group_name: str, cluster_pool_name: str, **kwargs: Any
) -> Iterable["_models.ClusterPoolAvailableUpgrade"]:
"""List a cluster pool available upgrade.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_pool_name: The name of the cluster pool. Required.
:type cluster_pool_name: str
:return: An iterator like instance of either ClusterPoolAvailableUpgrade or the result of
cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.hdinsightcontainers.models.ClusterPoolAvailableUpgrade]
: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.ClusterPoolAvailableUpgradeList] = 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,
cluster_pool_name=cluster_pool_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ClusterPoolAvailableUpgradeList", 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)

Просмотреть файл

@ -1,4 +1,4 @@
# pylint: disable=too-many-lines
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@ -45,7 +45,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -78,7 +78,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -114,7 +114,7 @@ def build_update_tags_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -150,7 +150,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -181,7 +181,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -205,7 +205,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -231,6 +231,42 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_upgrade_request(
resource_group_name: str, cluster_pool_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-11-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/upgrade",
) # 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"),
"clusterPoolName": _SERIALIZER.url("cluster_pool_name", cluster_pool_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)
class ClusterPoolsOperations:
"""
.. warning::
@ -259,7 +295,6 @@ class ClusterPoolsOperations:
:type resource_group_name: str
:param cluster_pool_name: The name of the cluster pool. Required.
:type cluster_pool_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ClusterPool or the result of cls(response)
:rtype: ~azure.mgmt.hdinsightcontainers.models.ClusterPool
:raises ~azure.core.exceptions.HttpResponseError:
@ -278,21 +313,20 @@ class ClusterPoolsOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ClusterPool] = kwargs.pop("cls", None)
request = build_get_request(
_request = build_get_request(
resource_group_name=resource_group_name,
cluster_pool_name=cluster_pool_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -305,19 +339,15 @@ class ClusterPoolsOperations:
deserialized = self._deserialize("ClusterPool", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}"
}
return deserialized # type: ignore
def _create_or_update_initial(
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_pool: Union[_models.ClusterPool, IO],
cluster_pool: Union[_models.ClusterPool, IO[bytes]],
**kwargs: Any
) -> _models.ClusterPool:
error_map = {
@ -343,7 +373,7 @@ class ClusterPoolsOperations:
else:
_json = self._serialize.body(cluster_pool, "ClusterPool")
request = build_create_or_update_request(
_request = build_create_or_update_request(
resource_group_name=resource_group_name,
cluster_pool_name=cluster_pool_name,
subscription_id=self._config.subscription_id,
@ -351,16 +381,15 @@ class ClusterPoolsOperations:
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -381,10 +410,6 @@ class ClusterPoolsOperations:
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}"
}
@overload
def begin_create_or_update(
self,
@ -407,14 +432,6 @@ class ClusterPoolsOperations:
: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 ClusterPool or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hdinsightcontainers.models.ClusterPool]
@ -426,7 +443,7 @@ class ClusterPoolsOperations:
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_pool: IO,
cluster_pool: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@ -439,18 +456,10 @@ class ClusterPoolsOperations:
:param cluster_pool_name: The name of the cluster pool. Required.
:type cluster_pool_name: str
:param cluster_pool: The Cluster Pool to create. Required.
:type cluster_pool: IO
:type cluster_pool: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either ClusterPool or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hdinsightcontainers.models.ClusterPool]
@ -462,7 +471,7 @@ class ClusterPoolsOperations:
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_pool: Union[_models.ClusterPool, IO],
cluster_pool: Union[_models.ClusterPool, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.ClusterPool]:
"""Creates or updates a cluster pool.
@ -472,20 +481,9 @@ class ClusterPoolsOperations:
:type resource_group_name: str
:param cluster_pool_name: The name of the cluster pool. Required.
:type cluster_pool_name: str
:param cluster_pool: The Cluster Pool to create. Is either a ClusterPool type or a IO type.
Required.
:type cluster_pool: ~azure.mgmt.hdinsightcontainers.models.ClusterPool or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:param cluster_pool: The Cluster Pool to create. Is either a ClusterPool type or a IO[bytes]
type. Required.
:type cluster_pool: ~azure.mgmt.hdinsightcontainers.models.ClusterPool or IO[bytes]
:return: An instance of LROPoller that returns either ClusterPool or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hdinsightcontainers.models.ClusterPool]
@ -517,7 +515,7 @@ class ClusterPoolsOperations:
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ClusterPool", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@ -529,23 +527,21 @@ class ClusterPoolsOperations:
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
return LROPoller[_models.ClusterPool].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.HDInsight/clusterpools/{clusterPoolName}"
}
return LROPoller[_models.ClusterPool](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _update_tags_initial(
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_pool_tags: Union[_models.TagsObject, IO],
cluster_pool_tags: Union[_models.TagsObject, IO[bytes]],
**kwargs: Any
) -> _models.ClusterPool:
error_map = {
@ -571,7 +567,7 @@ class ClusterPoolsOperations:
else:
_json = self._serialize.body(cluster_pool_tags, "TagsObject")
request = build_update_tags_request(
_request = build_update_tags_request(
resource_group_name=resource_group_name,
cluster_pool_name=cluster_pool_name,
subscription_id=self._config.subscription_id,
@ -579,16 +575,15 @@ class ClusterPoolsOperations:
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_tags_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -612,10 +607,6 @@ class ClusterPoolsOperations:
return deserialized # type: ignore
_update_tags_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}"
}
@overload
def begin_update_tags(
self,
@ -638,14 +629,6 @@ class ClusterPoolsOperations:
: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 ClusterPool or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hdinsightcontainers.models.ClusterPool]
@ -657,7 +640,7 @@ class ClusterPoolsOperations:
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_pool_tags: IO,
cluster_pool_tags: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@ -670,18 +653,10 @@ class ClusterPoolsOperations:
:param cluster_pool_name: The name of the cluster pool. Required.
:type cluster_pool_name: str
:param cluster_pool_tags: Parameters supplied to update tags. Required.
:type cluster_pool_tags: IO
:type cluster_pool_tags: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either ClusterPool or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hdinsightcontainers.models.ClusterPool]
@ -693,7 +668,7 @@ class ClusterPoolsOperations:
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_pool_tags: Union[_models.TagsObject, IO],
cluster_pool_tags: Union[_models.TagsObject, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.ClusterPool]:
"""Updates an existing Cluster Pool Tags.
@ -704,19 +679,8 @@ class ClusterPoolsOperations:
:param cluster_pool_name: The name of the cluster pool. Required.
:type cluster_pool_name: str
:param cluster_pool_tags: Parameters supplied to update tags. Is either a TagsObject type or a
IO type. Required.
:type cluster_pool_tags: ~azure.mgmt.hdinsightcontainers.models.TagsObject 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.
IO[bytes] type. Required.
:type cluster_pool_tags: ~azure.mgmt.hdinsightcontainers.models.TagsObject or IO[bytes]
:return: An instance of LROPoller that returns either ClusterPool or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hdinsightcontainers.models.ClusterPool]
@ -748,7 +712,7 @@ class ClusterPoolsOperations:
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ClusterPool", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@ -760,17 +724,15 @@ class ClusterPoolsOperations:
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
return LROPoller[_models.ClusterPool].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_tags.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}"
}
return LROPoller[_models.ClusterPool](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, cluster_pool_name: str, **kwargs: Any
@ -789,21 +751,20 @@ class ClusterPoolsOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
_request = build_delete_request(
resource_group_name=resource_group_name,
cluster_pool_name=cluster_pool_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -818,11 +779,7 @@ class ClusterPoolsOperations:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
if cls:
return cls(pipeline_response, None, response_headers)
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}"
}
return cls(pipeline_response, None, response_headers) # type: ignore
@distributed_trace
def begin_delete(self, resource_group_name: str, cluster_pool_name: str, **kwargs: Any) -> LROPoller[None]:
@ -833,14 +790,6 @@ class ClusterPoolsOperations:
:type resource_group_name: str
:param cluster_pool_name: The name of the cluster pool. Required.
:type cluster_pool_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:
@ -867,7 +816,7 @@ class ClusterPoolsOperations:
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
@ -876,23 +825,18 @@ class ClusterPoolsOperations:
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}"
}
return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ClusterPool"]:
"""Gets the list of Cluster Pools within a Subscription.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ClusterPool or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hdinsightcontainers.models.ClusterPool]
:raises ~azure.core.exceptions.HttpResponseError:
@ -914,15 +858,14 @@ class ClusterPoolsOperations:
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_subscription_request(
_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)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@ -934,13 +877,13 @@ class ClusterPoolsOperations:
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ClusterPoolListResult", pipeline_response)
@ -950,11 +893,11 @@ class ClusterPoolsOperations:
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -967,10 +910,6 @@ class ClusterPoolsOperations:
return ItemPaged(get_next, extract_data)
list_by_subscription.metadata = {
"url": "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/clusterpools"
}
@distributed_trace
def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ClusterPool"]:
"""Lists the HDInsight cluster pools under a resource group.
@ -978,7 +917,6 @@ class ClusterPoolsOperations:
: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 ClusterPool or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hdinsightcontainers.models.ClusterPool]
:raises ~azure.core.exceptions.HttpResponseError:
@ -1000,16 +938,15 @@ class ClusterPoolsOperations:
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_resource_group_request(
_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)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@ -1021,13 +958,13 @@ class ClusterPoolsOperations:
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ClusterPoolListResult", pipeline_response)
@ -1037,11 +974,11 @@ class ClusterPoolsOperations:
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -1054,6 +991,199 @@ class ClusterPoolsOperations:
return ItemPaged(get_next, extract_data)
list_by_resource_group.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools"
}
def _upgrade_initial(
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_pool_upgrade_request: Union[_models.ClusterPoolUpgrade, IO[bytes]],
**kwargs: Any
) -> Optional[_models.ClusterPool]:
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.ClusterPool]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(cluster_pool_upgrade_request, (IOBase, bytes)):
_content = cluster_pool_upgrade_request
else:
_json = self._serialize.body(cluster_pool_upgrade_request, "ClusterPoolUpgrade")
_request = build_upgrade_request(
resource_group_name=resource_group_name,
cluster_pool_name=cluster_pool_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 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("ClusterPool", 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) # type: ignore
return deserialized # type: ignore
@overload
def begin_upgrade(
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_pool_upgrade_request: _models.ClusterPoolUpgrade,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ClusterPool]:
"""Upgrade a cluster pool.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_pool_name: The name of the cluster pool. Required.
:type cluster_pool_name: str
:param cluster_pool_upgrade_request: Upgrade a cluster pool. Required.
:type cluster_pool_upgrade_request: ~azure.mgmt.hdinsightcontainers.models.ClusterPoolUpgrade
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ClusterPool or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hdinsightcontainers.models.ClusterPool]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_upgrade(
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_pool_upgrade_request: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ClusterPool]:
"""Upgrade a cluster pool.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_pool_name: The name of the cluster pool. Required.
:type cluster_pool_name: str
:param cluster_pool_upgrade_request: Upgrade a cluster pool. Required.
:type cluster_pool_upgrade_request: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns either ClusterPool or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hdinsightcontainers.models.ClusterPool]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_upgrade(
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_pool_upgrade_request: Union[_models.ClusterPoolUpgrade, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.ClusterPool]:
"""Upgrade a cluster pool.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param cluster_pool_name: The name of the cluster pool. Required.
:type cluster_pool_name: str
:param cluster_pool_upgrade_request: Upgrade a cluster pool. Is either a ClusterPoolUpgrade
type or a IO[bytes] type. Required.
:type cluster_pool_upgrade_request: ~azure.mgmt.hdinsightcontainers.models.ClusterPoolUpgrade
or IO[bytes]
:return: An instance of LROPoller that returns either ClusterPool or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hdinsightcontainers.models.ClusterPool]
: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.ClusterPool] = 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._upgrade_initial(
resource_group_name=resource_group_name,
cluster_pool_name=cluster_pool_name,
cluster_pool_upgrade_request=cluster_pool_upgrade_request,
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("ClusterPool", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(
PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
)
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.ClusterPool].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.ClusterPool](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,4 +1,4 @@
# pylint: disable=too-many-lines
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@ -39,7 +39,7 @@ def build_check_name_availability_request(location: str, subscription_id: str, *
_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-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -104,7 +104,6 @@ class LocationsOperations:
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: NameAvailabilityResult or the result of cls(response)
:rtype: ~azure.mgmt.hdinsightcontainers.models.NameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
@ -112,18 +111,22 @@ class LocationsOperations:
@overload
def check_name_availability(
self, location: str, name_availability_parameters: IO, *, content_type: str = "application/json", **kwargs: Any
self,
location: str,
name_availability_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.NameAvailabilityResult:
"""Check the availability of the resource name.
:param location: The name of the Azure region. Required.
:type location: str
:param name_availability_parameters: The name and type of the resource. Required.
:type name_availability_parameters: IO
:type name_availability_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: NameAvailabilityResult or the result of cls(response)
:rtype: ~azure.mgmt.hdinsightcontainers.models.NameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
@ -131,20 +134,19 @@ class LocationsOperations:
@distributed_trace
def check_name_availability(
self, location: str, name_availability_parameters: Union[_models.NameAvailabilityParameters, IO], **kwargs: Any
self,
location: str,
name_availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]],
**kwargs: Any
) -> _models.NameAvailabilityResult:
"""Check the availability of the resource name.
:param location: The name of the Azure region. Required.
:type location: str
:param name_availability_parameters: The name and type of the resource. Is either a
NameAvailabilityParameters type or a IO type. Required.
NameAvailabilityParameters type or a IO[bytes] type. Required.
:type name_availability_parameters:
~azure.mgmt.hdinsightcontainers.models.NameAvailabilityParameters 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
~azure.mgmt.hdinsightcontainers.models.NameAvailabilityParameters or IO[bytes]
:return: NameAvailabilityResult or the result of cls(response)
:rtype: ~azure.mgmt.hdinsightcontainers.models.NameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
@ -172,23 +174,22 @@ class LocationsOperations:
else:
_json = self._serialize.body(name_availability_parameters, "NameAvailabilityParameters")
request = build_check_name_availability_request(
_request = build_check_name_availability_request(
location=location,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self.check_name_availability.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -201,10 +202,6 @@ class LocationsOperations:
deserialized = self._deserialize("NameAvailabilityResult", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
check_name_availability.metadata = {
"url": "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/checkNameAvailability"
}
return deserialized # type: ignore

Просмотреть файл

@ -1,4 +1,4 @@
# pylint: disable=too-many-lines
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@ -40,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -78,7 +78,6 @@ class Operations:
def list(self, **kwargs: Any) -> Iterable["_models.Operation"]:
"""Returns list of operations.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Operation or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hdinsightcontainers.models.Operation]
:raises ~azure.core.exceptions.HttpResponseError:
@ -100,14 +99,13 @@ class Operations:
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
_request = build_list_request(
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@ -119,13 +117,13 @@ class Operations:
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("OperationListResult", pipeline_response)
@ -135,11 +133,11 @@ class Operations:
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -151,5 +149,3 @@ class Operations:
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {"url": "/providers/Microsoft.HDInsight/operations"}

Просмотреть файл

@ -6,7 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
"""
@ -71,24 +74,29 @@ def main():
"timeZone": "Cen. Australia Standard Time",
},
},
"clusterVersion": "1.0.1",
"clusterVersion": "1.0.6",
"identityProfile": {
"msiClientId": "de91f1d8-767f-460a-ac11-3cf103f74b34",
"msiObjectId": "40491351-c240-4042-91e0-f644a1d2b441",
"msiResourceId": "/subscriptions/subid/resourceGroups/hiloResourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-msi",
},
"kafkaProfile": {},
"ossVersion": "2.4.1",
"ossVersion": "0.410.0",
"sshProfile": {"count": 2},
"trinoProfile": {},
},
"clusterType": "Trino",
"computeProfile": {
"nodes": [
{"count": 2, "type": "Head", "vmSize": "Standard_E8as_v5"},
{"count": 3, "type": "Worker", "vmSize": "Standard_E8as_v5"},
]
},
"clusterType": "kafka",
"computeProfile": {"nodes": [{"count": 4, "type": "worker", "vmSize": "Standard_D3_v2"}]},
},
},
).result()
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/CreateAutoscaleCluster.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/CreateAutoscaleCluster.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -6,7 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
"""
@ -43,6 +46,6 @@ def main():
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/CreateClusterPool.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/CreateClusterPool.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1,55 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-hdinsightcontainers
# USAGE
python create_cluster_pool_with_private_aks.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 = HDInsightContainersMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="10e32bab-26da-4cc4-a441-52b318f824e6",
)
response = client.cluster_pools.begin_create_or_update(
resource_group_name="hiloResourcegroup",
cluster_pool_name="clusterpool1",
cluster_pool={
"location": "West US 2",
"properties": {
"clusterPoolProfile": {"clusterPoolVersion": "1.2"},
"computeProfile": {"vmSize": "Standard_D3_v2"},
"networkProfile": {
"enablePrivateApiServer": True,
"subnetId": "/subscriptions/subid/resourceGroups/hiloResourcegroup/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1",
},
},
},
).result()
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/CreateClusterPoolWithPrivateAks.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1,55 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-hdinsightcontainers
# USAGE
python create_cluster_pool_with_udr_aks.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 = HDInsightContainersMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="10e32bab-26da-4cc4-a441-52b318f824e6",
)
response = client.cluster_pools.begin_create_or_update(
resource_group_name="hiloResourcegroup",
cluster_pool_name="clusterpool1",
cluster_pool={
"location": "West US 2",
"properties": {
"clusterPoolProfile": {"clusterPoolVersion": "1.2"},
"computeProfile": {"vmSize": "Standard_D3_v2"},
"networkProfile": {
"outboundType": "userDefinedRouting",
"subnetId": "/subscriptions/subid/resourceGroups/hiloResourcegroup/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1",
},
},
},
).result()
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/CreateClusterPoolWithUDRAks.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1,80 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-hdinsightcontainers
# USAGE
python create_ranger_cluster.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = HDInsightContainersMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="10e32bab-26da-4cc4-a441-52b318f824e6",
)
response = client.clusters.begin_create(
resource_group_name="hiloResourcegroup",
cluster_pool_name="clusterpool1",
cluster_name="cluster1",
hd_insight_cluster={
"location": "West US 2",
"properties": {
"clusterProfile": {
"authorizationProfile": {"userIds": ["testuser1", "testuser2"]},
"clusterVersion": "0.0.1",
"identityProfile": {
"msiClientId": "de91f1d8-767f-460a-ac11-3cf103f74b34",
"msiObjectId": "40491351-c240-4042-91e0-f644a1d2b441",
"msiResourceId": "/subscriptions/subid/resourceGroups/hiloResourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-msi",
},
"ossVersion": "2.2.3",
"rangerProfile": {
"rangerAdmin": {
"admins": ["testuser1@contoso.com", "testuser2@contoso.com"],
"database": {
"host": "testsqlserver.database.windows.net",
"name": "testdb",
"passwordSecretRef": "https://testkv.vault.azure.net/secrets/mysecret/5df6584d9c25418c8d900240aa6c3452",
"username": "admin",
},
},
"rangerAudit": {"storageAccount": "https://teststorage.blob.core.windows.net/testblob"},
"rangerUsersync": {
"enabled": True,
"groups": ["0a53828f-36c9-44c3-be3d-99a7fce977ad", "13be6971-79db-4f33-9d41-b25589ca25ac"],
"mode": "automatic",
"users": ["testuser1@contoso.com", "testuser2@contoso.com"],
},
},
},
"clusterType": "ranger",
"computeProfile": {"nodes": [{"count": 2, "type": "head", "vmSize": "Standard_D3_v2"}]},
},
},
).result()
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/CreateRangerCluster.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -6,7 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
"""
@ -93,6 +96,6 @@ def main():
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/CreateSparkCluster.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/CreateSparkCluster.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1,102 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-hdinsightcontainers
# USAGE
python create_spark_cluster_with_internal_ingress.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 = HDInsightContainersMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="10e32bab-26da-4cc4-a441-52b318f824e6",
)
response = client.clusters.begin_create(
resource_group_name="hiloResourcegroup",
cluster_pool_name="clusterpool1",
cluster_name="cluster1",
hd_insight_cluster={
"location": "West US 2",
"properties": {
"clusterProfile": {
"authorizationProfile": {"userIds": ["testuser1", "testuser2"]},
"clusterAccessProfile": {"enableInternalIngress": True},
"clusterVersion": "0.0.1",
"identityProfile": {
"msiClientId": "de91f1d8-767f-460a-ac11-3cf103f74b34",
"msiObjectId": "40491351-c240-4042-91e0-f644a1d2b441",
"msiResourceId": "/subscriptions/subid/resourceGroups/hiloResourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-msi",
},
"ossVersion": "2.2.3",
"serviceConfigsProfiles": [
{
"configs": [
{
"component": "spark-config",
"files": [
{
"fileName": "spark-defaults.conf",
"values": {"spark.eventLog.enabled": "true"},
}
],
}
],
"serviceName": "spark-service",
},
{
"configs": [
{
"component": "yarn-config",
"files": [
{
"fileName": "core-site.xml",
"values": {
"fs.defaultFS": "wasb://testcontainer@teststorage.dfs.core.windows.net/",
"storage.container": "testcontainer",
"storage.key": "test key",
"storage.name": "teststorage",
"storage.protocol": "wasb",
},
},
{"fileName": "yarn-site.xml", "values": {"yarn.webapp.ui2.enable": "false"}},
],
}
],
"serviceName": "yarn-service",
},
],
"sparkProfile": {},
"sshProfile": {"count": 2},
},
"clusterType": "spark",
"computeProfile": {"nodes": [{"count": 4, "type": "worker", "vmSize": "Standard_D3_v2"}]},
},
},
).result()
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/CreateSparkClusterWithInternalIngress.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
"""
@ -36,6 +37,6 @@ def main():
).result()
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/DeleteCluster.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/DeleteCluster.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
"""
@ -35,6 +36,6 @@ def main():
).result()
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/DeleteClusterPool.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/DeleteClusterPool.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
"""
@ -37,6 +38,6 @@ def main():
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/GetCluster.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/GetCluster.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
"""
@ -37,6 +38,6 @@ def main():
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/GetClusterInstanceView.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/GetClusterInstanceView.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
"""
@ -36,6 +37,6 @@ def main():
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/GetClusterPool.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/GetClusterPool.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
"""
@ -34,6 +35,6 @@ def main():
print(item)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/GetOperations.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/GetOperations.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
"""
@ -36,6 +37,6 @@ def main():
print(item)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListAvailableClusterPoolVersions.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/ListAvailableClusterPoolVersions.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
"""
@ -36,6 +37,6 @@ def main():
print(item)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListAvailableClusterVersions.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/ListAvailableClusterVersions.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1,44 @@
# 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.hdinsightcontainers import HDInsightContainersMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-hdinsightcontainers
# USAGE
python list_cluster_available_upgrades.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 = HDInsightContainersMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="10e32bab-26da-4cc4-a441-52b318f824e6",
)
response = client.cluster_available_upgrades.list(
resource_group_name="hiloResourcegroup",
cluster_pool_name="clusterpool1",
cluster_name="cluster1",
)
for item in response:
print(item)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/ListClusterAvailableUpgrades.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
"""
@ -38,6 +39,6 @@ def main():
print(item)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClusterInstanceViews.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/ListClusterInstanceViews.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
"""
@ -26,7 +27,7 @@ from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
def main():
client = HDInsightContainersMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="10e32bab-26da-4cc4-a441-52b318f824e6",
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.cluster_jobs.list(
@ -38,6 +39,6 @@ def main():
print(item)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClusterJobs.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/ListClusterJobs.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -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.hdinsightcontainers import HDInsightContainersMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-hdinsightcontainers
# USAGE
python list_cluster_pool_available_upgrades.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 = HDInsightContainersMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="10e32bab-26da-4cc4-a441-52b318f824e6",
)
response = client.cluster_pool_available_upgrades.list(
resource_group_name="hiloResourcegroup",
cluster_pool_name="clusterpool1",
)
for item in response:
print(item)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/ListClusterPoolAvailableUpgrades.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
"""
@ -36,6 +37,6 @@ def main():
print(item)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClusterPools.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/ListClusterPools.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
"""
@ -34,6 +35,6 @@ def main():
print(item)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClusterPoolsSubscription.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/ListClusterPoolsSubscription.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
"""
@ -38,6 +39,6 @@ def main():
print(item)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClusterServiceConfigs.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/ListClusterServiceConfigs.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
"""
@ -37,6 +38,6 @@ def main():
print(item)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClustersByClusterPoolName.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/ListClustersByClusterPoolName.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -6,7 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
"""
@ -36,6 +39,6 @@ def main():
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/LocationsNameAvailability.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/LocationsNameAvailability.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -6,7 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
"""
@ -34,7 +37,6 @@ def main():
cluster_pool_name="clusterpool1",
cluster_name="cluster1",
cluster_patch_request={
"location": "West US 2",
"properties": {
"clusterProfile": {
"authorizationProfile": {"userIds": ["Testuser1", "Testuser2"]},
@ -102,12 +104,12 @@ def main():
],
"sshProfile": {"count": 2},
}
},
}
},
).result()
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/PatchCluster.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/PatchCluster.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -6,7 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
"""
@ -37,6 +40,6 @@ def main():
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/PatchClusterPool.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/PatchClusterPool.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1,69 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-hdinsightcontainers
# USAGE
python patch_ranger_cluster.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = HDInsightContainersMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="10e32bab-26da-4cc4-a441-52b318f824e6",
)
response = client.clusters.begin_update(
resource_group_name="hiloResourcegroup",
cluster_pool_name="clusterpool1",
cluster_name="cluster1",
cluster_patch_request={
"properties": {
"clusterProfile": {
"rangerProfile": {
"rangerAdmin": {
"admins": ["testuser1@contoso.com", "testuser2@contoso.com"],
"database": {
"host": "testsqlserver.database.windows.net",
"name": "testdb",
"passwordSecretRef": "https://testkv.vault.azure.net/secrets/mysecret/5df6584d9c25418c8d900240aa6c3452",
"username": "admin",
},
},
"rangerAudit": {"storageAccount": "https://teststorage.blob.core.windows.net/testblob"},
"rangerUsersync": {
"enabled": True,
"groups": ["0a53828f-36c9-44c3-be3d-99a7fce977ad", "13be6971-79db-4f33-9d41-b25589ca25ac"],
"mode": "automatic",
"users": ["testuser1@contoso.com", "testuser2@contoso.com"],
},
}
}
}
},
).result()
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/PatchRangerCluster.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -6,7 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
"""
@ -38,6 +41,6 @@ def main():
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ResizeCluster.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/ResizeCluster.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -6,7 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
"""
@ -26,7 +29,7 @@ from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
def main():
client = HDInsightContainersMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="10e32bab-26da-4cc4-a441-52b318f824e6",
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.cluster_jobs.begin_run_job(
@ -51,6 +54,6 @@ def main():
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/RunClusterJob.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/RunClusterJob.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1,46 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-hdinsightcontainers
# USAGE
python upgrade_aks_patch_version_for_cluster.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = HDInsightContainersMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="10e32bab-26da-4cc4-a441-52b318f824e6",
)
response = client.clusters.begin_upgrade(
resource_group_name="hiloResourcegroup",
cluster_pool_name="clusterpool1",
cluster_name="cluster1",
cluster_upgrade_request={"properties": {"upgradeType": "AKSPatchUpgrade"}},
).result()
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/UpgradeAKSPatchVersionForCluster.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1,51 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-hdinsightcontainers
# USAGE
python upgrade_aks_patch_version_for_cluster_pool.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 = HDInsightContainersMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="10e32bab-26da-4cc4-a441-52b318f824e6",
)
response = client.cluster_pools.begin_upgrade(
resource_group_name="hiloResourcegroup",
cluster_pool_name="clusterpool1",
cluster_pool_upgrade_request={
"properties": {
"upgradeAllClusterNodes": False,
"upgradeClusterPool": True,
"upgradeType": "AKSPatchUpgrade",
}
},
).result()
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/UpgradeAKSPatchVersionForClusterPool.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -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 typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-hdinsightcontainers
# USAGE
python upgrade_hotfix_for_cluster.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = HDInsightContainersMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="10e32bab-26da-4cc4-a441-52b318f824e6",
)
response = client.clusters.begin_upgrade(
resource_group_name="hiloResourcegroup",
cluster_pool_name="clusterpool1",
cluster_name="cluster1",
cluster_upgrade_request={
"properties": {
"componentName": "historyserver",
"targetBuildNumber": "3",
"targetClusterVersion": "1.0.6",
"targetOssVersion": "1.16.0",
"upgradeType": "HotfixUpgrade",
}
},
).result()
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/UpgradeHotfixForCluster.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1,45 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-hdinsightcontainers
# USAGE
python upgrade_node_os_for_cluster_pool.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 = HDInsightContainersMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="10e32bab-26da-4cc4-a441-52b318f824e6",
)
response = client.cluster_pools.begin_upgrade(
resource_group_name="hiloResourcegroup",
cluster_pool_name="clusterpool1",
cluster_pool_upgrade_request={"properties": {"upgradeType": "NodeOsUpgrade"}},
).result()
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/UpgradeNodeOsForClusterPool.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -53,11 +53,11 @@ setup(
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"License :: OSI Approved :: MIT License",
],
zip_safe=False,
@ -74,10 +74,9 @@ setup(
"pytyped": ["py.typed"],
},
install_requires=[
"isodate<1.0.0,>=0.6.1",
"azure-common~=1.1",
"azure-mgmt-core>=1.3.2,<2.0.0",
"typing-extensions>=4.3.0; python_version<'3.8.0'",
"isodate>=0.6.1",
"azure-common>=1.1",
"azure-mgmt-core>=1.3.2",
],
python_requires=">=3.7",
python_requires=">=3.8",
)