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

[AutoRelease] t2-hdinsightcontainers-2024-08-16-34825(can only be merged by SDK owner) (#36920)

* code and test

* update-testcase

* Update CHANGELOG.md

---------

Co-authored-by: azure-sdk <PythonSdkPipelines>
Co-authored-by: ChenxiJiang333 <v-chenjiang@microsoft.com>
Co-authored-by: Yuchao Yan <yuchaoyan@microsoft.com>
This commit is contained in:
Azure SDK Bot 2024-08-25 23:36:13 -07:00 коммит произвёл GitHub
Родитель fc5648dd68
Коммит 252b227973
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
108 изменённых файлов: 7468 добавлений и 561 удалений

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

@ -1,5 +1,87 @@
# Release History
## 1.0.0b3 (2024-08-26)
### Features Added
- The 'HDInsightContainersMgmtClient' client had operation group 'cluster_pool_upgrade_histories' added in the current version
- The 'HDInsightContainersMgmtClient' client had operation group 'cluster_upgrade_histories' added in the current version
- The 'HDInsightContainersMgmtClient' client had operation group 'cluster_libraries' added in the current version
- The 'ClustersOperations' method 'begin_upgrade_manual_rollback' was added in the current version
- The model or publicly exposed class 'ClusterLibrariesOperations' was added in the current version
- The model or publicly exposed class 'ClusterPoolUpgradeHistoriesOperations' was added in the current version
- The model or publicly exposed class 'ClusterUpgradeHistoriesOperations' was added in the current version
- The model or publicly exposed class 'ClusterAvailableUpgradeType' had property 'PATCH_VERSION_UPGRADE' added in the current version
- The model or publicly exposed class 'ClusterPoolComputeProfile' had property 'availability_zones' added in the current version
- The model or publicly exposed class 'ClusterPoolProfile' had property 'public_ip_tag' added in the current version
- The model or publicly exposed class 'ClusterPoolResourcePropertiesClusterPoolProfile' had property 'public_ip_tag' added in the current version
- The model or publicly exposed class 'ClusterPoolResourcePropertiesComputeProfile' had property 'availability_zones' added in the current version
- The model or publicly exposed class 'ClusterProfile' had property 'managed_identity_profile' added in the current version
- The model or publicly exposed class 'ClusterUpgradeType' had property 'PATCH_VERSION_UPGRADE' added in the current version
- The model or publicly exposed class 'ComputeProfile' had property 'availability_zones' added in the current version
- The model or publicly exposed class 'SshProfile' had property 'vm_size' added in the current version
- The model or publicly exposed class 'UpdatableClusterProfile' had property 'secrets_profile' added in the current version
- The model or publicly exposed class 'UpdatableClusterProfile' had property 'trino_profile' added in the current version
- The model or publicly exposed class 'Category' was added in the current version
- The model or publicly exposed class 'ClusterAksPatchUpgradeHistoryProperties' was added in the current version
- The model or publicly exposed class 'ClusterAvailableInPlaceUpgradeProperties' was added in the current version
- The model or publicly exposed class 'ClusterAvailableUpgradePatchVersionUpgradeProperties' was added in the current version
- The model or publicly exposed class 'ClusterHotfixUpgradeHistoryProperties' was added in the current version
- The model or publicly exposed class 'ClusterHotfixUpgradeRollbackHistoryProperties' was added in the current version
- The model or publicly exposed class 'ClusterInPlaceUpgradeHistoryProperties' was added in the current version
- The model or publicly exposed class 'ClusterInPlaceUpgradeProperties' was added in the current version
- The model or publicly exposed class 'ClusterLibrary' was added in the current version
- The model or publicly exposed class 'ClusterLibraryList' was added in the current version
- The model or publicly exposed class 'ClusterLibraryManagementOperation' was added in the current version
- The model or publicly exposed class 'ClusterLibraryManagementOperationProperties' was added in the current version
- The model or publicly exposed class 'ClusterLibraryProperties' was added in the current version
- The model or publicly exposed class 'ClusterPatchVersionUpgradeHistoryProperties' was added in the current version
- The model or publicly exposed class 'ClusterPatchVersionUpgradeProperties' was added in the current version
- The model or publicly exposed class 'ClusterPatchVersionUpgradeRollbackHistoryProperties' was added in the current version
- The model or publicly exposed class 'ClusterPoolAksPatchUpgradeHistoryProperties' was added in the current version
- The model or publicly exposed class 'ClusterPoolNodeOsUpgradeHistoryProperties' was added in the current version
- The model or publicly exposed class 'ClusterPoolUpgradeHistory' was added in the current version
- The model or publicly exposed class 'ClusterPoolUpgradeHistoryListResult' was added in the current version
- The model or publicly exposed class 'ClusterPoolUpgradeHistoryProperties' was added in the current version
- The model or publicly exposed class 'ClusterPoolUpgradeHistoryType' was added in the current version
- The model or publicly exposed class 'ClusterPoolUpgradeHistoryUpgradeResultType' was added in the current version
- The model or publicly exposed class 'ClusterUpgradeHistory' was added in the current version
- The model or publicly exposed class 'ClusterUpgradeHistoryListResult' was added in the current version
- The model or publicly exposed class 'ClusterUpgradeHistoryProperties' was added in the current version
- The model or publicly exposed class 'ClusterUpgradeHistorySeverityType' was added in the current version
- The model or publicly exposed class 'ClusterUpgradeHistoryType' was added in the current version
- The model or publicly exposed class 'ClusterUpgradeHistoryUpgradeResultType' was added in the current version
- The model or publicly exposed class 'ClusterUpgradeRollback' was added in the current version
- The model or publicly exposed class 'ClusterUpgradeRollbackProperties' was added in the current version
- The model or publicly exposed class 'IpTag' was added in the current version
- The model or publicly exposed class 'LibraryManagementAction' was added in the current version
- The model or publicly exposed class 'ManagedIdentityProfile' was added in the current version
- The model or publicly exposed class 'ManagedIdentitySpec' was added in the current version
- The model or publicly exposed class 'ManagedIdentityType' was added in the current version
- The model or publicly exposed class 'MavenLibraryProperties' was added in the current version
- The model or publicly exposed class 'PyPiLibraryProperties' was added in the current version
- The model or publicly exposed class 'Status' was added in the current version
- The model or publicly exposed class 'Type' was added in the current version
### Breaking Changes
- The model or publicly exposed class 'ClusterAvailableUpgradeHotfixUpgradeProperties' had its instance variable 'description' deleted or renamed in the current version
- The model or publicly exposed class 'ClusterAvailableUpgradeHotfixUpgradeProperties' had its instance variable 'source_oss_version' deleted or renamed in the current version
- The model or publicly exposed class 'ClusterAvailableUpgradeHotfixUpgradeProperties' had its instance variable 'source_cluster_version' deleted or renamed in the current version
- The model or publicly exposed class 'ClusterAvailableUpgradeHotfixUpgradeProperties' had its instance variable 'source_build_number' deleted or renamed in the current version
- The model or publicly exposed class 'ClusterAvailableUpgradeHotfixUpgradeProperties' had its instance variable 'target_oss_version' deleted or renamed in the current version
- The model or publicly exposed class 'ClusterAvailableUpgradeHotfixUpgradeProperties' had its instance variable 'target_cluster_version' deleted or renamed in the current version
- The model or publicly exposed class 'ClusterAvailableUpgradeHotfixUpgradeProperties' had its instance variable 'target_build_number' deleted or renamed in the current version
- The model or publicly exposed class 'ClusterAvailableUpgradeHotfixUpgradeProperties' had its instance variable 'component_name' deleted or renamed in the current version
- The model or publicly exposed class 'ClusterAvailableUpgradeHotfixUpgradeProperties' had its instance variable 'severity' deleted or renamed in the current version
- The model or publicly exposed class 'ClusterAvailableUpgradeHotfixUpgradeProperties' had its instance variable 'extended_properties' deleted or renamed in the current version
- The model or publicly exposed class 'ClusterAvailableUpgradeHotfixUpgradeProperties' had its instance variable 'created_time' deleted or renamed in the current version
- The model or publicly exposed class 'ClusterHotfixUpgradeProperties' had its instance variable 'target_oss_version' deleted or renamed in the current version
- The model or publicly exposed class 'ClusterHotfixUpgradeProperties' had its instance variable 'target_cluster_version' deleted or renamed in the current version
- The model or publicly exposed class 'ClusterHotfixUpgradeProperties' had its instance variable 'target_build_number' deleted or renamed in the current version
- The model or publicly exposed class 'ClusterHotfixUpgradeProperties' had its instance variable 'component_name' deleted or renamed in the current version
- The model or publicly exposed class 'KafkaProfile' had its instance variable 'cluster_identity' deleted or renamed in the current version
## 1.0.0b2 (2024-04-07)
### Features Added

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

@ -1,11 +1,11 @@
{
"commit": "92de53a5f1e0e03c94b40475d2135d97148ed014",
"commit": "0219f9da9de5833fc380f57d6b026f68b5df6f93",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.7",
"autorest": "3.10.2",
"use": [
"@autorest/python@6.13.7",
"@autorest/python@6.17.0",
"@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 --tag=package-preview-2023-11 --use=@autorest/python@6.13.7 --use=@autorest/modelerfour@4.27.0 --version=3.9.7 --version-tolerant=False",
"autorest_command": "autorest specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/readme.md --generate-sample=True --generate-test=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.17.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False",
"readme": "specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/readme.md"
}

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

@ -28,13 +28,13 @@ class HDInsightContainersMgmtClientConfiguration: # pylint: disable=too-many-in
: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-11-01-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2024-05-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:
api_version: str = kwargs.pop("api_version", "2023-11-01-preview")
api_version: str = kwargs.pop("api_version", "2024-05-01-preview")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")

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

@ -8,6 +8,7 @@
from copy import deepcopy
from typing import Any, TYPE_CHECKING
from typing_extensions import Self
from azure.core.pipeline import policies
from azure.core.rest import HttpRequest, HttpResponse
@ -22,8 +23,11 @@ from .operations import (
AvailableClusterVersionsOperations,
ClusterAvailableUpgradesOperations,
ClusterJobsOperations,
ClusterLibrariesOperations,
ClusterPoolAvailableUpgradesOperations,
ClusterPoolUpgradeHistoriesOperations,
ClusterPoolsOperations,
ClusterUpgradeHistoriesOperations,
ClustersOperations,
LocationsOperations,
Operations,
@ -42,11 +46,17 @@ class HDInsightContainersMgmtClient: # pylint: disable=client-accepts-api-versi
:ivar cluster_pool_available_upgrades: ClusterPoolAvailableUpgradesOperations operations
:vartype cluster_pool_available_upgrades:
azure.mgmt.hdinsightcontainers.operations.ClusterPoolAvailableUpgradesOperations
:ivar cluster_pool_upgrade_histories: ClusterPoolUpgradeHistoriesOperations operations
:vartype cluster_pool_upgrade_histories:
azure.mgmt.hdinsightcontainers.operations.ClusterPoolUpgradeHistoriesOperations
: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_upgrade_histories: ClusterUpgradeHistoriesOperations operations
:vartype cluster_upgrade_histories:
azure.mgmt.hdinsightcontainers.operations.ClusterUpgradeHistoriesOperations
:ivar cluster_jobs: ClusterJobsOperations operations
:vartype cluster_jobs: azure.mgmt.hdinsightcontainers.operations.ClusterJobsOperations
:ivar locations: LocationsOperations operations
@ -59,13 +69,16 @@ class HDInsightContainersMgmtClient: # pylint: disable=client-accepts-api-versi
:ivar available_cluster_versions: AvailableClusterVersionsOperations operations
:vartype available_cluster_versions:
azure.mgmt.hdinsightcontainers.operations.AvailableClusterVersionsOperations
:ivar cluster_libraries: ClusterLibrariesOperations operations
:vartype cluster_libraries:
azure.mgmt.hdinsightcontainers.operations.ClusterLibrariesOperations
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: Api Version. Default value is "2023-11-01-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2024-05-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
@ -110,10 +123,16 @@ class HDInsightContainersMgmtClient: # pylint: disable=client-accepts-api-versi
self.cluster_pool_available_upgrades = ClusterPoolAvailableUpgradesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.cluster_pool_upgrade_histories = ClusterPoolUpgradeHistoriesOperations(
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_upgrade_histories = ClusterUpgradeHistoriesOperations(
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)
@ -123,6 +142,9 @@ class HDInsightContainersMgmtClient: # pylint: disable=client-accepts-api-versi
self.available_cluster_versions = AvailableClusterVersionsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.cluster_libraries = ClusterLibrariesOperations(
self._client, self._config, self._serialize, self._deserialize
)
def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.
@ -149,7 +171,7 @@ class HDInsightContainersMgmtClient: # pylint: disable=client-accepts-api-versi
def close(self) -> None:
self._client.close()
def __enter__(self) -> "HDInsightContainersMgmtClient":
def __enter__(self) -> Self:
self._client.__enter__()
return self

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

@ -144,6 +144,8 @@ class RawDeserializer:
# context otherwise.
_LOGGER.critical("Wasn't XML not JSON, failing")
raise DeserializationError("XML is invalid") from err
elif content_type.startswith("text/"):
return data_as_str
raise DeserializationError("Cannot deserialize content-type: {}".format(content_type))
@classmethod
@ -1441,7 +1443,7 @@ class Deserializer(object):
elif isinstance(response, type) and issubclass(response, Enum):
return self.deserialize_enum(data, response)
if data is None:
if data is None or data is CoreNull:
return data
try:
attributes = response._attribute_map # type: ignore

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

@ -1,16 +0,0 @@
# --------------------------------------------------------------------------
# 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.core.pipeline.transport import HttpRequest
def _convert_request(request, files=None):
data = request.content if not files else None
request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data)
if files:
request.set_formdata_body(files)
return request

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

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

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

@ -28,13 +28,13 @@ class HDInsightContainersMgmtClientConfiguration: # pylint: disable=too-many-in
: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-11-01-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2024-05-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:
api_version: str = kwargs.pop("api_version", "2023-11-01-preview")
api_version: str = kwargs.pop("api_version", "2024-05-01-preview")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")

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

@ -8,6 +8,7 @@
from copy import deepcopy
from typing import Any, Awaitable, TYPE_CHECKING
from typing_extensions import Self
from azure.core.pipeline import policies
from azure.core.rest import AsyncHttpResponse, HttpRequest
@ -22,8 +23,11 @@ from .operations import (
AvailableClusterVersionsOperations,
ClusterAvailableUpgradesOperations,
ClusterJobsOperations,
ClusterLibrariesOperations,
ClusterPoolAvailableUpgradesOperations,
ClusterPoolUpgradeHistoriesOperations,
ClusterPoolsOperations,
ClusterUpgradeHistoriesOperations,
ClustersOperations,
LocationsOperations,
Operations,
@ -42,11 +46,17 @@ class HDInsightContainersMgmtClient: # pylint: disable=client-accepts-api-versi
:ivar cluster_pool_available_upgrades: ClusterPoolAvailableUpgradesOperations operations
:vartype cluster_pool_available_upgrades:
azure.mgmt.hdinsightcontainers.aio.operations.ClusterPoolAvailableUpgradesOperations
:ivar cluster_pool_upgrade_histories: ClusterPoolUpgradeHistoriesOperations operations
:vartype cluster_pool_upgrade_histories:
azure.mgmt.hdinsightcontainers.aio.operations.ClusterPoolUpgradeHistoriesOperations
: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_upgrade_histories: ClusterUpgradeHistoriesOperations operations
:vartype cluster_upgrade_histories:
azure.mgmt.hdinsightcontainers.aio.operations.ClusterUpgradeHistoriesOperations
:ivar cluster_jobs: ClusterJobsOperations operations
:vartype cluster_jobs: azure.mgmt.hdinsightcontainers.aio.operations.ClusterJobsOperations
:ivar locations: LocationsOperations operations
@ -59,13 +69,16 @@ class HDInsightContainersMgmtClient: # pylint: disable=client-accepts-api-versi
:ivar available_cluster_versions: AvailableClusterVersionsOperations operations
:vartype available_cluster_versions:
azure.mgmt.hdinsightcontainers.aio.operations.AvailableClusterVersionsOperations
:ivar cluster_libraries: ClusterLibrariesOperations operations
:vartype cluster_libraries:
azure.mgmt.hdinsightcontainers.aio.operations.ClusterLibrariesOperations
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: Api Version. Default value is "2023-11-01-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2024-05-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
@ -110,10 +123,16 @@ class HDInsightContainersMgmtClient: # pylint: disable=client-accepts-api-versi
self.cluster_pool_available_upgrades = ClusterPoolAvailableUpgradesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.cluster_pool_upgrade_histories = ClusterPoolUpgradeHistoriesOperations(
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_upgrade_histories = ClusterUpgradeHistoriesOperations(
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)
@ -123,6 +142,9 @@ class HDInsightContainersMgmtClient: # pylint: disable=client-accepts-api-versi
self.available_cluster_versions = AvailableClusterVersionsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.cluster_libraries = ClusterLibrariesOperations(
self._client, self._config, self._serialize, self._deserialize
)
def _send_request(
self, request: HttpRequest, *, stream: bool = False, **kwargs: Any
@ -151,7 +173,7 @@ class HDInsightContainersMgmtClient: # pylint: disable=client-accepts-api-versi
async def close(self) -> None:
await self._client.close()
async def __aenter__(self) -> "HDInsightContainersMgmtClient":
async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self

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

@ -8,13 +8,16 @@
from ._cluster_pools_operations import ClusterPoolsOperations
from ._cluster_pool_available_upgrades_operations import ClusterPoolAvailableUpgradesOperations
from ._cluster_pool_upgrade_histories_operations import ClusterPoolUpgradeHistoriesOperations
from ._clusters_operations import ClustersOperations
from ._cluster_available_upgrades_operations import ClusterAvailableUpgradesOperations
from ._cluster_upgrade_histories_operations import ClusterUpgradeHistoriesOperations
from ._cluster_jobs_operations import ClusterJobsOperations
from ._locations_operations import LocationsOperations
from ._operations import Operations
from ._available_cluster_pool_versions_operations import AvailableClusterPoolVersionsOperations
from ._available_cluster_versions_operations import AvailableClusterVersionsOperations
from ._cluster_libraries_operations import ClusterLibrariesOperations
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
@ -23,13 +26,16 @@ from ._patch import patch_sdk as _patch_sdk
__all__ = [
"ClusterPoolsOperations",
"ClusterPoolAvailableUpgradesOperations",
"ClusterPoolUpgradeHistoriesOperations",
"ClustersOperations",
"ClusterAvailableUpgradesOperations",
"ClusterUpgradeHistoriesOperations",
"ClusterJobsOperations",
"LocationsOperations",
"Operations",
"AvailableClusterPoolVersionsOperations",
"AvailableClusterVersionsOperations",
"ClusterLibrariesOperations",
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()

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

@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@ -19,16 +20,18 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.rest import AsyncHttpResponse, 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._available_cluster_pool_versions_operations import build_list_by_location_request
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@ -69,7 +72,7 @@ class AvailableClusterPoolVersionsOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ClusterPoolVersionsListResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -87,7 +90,6 @@ class AvailableClusterPoolVersionsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -103,7 +105,6 @@ class AvailableClusterPoolVersionsOperations:
_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

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

@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@ -19,16 +20,18 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.rest import AsyncHttpResponse, 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._available_cluster_versions_operations import build_list_by_location_request
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@ -69,7 +72,7 @@ class AvailableClusterVersionsOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ClusterVersionsListResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -87,7 +90,6 @@ class AvailableClusterVersionsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -103,7 +105,6 @@ class AvailableClusterVersionsOperations:
_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

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

@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@ -19,16 +20,18 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.rest import AsyncHttpResponse, 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
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@ -77,7 +80,7 @@ class ClusterAvailableUpgradesOperations:
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 = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -97,7 +100,6 @@ class ClusterAvailableUpgradesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -113,7 +115,6 @@ class ClusterAvailableUpgradesOperations:
_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

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

@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import sys
from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@ -17,12 +18,13 @@ from azure.core.exceptions import (
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
StreamClosedError,
StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@ -30,9 +32,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._cluster_jobs_operations import build_list_request, build_run_job_request
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@ -63,8 +68,8 @@ class ClusterJobsOperations:
cluster_name: str,
cluster_job: Union[_models.ClusterJob, IO[bytes]],
**kwargs: Any
) -> Optional[_models.ClusterJob]:
error_map = {
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -77,7 +82,7 @@ class ClusterJobsOperations:
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.ClusterJob]] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -99,10 +104,10 @@ class ClusterJobsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -110,18 +115,20 @@ class ClusterJobsOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
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("ClusterJob", pipeline_response)
if response.status_code == 202:
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@ -236,10 +243,11 @@ class ClusterJobsOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ClusterJob", pipeline_response)
deserialized = self._deserialize("ClusterJob", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -295,7 +303,7 @@ class ClusterJobsOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ClusterJobList] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -316,7 +324,6 @@ class ClusterJobsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -332,7 +339,6 @@ class ClusterJobsOperations:
_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

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

@ -0,0 +1,363 @@
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
import sys
from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
StreamClosedError,
StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ...operations._cluster_libraries_operations import build_list_request, build_manage_libraries_request
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class ClusterLibrariesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.hdinsightcontainers.aio.HDInsightContainersMgmtClient`'s
:attr:`cluster_libraries` 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,
category: Union[str, _models.Category],
**kwargs: Any
) -> AsyncIterable["_models.ClusterLibrary"]:
"""Get all libraries of HDInsight on AKS cluster.
: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
:param category: The system query option to filter libraries returned in the response. Allowed
value is 'custom' or 'predefined'. Known values are: "custom" and "predefined". Required.
:type category: str or ~azure.mgmt.hdinsightcontainers.models.Category
:return: An iterator like instance of either ClusterLibrary or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hdinsightcontainers.models.ClusterLibrary]
: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.ClusterLibraryList] = kwargs.pop("cls", None)
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_request(
resource_group_name=resource_group_name,
cluster_pool_name=cluster_pool_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
category=category,
api_version=api_version,
headers=_headers,
params=_params,
)
_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.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ClusterLibraryList", 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)
async def _manage_libraries_initial(
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_name: str,
operation: Union[_models.ClusterLibraryManagementOperation, IO[bytes]],
**kwargs: Any
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(operation, (IOBase, bytes)):
_content = operation
else:
_json = self._serialize.body(operation, "ClusterLibraryManagementOperation")
_request = build_manage_libraries_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,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202]:
try:
await response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
response_headers = {}
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
async def begin_manage_libraries(
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_name: str,
operation: _models.ClusterLibraryManagementOperation,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[None]:
"""Library management operations on HDInsight on AKS cluster.
: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
:param operation: The library management operation. Required.
:type operation: ~azure.mgmt.hdinsightcontainers.models.ClusterLibraryManagementOperation
: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 None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_manage_libraries(
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_name: str,
operation: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[None]:
"""Library management operations on HDInsight on AKS cluster.
: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
:param operation: The library management operation. Required.
:type operation: 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 None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_manage_libraries(
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_name: str,
operation: Union[_models.ClusterLibraryManagementOperation, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[None]:
"""Library management operations on HDInsight on AKS cluster.
: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
:param operation: The library management operation. Is either a
ClusterLibraryManagementOperation type or a IO[bytes] type. Required.
:type operation: ~azure.mgmt.hdinsightcontainers.models.ClusterLibraryManagementOperation or
IO[bytes]
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_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[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._manage_libraries_initial(
resource_group_name=resource_group_name,
cluster_pool_name=cluster_pool_name,
cluster_name=cluster_name,
operation=operation,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(
AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
)
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore

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

@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@ -19,16 +20,18 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.rest import AsyncHttpResponse, 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
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@ -75,7 +78,7 @@ class ClusterPoolAvailableUpgradesOperations:
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 = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -94,7 +97,6 @@ class ClusterPoolAvailableUpgradesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -110,7 +112,6 @@ class ClusterPoolAvailableUpgradesOperations:
_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

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

@ -0,0 +1,142 @@
# 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.
# --------------------------------------------------------------------------
import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, 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.rest import AsyncHttpResponse, 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 ...operations._cluster_pool_upgrade_histories_operations import build_list_request
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class ClusterPoolUpgradeHistoriesOperations:
"""
.. 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_upgrade_histories` 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.ClusterPoolUpgradeHistory"]:
"""Returns a list of upgrade history.
: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 ClusterPoolUpgradeHistory or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hdinsightcontainers.models.ClusterPoolUpgradeHistory]
: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.ClusterPoolUpgradeHistoryListResult] = kwargs.pop("cls", None)
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_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.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.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ClusterPoolUpgradeHistoryListResult", 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)

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

@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import sys
from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@ -17,12 +18,13 @@ from azure.core.exceptions import (
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
StreamClosedError,
StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@ -30,7 +32,6 @@ from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._cluster_pools_operations import (
build_create_or_update_request,
build_delete_request,
@ -41,6 +42,10 @@ from ...operations._cluster_pools_operations import (
build_upgrade_request,
)
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@ -77,7 +82,7 @@ class ClusterPoolsOperations:
:rtype: ~azure.mgmt.hdinsightcontainers.models.ClusterPool
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -99,7 +104,6 @@ class ClusterPoolsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -114,7 +118,7 @@ class ClusterPoolsOperations:
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("ClusterPool", pipeline_response)
deserialized = self._deserialize("ClusterPool", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -127,8 +131,8 @@ class ClusterPoolsOperations:
cluster_pool_name: str,
cluster_pool: Union[_models.ClusterPool, IO[bytes]],
**kwargs: Any
) -> _models.ClusterPool:
error_map = {
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -141,7 +145,7 @@ class ClusterPoolsOperations:
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)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -162,10 +166,10 @@ class ClusterPoolsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -173,15 +177,15 @@ class ClusterPoolsOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
try:
await response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("ClusterPool", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("ClusterPool", pipeline_response)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -288,10 +292,11 @@ class ClusterPoolsOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ClusterPool", pipeline_response)
deserialized = self._deserialize("ClusterPool", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -322,8 +327,8 @@ class ClusterPoolsOperations:
cluster_pool_name: str,
cluster_pool_tags: Union[_models.TagsObject, IO[bytes]],
**kwargs: Any
) -> _models.ClusterPool:
error_map = {
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -336,7 +341,7 @@ class ClusterPoolsOperations:
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)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -357,10 +362,10 @@ class ClusterPoolsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -368,18 +373,19 @@ class ClusterPoolsOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 200:
deserialized = self._deserialize("ClusterPool", pipeline_response)
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
deserialized = self._deserialize("ClusterPool", pipeline_response)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@ -486,10 +492,11 @@ class ClusterPoolsOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ClusterPool", pipeline_response)
deserialized = self._deserialize("ClusterPool", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -514,10 +521,10 @@ class ClusterPoolsOperations:
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
async def _delete_initial( # pylint: disable=inconsistent-return-statements
async def _delete_initial(
self, resource_group_name: str, cluster_pool_name: str, **kwargs: Any
) -> None:
error_map = {
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -529,7 +536,7 @@ class ClusterPoolsOperations:
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@ -539,10 +546,10 @@ class ClusterPoolsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -550,6 +557,10 @@ class ClusterPoolsOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
try:
await response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
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)
@ -558,8 +569,12 @@ class ClusterPoolsOperations:
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, None, response_headers) # type: ignore
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@ -585,7 +600,7 @@ class ClusterPoolsOperations:
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_initial( # type: ignore
raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
cluster_pool_name=cluster_pool_name,
api_version=api_version,
@ -594,6 +609,7 @@ class ClusterPoolsOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@ -630,7 +646,7 @@ class ClusterPoolsOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ClusterPoolListResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -647,7 +663,6 @@ class ClusterPoolsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -663,7 +678,6 @@ class ClusterPoolsOperations:
_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
@ -711,7 +725,7 @@ class ClusterPoolsOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ClusterPoolListResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -729,7 +743,6 @@ class ClusterPoolsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -745,7 +758,6 @@ class ClusterPoolsOperations:
_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
@ -781,8 +793,8 @@ class ClusterPoolsOperations:
cluster_pool_name: str,
cluster_pool_upgrade_request: Union[_models.ClusterPoolUpgrade, IO[bytes]],
**kwargs: Any
) -> Optional[_models.ClusterPool]:
error_map = {
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -795,7 +807,7 @@ class ClusterPoolsOperations:
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)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -816,10 +828,10 @@ class ClusterPoolsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -827,18 +839,20 @@ class ClusterPoolsOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
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"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@ -945,10 +959,11 @@ class ClusterPoolsOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ClusterPool", pipeline_response)
deserialized = self._deserialize("ClusterPool", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized

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

@ -0,0 +1,145 @@
# 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.
# --------------------------------------------------------------------------
import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, 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.rest import AsyncHttpResponse, 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 ...operations._cluster_upgrade_histories_operations import build_list_request
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class ClusterUpgradeHistoriesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.hdinsightcontainers.aio.HDInsightContainersMgmtClient`'s
:attr:`cluster_upgrade_histories` 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.ClusterUpgradeHistory"]:
"""Returns a list of upgrade history.
: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 ClusterUpgradeHistory or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hdinsightcontainers.models.ClusterUpgradeHistory]
: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.ClusterUpgradeHistoryListResult] = kwargs.pop("cls", None)
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_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.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.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ClusterUpgradeHistoryListResult", 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)

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

@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import sys
from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@ -17,12 +18,13 @@ from azure.core.exceptions import (
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
StreamClosedError,
StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@ -30,7 +32,6 @@ from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._clusters_operations import (
build_create_request,
build_delete_request,
@ -41,9 +42,14 @@ from ...operations._clusters_operations import (
build_list_service_configs_request,
build_resize_request,
build_update_request,
build_upgrade_manual_rollback_request,
build_upgrade_request,
)
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@ -88,7 +94,7 @@ class ClustersOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ClusterListResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -107,7 +113,6 @@ class ClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -123,7 +128,6 @@ class ClustersOperations:
_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
@ -160,8 +164,8 @@ class ClustersOperations:
cluster_name: str,
cluster_upgrade_request: Union[_models.ClusterUpgrade, IO[bytes]],
**kwargs: Any
) -> Optional[_models.Cluster]:
error_map = {
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -174,7 +178,7 @@ class ClustersOperations:
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.Cluster]] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -196,10 +200,10 @@ class ClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -207,18 +211,20 @@ class ClustersOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
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("Cluster", pipeline_response)
if response.status_code == 202:
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@ -335,10 +341,224 @@ class ClustersOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("Cluster", pipeline_response)
deserialized = self._deserialize("Cluster", pipeline_response.http_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.Cluster].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller[_models.Cluster](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
async def _upgrade_manual_rollback_initial(
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_name: str,
cluster_rollback_upgrade_request: Union[_models.ClusterUpgradeRollback, IO[bytes]],
**kwargs: Any
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(cluster_rollback_upgrade_request, (IOBase, bytes)):
_content = cluster_rollback_upgrade_request
else:
_json = self._serialize.body(cluster_rollback_upgrade_request, "ClusterUpgradeRollback")
_request = build_upgrade_manual_rollback_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,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
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]:
try:
await response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
async def begin_upgrade_manual_rollback(
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_name: str,
cluster_rollback_upgrade_request: _models.ClusterUpgradeRollback,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.Cluster]:
"""Manual rollback upgrade for a cluster.
: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
:param cluster_rollback_upgrade_request: Manual rollback upgrade for a cluster. Required.
:type cluster_rollback_upgrade_request:
~azure.mgmt.hdinsightcontainers.models.ClusterUpgradeRollback
: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 Cluster or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hdinsightcontainers.models.Cluster]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_upgrade_manual_rollback(
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_name: str,
cluster_rollback_upgrade_request: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.Cluster]:
"""Manual rollback upgrade for a cluster.
: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
:param cluster_rollback_upgrade_request: Manual rollback upgrade for a cluster. Required.
:type cluster_rollback_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 Cluster or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hdinsightcontainers.models.Cluster]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_upgrade_manual_rollback(
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_name: str,
cluster_rollback_upgrade_request: Union[_models.ClusterUpgradeRollback, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.Cluster]:
"""Manual rollback upgrade for a cluster.
: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
:param cluster_rollback_upgrade_request: Manual rollback upgrade for a cluster. Is either a
ClusterUpgradeRollback type or a IO[bytes] type. Required.
:type cluster_rollback_upgrade_request:
~azure.mgmt.hdinsightcontainers.models.ClusterUpgradeRollback or IO[bytes]
:return: An instance of AsyncLROPoller that returns either Cluster or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hdinsightcontainers.models.Cluster]
: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.Cluster] = 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_manual_rollback_initial(
resource_group_name=resource_group_name,
cluster_pool_name=cluster_pool_name,
cluster_name=cluster_name,
cluster_rollback_upgrade_request=cluster_rollback_upgrade_request,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("Cluster", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -369,8 +589,8 @@ class ClustersOperations:
cluster_name: str,
cluster_resize_request: Union[_models.ClusterResizeData, IO[bytes]],
**kwargs: Any
) -> Optional[_models.Cluster]:
error_map = {
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -383,7 +603,7 @@ class ClustersOperations:
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.Cluster]] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -405,10 +625,10 @@ class ClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -416,18 +636,20 @@ class ClustersOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
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("Cluster", pipeline_response)
if response.status_code == 202:
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@ -544,10 +766,11 @@ class ClustersOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("Cluster", pipeline_response)
deserialized = self._deserialize("Cluster", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -588,7 +811,7 @@ class ClustersOperations:
:rtype: ~azure.mgmt.hdinsightcontainers.models.Cluster
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -611,7 +834,6 @@ class ClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -626,7 +848,7 @@ class ClustersOperations:
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("Cluster", pipeline_response)
deserialized = self._deserialize("Cluster", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -640,8 +862,8 @@ class ClustersOperations:
cluster_name: str,
hd_insight_cluster: Union[_models.Cluster, IO[bytes]],
**kwargs: Any
) -> _models.Cluster:
error_map = {
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -654,7 +876,7 @@ class ClustersOperations:
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.Cluster] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -676,10 +898,10 @@ class ClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -687,15 +909,15 @@ class ClustersOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
try:
await response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("Cluster", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("Cluster", pipeline_response)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -812,10 +1034,11 @@ class ClustersOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("Cluster", pipeline_response)
deserialized = self._deserialize("Cluster", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -847,8 +1070,8 @@ class ClustersOperations:
cluster_name: str,
cluster_patch_request: Union[_models.ClusterPatch, IO[bytes]],
**kwargs: Any
) -> _models.Cluster:
error_map = {
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -861,7 +1084,7 @@ class ClustersOperations:
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.Cluster] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -883,10 +1106,10 @@ class ClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -894,18 +1117,19 @@ class ClustersOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 200:
deserialized = self._deserialize("Cluster", pipeline_response)
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
deserialized = self._deserialize("Cluster", pipeline_response)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@ -1022,10 +1246,11 @@ class ClustersOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("Cluster", pipeline_response)
deserialized = self._deserialize("Cluster", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -1050,10 +1275,10 @@ class ClustersOperations:
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
async def _delete_initial( # pylint: disable=inconsistent-return-statements
async def _delete_initial(
self, resource_group_name: str, cluster_pool_name: str, cluster_name: str, **kwargs: Any
) -> None:
error_map = {
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -1065,7 +1290,7 @@ class ClustersOperations:
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@ -1076,10 +1301,10 @@ class ClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1087,6 +1312,10 @@ class ClustersOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
try:
await response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
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)
@ -1095,8 +1324,12 @@ class ClustersOperations:
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, None, response_headers) # type: ignore
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@ -1124,7 +1357,7 @@ class ClustersOperations:
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_initial( # type: ignore
raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
cluster_pool_name=cluster_pool_name,
cluster_name=cluster_name,
@ -1134,6 +1367,7 @@ class ClustersOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@ -1182,7 +1416,7 @@ class ClustersOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ServiceConfigListResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -1202,7 +1436,6 @@ class ClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -1218,7 +1451,6 @@ class ClustersOperations:
_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
@ -1273,7 +1505,7 @@ class ClustersOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ClusterInstanceViewsResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -1293,7 +1525,6 @@ class ClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -1309,7 +1540,6 @@ class ClustersOperations:
_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
@ -1356,7 +1586,7 @@ class ClustersOperations:
:rtype: ~azure.mgmt.hdinsightcontainers.models.ClusterInstanceViewResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -1379,7 +1609,6 @@ class ClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -1394,7 +1623,7 @@ class ClustersOperations:
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("ClusterInstanceViewResult", pipeline_response)
deserialized = self._deserialize("ClusterInstanceViewResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore

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

@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
import sys
from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
from azure.core.exceptions import (
ClientAuthenticationError,
@ -18,16 +19,18 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._locations_operations import build_check_name_availability_request
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@ -117,7 +120,7 @@ class LocationsOperations:
:rtype: ~azure.mgmt.hdinsightcontainers.models.NameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -150,7 +153,6 @@ class LocationsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -165,7 +167,7 @@ class LocationsOperations:
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("NameAvailabilityResult", pipeline_response)
deserialized = self._deserialize("NameAvailabilityResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore

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

@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@ -19,16 +20,18 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.rest import AsyncHttpResponse, 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._operations import build_list_request
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@ -67,7 +70,7 @@ class Operations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -83,7 +86,6 @@ class Operations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -99,7 +101,6 @@ class Operations:
_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

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

@ -14,14 +14,21 @@ from ._models_py3 import CatalogOptions
from ._models_py3 import Cluster
from ._models_py3 import ClusterAKSPatchVersionUpgradeProperties
from ._models_py3 import ClusterAccessProfile
from ._models_py3 import ClusterAksPatchUpgradeHistoryProperties
from ._models_py3 import ClusterAvailableInPlaceUpgradeProperties
from ._models_py3 import ClusterAvailableUpgrade
from ._models_py3 import ClusterAvailableUpgradeAksPatchUpgradeProperties
from ._models_py3 import ClusterAvailableUpgradeHotfixUpgradeProperties
from ._models_py3 import ClusterAvailableUpgradeList
from ._models_py3 import ClusterAvailableUpgradePatchVersionUpgradeProperties
from ._models_py3 import ClusterAvailableUpgradeProperties
from ._models_py3 import ClusterComponentsItem
from ._models_py3 import ClusterConfigFile
from ._models_py3 import ClusterHotfixUpgradeHistoryProperties
from ._models_py3 import ClusterHotfixUpgradeProperties
from ._models_py3 import ClusterHotfixUpgradeRollbackHistoryProperties
from ._models_py3 import ClusterInPlaceUpgradeHistoryProperties
from ._models_py3 import ClusterInPlaceUpgradeProperties
from ._models_py3 import ClusterInstanceViewProperties
from ._models_py3 import ClusterInstanceViewPropertiesStatus
from ._models_py3 import ClusterInstanceViewResult
@ -31,13 +38,22 @@ from ._models_py3 import ClusterInstanceViewsResult
from ._models_py3 import ClusterJob
from ._models_py3 import ClusterJobList
from ._models_py3 import ClusterJobProperties
from ._models_py3 import ClusterLibrary
from ._models_py3 import ClusterLibraryList
from ._models_py3 import ClusterLibraryManagementOperation
from ._models_py3 import ClusterLibraryManagementOperationProperties
from ._models_py3 import ClusterLibraryProperties
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 ClusterPatchVersionUpgradeHistoryProperties
from ._models_py3 import ClusterPatchVersionUpgradeProperties
from ._models_py3 import ClusterPatchVersionUpgradeRollbackHistoryProperties
from ._models_py3 import ClusterPool
from ._models_py3 import ClusterPoolAKSPatchVersionUpgradeProperties
from ._models_py3 import ClusterPoolAksPatchUpgradeHistoryProperties
from ._models_py3 import ClusterPoolAvailableUpgrade
from ._models_py3 import ClusterPoolAvailableUpgradeAksPatchUpgradeProperties
from ._models_py3 import ClusterPoolAvailableUpgradeList
@ -48,6 +64,7 @@ from ._models_py3 import ClusterPoolListResult
from ._models_py3 import ClusterPoolLogAnalyticsProfile
from ._models_py3 import ClusterPoolNetworkProfile
from ._models_py3 import ClusterPoolNodeOsImageUpdateProperties
from ._models_py3 import ClusterPoolNodeOsUpgradeHistoryProperties
from ._models_py3 import ClusterPoolProfile
from ._models_py3 import ClusterPoolResourceProperties
from ._models_py3 import ClusterPoolResourcePropertiesAksClusterProfile
@ -56,6 +73,9 @@ from ._models_py3 import ClusterPoolResourcePropertiesComputeProfile
from ._models_py3 import ClusterPoolResourcePropertiesLogAnalyticsProfile
from ._models_py3 import ClusterPoolResourcePropertiesNetworkProfile
from ._models_py3 import ClusterPoolUpgrade
from ._models_py3 import ClusterPoolUpgradeHistory
from ._models_py3 import ClusterPoolUpgradeHistoryListResult
from ._models_py3 import ClusterPoolUpgradeHistoryProperties
from ._models_py3 import ClusterPoolUpgradeProperties
from ._models_py3 import ClusterPoolVersion
from ._models_py3 import ClusterPoolVersionProperties
@ -69,7 +89,12 @@ from ._models_py3 import ClusterResourceProperties
from ._models_py3 import ClusterServiceConfig
from ._models_py3 import ClusterServiceConfigsProfile
from ._models_py3 import ClusterUpgrade
from ._models_py3 import ClusterUpgradeHistory
from ._models_py3 import ClusterUpgradeHistoryListResult
from ._models_py3 import ClusterUpgradeHistoryProperties
from ._models_py3 import ClusterUpgradeProperties
from ._models_py3 import ClusterUpgradeRollback
from ._models_py3 import ClusterUpgradeRollbackProperties
from ._models_py3 import ClusterVersion
from ._models_py3 import ClusterVersionProperties
from ._models_py3 import ClusterVersionsListResult
@ -90,9 +115,13 @@ from ._models_py3 import FlinkProfile
from ._models_py3 import FlinkStorageProfile
from ._models_py3 import HiveCatalogOption
from ._models_py3 import IdentityProfile
from ._models_py3 import IpTag
from ._models_py3 import KafkaConnectivityEndpoints
from ._models_py3 import KafkaProfile
from ._models_py3 import LoadBasedConfig
from ._models_py3 import ManagedIdentityProfile
from ._models_py3 import ManagedIdentitySpec
from ._models_py3 import MavenLibraryProperties
from ._models_py3 import NameAvailabilityParameters
from ._models_py3 import NameAvailabilityResult
from ._models_py3 import NodeProfile
@ -100,6 +129,7 @@ from ._models_py3 import Operation
from ._models_py3 import OperationDisplay
from ._models_py3 import OperationListResult
from ._models_py3 import ProxyResource
from ._models_py3 import PyPiLibraryProperties
from ._models_py3 import RangerAdminSpec
from ._models_py3 import RangerAdminSpecDatabase
from ._models_py3 import RangerAuditSpec
@ -141,9 +171,15 @@ 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 Category
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 ClusterPoolUpgradeHistoryType
from ._hd_insight_containers_mgmt_client_enums import ClusterPoolUpgradeHistoryUpgradeResultType
from ._hd_insight_containers_mgmt_client_enums import ClusterPoolUpgradeType
from ._hd_insight_containers_mgmt_client_enums import ClusterUpgradeHistorySeverityType
from ._hd_insight_containers_mgmt_client_enums import ClusterUpgradeHistoryType
from ._hd_insight_containers_mgmt_client_enums import ClusterUpgradeHistoryUpgradeResultType
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
@ -155,6 +191,8 @@ from ._hd_insight_containers_mgmt_client_enums import DbConnectionAuthentication
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 LibraryManagementAction
from ._hd_insight_containers_mgmt_client_enums import ManagedIdentityType
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
@ -163,6 +201,8 @@ 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 Status
from ._hd_insight_containers_mgmt_client_enums import Type
from ._hd_insight_containers_mgmt_client_enums import UpgradeMode
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
@ -177,14 +217,21 @@ __all__ = [
"Cluster",
"ClusterAKSPatchVersionUpgradeProperties",
"ClusterAccessProfile",
"ClusterAksPatchUpgradeHistoryProperties",
"ClusterAvailableInPlaceUpgradeProperties",
"ClusterAvailableUpgrade",
"ClusterAvailableUpgradeAksPatchUpgradeProperties",
"ClusterAvailableUpgradeHotfixUpgradeProperties",
"ClusterAvailableUpgradeList",
"ClusterAvailableUpgradePatchVersionUpgradeProperties",
"ClusterAvailableUpgradeProperties",
"ClusterComponentsItem",
"ClusterConfigFile",
"ClusterHotfixUpgradeHistoryProperties",
"ClusterHotfixUpgradeProperties",
"ClusterHotfixUpgradeRollbackHistoryProperties",
"ClusterInPlaceUpgradeHistoryProperties",
"ClusterInPlaceUpgradeProperties",
"ClusterInstanceViewProperties",
"ClusterInstanceViewPropertiesStatus",
"ClusterInstanceViewResult",
@ -194,13 +241,22 @@ __all__ = [
"ClusterJob",
"ClusterJobList",
"ClusterJobProperties",
"ClusterLibrary",
"ClusterLibraryList",
"ClusterLibraryManagementOperation",
"ClusterLibraryManagementOperationProperties",
"ClusterLibraryProperties",
"ClusterListResult",
"ClusterLogAnalyticsApplicationLogs",
"ClusterLogAnalyticsProfile",
"ClusterPatch",
"ClusterPatchProperties",
"ClusterPatchVersionUpgradeHistoryProperties",
"ClusterPatchVersionUpgradeProperties",
"ClusterPatchVersionUpgradeRollbackHistoryProperties",
"ClusterPool",
"ClusterPoolAKSPatchVersionUpgradeProperties",
"ClusterPoolAksPatchUpgradeHistoryProperties",
"ClusterPoolAvailableUpgrade",
"ClusterPoolAvailableUpgradeAksPatchUpgradeProperties",
"ClusterPoolAvailableUpgradeList",
@ -211,6 +267,7 @@ __all__ = [
"ClusterPoolLogAnalyticsProfile",
"ClusterPoolNetworkProfile",
"ClusterPoolNodeOsImageUpdateProperties",
"ClusterPoolNodeOsUpgradeHistoryProperties",
"ClusterPoolProfile",
"ClusterPoolResourceProperties",
"ClusterPoolResourcePropertiesAksClusterProfile",
@ -219,6 +276,9 @@ __all__ = [
"ClusterPoolResourcePropertiesLogAnalyticsProfile",
"ClusterPoolResourcePropertiesNetworkProfile",
"ClusterPoolUpgrade",
"ClusterPoolUpgradeHistory",
"ClusterPoolUpgradeHistoryListResult",
"ClusterPoolUpgradeHistoryProperties",
"ClusterPoolUpgradeProperties",
"ClusterPoolVersion",
"ClusterPoolVersionProperties",
@ -232,7 +292,12 @@ __all__ = [
"ClusterServiceConfig",
"ClusterServiceConfigsProfile",
"ClusterUpgrade",
"ClusterUpgradeHistory",
"ClusterUpgradeHistoryListResult",
"ClusterUpgradeHistoryProperties",
"ClusterUpgradeProperties",
"ClusterUpgradeRollback",
"ClusterUpgradeRollbackProperties",
"ClusterVersion",
"ClusterVersionProperties",
"ClusterVersionsListResult",
@ -253,9 +318,13 @@ __all__ = [
"FlinkStorageProfile",
"HiveCatalogOption",
"IdentityProfile",
"IpTag",
"KafkaConnectivityEndpoints",
"KafkaProfile",
"LoadBasedConfig",
"ManagedIdentityProfile",
"ManagedIdentitySpec",
"MavenLibraryProperties",
"NameAvailabilityParameters",
"NameAvailabilityResult",
"NodeProfile",
@ -263,6 +332,7 @@ __all__ = [
"OperationDisplay",
"OperationListResult",
"ProxyResource",
"PyPiLibraryProperties",
"RangerAdminSpec",
"RangerAdminSpecDatabase",
"RangerAuditSpec",
@ -303,9 +373,15 @@ __all__ = [
"Action",
"ActionType",
"AutoscaleType",
"Category",
"ClusterAvailableUpgradeType",
"ClusterPoolAvailableUpgradeType",
"ClusterPoolUpgradeHistoryType",
"ClusterPoolUpgradeHistoryUpgradeResultType",
"ClusterPoolUpgradeType",
"ClusterUpgradeHistorySeverityType",
"ClusterUpgradeHistoryType",
"ClusterUpgradeHistoryUpgradeResultType",
"ClusterUpgradeType",
"ComparisonOperator",
"ContentEncoding",
@ -317,6 +393,8 @@ __all__ = [
"DeploymentMode",
"JobType",
"KeyVaultObjectType",
"LibraryManagementAction",
"ManagedIdentityType",
"MetastoreDbConnectionAuthenticationMode",
"Origin",
"OutboundType",
@ -325,6 +403,8 @@ __all__ = [
"ScaleActionType",
"ScheduleDay",
"Severity",
"Status",
"Type",
"UpgradeMode",
]
__all__.extend([p for p in _patch_all if p not in __all__])

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

@ -42,11 +42,19 @@ class AutoscaleType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
LOAD_BASED = "LoadBased"
class Category(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Category."""
CUSTOM = "custom"
PREDEFINED = "predefined"
class ClusterAvailableUpgradeType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Type of upgrade."""
AKS_PATCH_UPGRADE = "AKSPatchUpgrade"
HOTFIX_UPGRADE = "HotfixUpgrade"
PATCH_VERSION_UPGRADE = "PatchVersionUpgrade"
class ClusterPoolAvailableUpgradeType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
@ -56,6 +64,20 @@ class ClusterPoolAvailableUpgradeType(str, Enum, metaclass=CaseInsensitiveEnumMe
NODE_OS_UPGRADE = "NodeOsUpgrade"
class ClusterPoolUpgradeHistoryType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Type of upgrade."""
AKS_PATCH_UPGRADE = "AKSPatchUpgrade"
NODE_OS_UPGRADE = "NodeOsUpgrade"
class ClusterPoolUpgradeHistoryUpgradeResultType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Result of this upgrade."""
SUCCEED = "Succeed"
FAILED = "Failed"
class ClusterPoolUpgradeType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Type of upgrade."""
@ -63,11 +85,38 @@ class ClusterPoolUpgradeType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
NODE_OS_UPGRADE = "NodeOsUpgrade"
class ClusterUpgradeHistorySeverityType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Severity of this upgrade."""
LOW = "low"
MEDIUM = "medium"
HIGH = "high"
CRITICAL = "critical"
class ClusterUpgradeHistoryType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Type of upgrade."""
AKS_PATCH_UPGRADE = "AKSPatchUpgrade"
HOTFIX_UPGRADE = "HotfixUpgrade"
HOTFIX_UPGRADE_ROLLBACK = "HotfixUpgradeRollback"
PATCH_VERSION_UPGRADE = "PatchVersionUpgrade"
PATCH_VERSION_UPGRADE_ROLLBACK = "PatchVersionUpgradeRollback"
class ClusterUpgradeHistoryUpgradeResultType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Result of this upgrade."""
SUCCEED = "Succeed"
FAILED = "Failed"
class ClusterUpgradeType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Type of upgrade."""
AKS_PATCH_UPGRADE = "AKSPatchUpgrade"
HOTFIX_UPGRADE = "HotfixUpgrade"
PATCH_VERSION_UPGRADE = "PatchVersionUpgrade"
class ComparisonOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta):
@ -157,6 +206,21 @@ class KeyVaultObjectType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
CERTIFICATE = "Certificate"
class LibraryManagementAction(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The library management action."""
INSTALL = "Install"
UNINSTALL = "Uninstall"
class ManagedIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The type of managed identity."""
CLUSTER = "cluster"
USER = "user"
INTERNAL = "internal"
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.
@ -233,6 +297,23 @@ class Severity(str, Enum, metaclass=CaseInsensitiveEnumMeta):
CRITICAL = "critical"
class Status(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Status of the library."""
INSTALLING = "INSTALLING"
INSTALLED = "INSTALLED"
INSTALL_FAILED = "INSTALL_FAILED"
UNINSTALLING = "UNINSTALLING"
UNINSTALL_FAILED = "UNINSTALL_FAILED"
class Type(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Type of the library."""
PYPI = "pypi"
MAVEN = "maven"
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.

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

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

@ -8,13 +8,16 @@
from ._cluster_pools_operations import ClusterPoolsOperations
from ._cluster_pool_available_upgrades_operations import ClusterPoolAvailableUpgradesOperations
from ._cluster_pool_upgrade_histories_operations import ClusterPoolUpgradeHistoriesOperations
from ._clusters_operations import ClustersOperations
from ._cluster_available_upgrades_operations import ClusterAvailableUpgradesOperations
from ._cluster_upgrade_histories_operations import ClusterUpgradeHistoriesOperations
from ._cluster_jobs_operations import ClusterJobsOperations
from ._locations_operations import LocationsOperations
from ._operations import Operations
from ._available_cluster_pool_versions_operations import AvailableClusterPoolVersionsOperations
from ._available_cluster_versions_operations import AvailableClusterVersionsOperations
from ._cluster_libraries_operations import ClusterLibrariesOperations
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
@ -23,13 +26,16 @@ from ._patch import patch_sdk as _patch_sdk
__all__ = [
"ClusterPoolsOperations",
"ClusterPoolAvailableUpgradesOperations",
"ClusterPoolUpgradeHistoriesOperations",
"ClustersOperations",
"ClusterAvailableUpgradesOperations",
"ClusterUpgradeHistoriesOperations",
"ClusterJobsOperations",
"LocationsOperations",
"Operations",
"AvailableClusterPoolVersionsOperations",
"AvailableClusterVersionsOperations",
"ClusterLibrariesOperations",
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()

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

@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import sys
from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
import urllib.parse
from azure.core.exceptions import (
@ -19,16 +20,18 @@ from azure.core.exceptions import (
)
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.rest import HttpRequest, HttpResponse
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
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@ -40,7 +43,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-11-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -99,7 +102,7 @@ class AvailableClusterPoolVersionsOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ClusterPoolVersionsListResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -117,7 +120,6 @@ class AvailableClusterPoolVersionsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -133,7 +135,6 @@ class AvailableClusterPoolVersionsOperations:
_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

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

@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import sys
from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
import urllib.parse
from azure.core.exceptions import (
@ -19,16 +20,18 @@ from azure.core.exceptions import (
)
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.rest import HttpRequest, HttpResponse
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
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@ -40,7 +43,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-11-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -99,7 +102,7 @@ class AvailableClusterVersionsOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ClusterVersionsListResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -117,7 +120,6 @@ class AvailableClusterVersionsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -133,7 +135,6 @@ class AvailableClusterVersionsOperations:
_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

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

@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import sys
from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
import urllib.parse
from azure.core.exceptions import (
@ -19,16 +20,18 @@ from azure.core.exceptions import (
)
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.rest import HttpRequest, HttpResponse
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
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@ -42,7 +45,7 @@ def build_list_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -114,7 +117,7 @@ class ClusterAvailableUpgradesOperations:
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 = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -134,7 +137,6 @@ class ClusterAvailableUpgradesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -150,7 +152,6 @@ class ClusterAvailableUpgradesOperations:
_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

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

@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import sys
from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@ -16,13 +17,14 @@ from azure.core.exceptions import (
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
StreamClosedError,
StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.core.rest import HttpRequest
from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@ -30,8 +32,11 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@ -45,7 +50,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-11-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -88,7 +93,7 @@ def build_list_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -144,8 +149,8 @@ class ClusterJobsOperations:
cluster_name: str,
cluster_job: Union[_models.ClusterJob, IO[bytes]],
**kwargs: Any
) -> Optional[_models.ClusterJob]:
error_map = {
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -158,7 +163,7 @@ class ClusterJobsOperations:
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.ClusterJob]] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -180,10 +185,10 @@ class ClusterJobsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -191,18 +196,20 @@ class ClusterJobsOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
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("ClusterJob", pipeline_response)
if response.status_code == 202:
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@ -314,10 +321,11 @@ class ClusterJobsOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ClusterJob", pipeline_response)
deserialized = self._deserialize("ClusterJob", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -372,7 +380,7 @@ class ClusterJobsOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ClusterJobList] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -393,7 +401,6 @@ class ClusterJobsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -409,7 +416,6 @@ class ClusterJobsOperations:
_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

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

@ -0,0 +1,442 @@
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
import sys
from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
StreamClosedError,
StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.arm_polling import ARMPolling
from .. import models as _models
from .._serialization import Serializer
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_request(
resource_group_name: str,
cluster_pool_name: str,
cluster_name: str,
subscription_id: str,
*,
category: Union[str, _models.Category],
**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", "2024-05-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}/libraries",
) # 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")
_params["$category"] = _SERIALIZER.query("category", category, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_manage_libraries_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", "2024-05-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}/clusters/{clusterName}/manageLibraries",
) # 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
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 ClusterLibrariesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.hdinsightcontainers.HDInsightContainersMgmtClient`'s
:attr:`cluster_libraries` 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,
category: Union[str, _models.Category],
**kwargs: Any
) -> Iterable["_models.ClusterLibrary"]:
"""Get all libraries of HDInsight on AKS cluster.
: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
:param category: The system query option to filter libraries returned in the response. Allowed
value is 'custom' or 'predefined'. Known values are: "custom" and "predefined". Required.
:type category: str or ~azure.mgmt.hdinsightcontainers.models.Category
:return: An iterator like instance of either ClusterLibrary or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hdinsightcontainers.models.ClusterLibrary]
: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.ClusterLibraryList] = kwargs.pop("cls", None)
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_request(
resource_group_name=resource_group_name,
cluster_pool_name=cluster_pool_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
category=category,
api_version=api_version,
headers=_headers,
params=_params,
)
_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.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ClusterLibraryList", 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)
def _manage_libraries_initial(
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_name: str,
operation: Union[_models.ClusterLibraryManagementOperation, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(operation, (IOBase, bytes)):
_content = operation
else:
_json = self._serialize.body(operation, "ClusterLibraryManagementOperation")
_request = build_manage_libraries_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,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
response_headers = {}
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
def begin_manage_libraries(
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_name: str,
operation: _models.ClusterLibraryManagementOperation,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[None]:
"""Library management operations on HDInsight on AKS cluster.
: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
:param operation: The library management operation. Required.
:type operation: ~azure.mgmt.hdinsightcontainers.models.ClusterLibraryManagementOperation
: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 None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_manage_libraries(
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_name: str,
operation: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[None]:
"""Library management operations on HDInsight on AKS cluster.
: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
:param operation: The library management operation. Required.
:type operation: 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 None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_manage_libraries(
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_name: str,
operation: Union[_models.ClusterLibraryManagementOperation, IO[bytes]],
**kwargs: Any
) -> LROPoller[None]:
"""Library management operations on HDInsight on AKS cluster.
: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
:param operation: The library management operation. Is either a
ClusterLibraryManagementOperation type or a IO[bytes] type. Required.
:type operation: ~azure.mgmt.hdinsightcontainers.models.ClusterLibraryManagementOperation or
IO[bytes]
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_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[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._manage_libraries_initial(
resource_group_name=resource_group_name,
cluster_pool_name=cluster_pool_name,
cluster_name=cluster_name,
operation=operation,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(
PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
)
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore

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

@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import sys
from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
import urllib.parse
from azure.core.exceptions import (
@ -19,16 +20,18 @@ from azure.core.exceptions import (
)
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.rest import HttpRequest, HttpResponse
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
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@ -42,7 +45,7 @@ def build_list_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -111,7 +114,7 @@ class ClusterPoolAvailableUpgradesOperations:
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 = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -130,7 +133,6 @@ class ClusterPoolAvailableUpgradesOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -146,7 +148,6 @@ class ClusterPoolAvailableUpgradesOperations:
_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

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

@ -0,0 +1,178 @@
# 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.
# --------------------------------------------------------------------------
import sys
from typing import Any, Callable, Dict, Iterable, Optional, Type, 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.rest import HttpRequest, HttpResponse
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
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_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", "2024-05-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/upgradeHistories",
) # 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 ClusterPoolUpgradeHistoriesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.hdinsightcontainers.HDInsightContainersMgmtClient`'s
:attr:`cluster_pool_upgrade_histories` 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.ClusterPoolUpgradeHistory"]:
"""Returns a list of upgrade history.
: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 ClusterPoolUpgradeHistory or the result of
cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.hdinsightcontainers.models.ClusterPoolUpgradeHistory]
: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.ClusterPoolUpgradeHistoryListResult] = kwargs.pop("cls", None)
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_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.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.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ClusterPoolUpgradeHistoryListResult", 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)

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

@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import sys
from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@ -16,13 +17,14 @@ from azure.core.exceptions import (
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
StreamClosedError,
StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.core.rest import HttpRequest
from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@ -30,8 +32,11 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@ -45,7 +50,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-11-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -78,7 +83,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-11-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -114,7 +119,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-11-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -150,7 +155,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-11-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -181,7 +186,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-11-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -205,7 +210,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-11-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -237,7 +242,7 @@ def build_upgrade_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-11-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -299,7 +304,7 @@ class ClusterPoolsOperations:
:rtype: ~azure.mgmt.hdinsightcontainers.models.ClusterPool
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -321,7 +326,6 @@ class ClusterPoolsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -336,7 +340,7 @@ class ClusterPoolsOperations:
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("ClusterPool", pipeline_response)
deserialized = self._deserialize("ClusterPool", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -349,8 +353,8 @@ class ClusterPoolsOperations:
cluster_pool_name: str,
cluster_pool: Union[_models.ClusterPool, IO[bytes]],
**kwargs: Any
) -> _models.ClusterPool:
error_map = {
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -363,7 +367,7 @@ class ClusterPoolsOperations:
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)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -384,10 +388,10 @@ class ClusterPoolsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -395,15 +399,15 @@ class ClusterPoolsOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("ClusterPool", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("ClusterPool", pipeline_response)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -510,10 +514,11 @@ class ClusterPoolsOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ClusterPool", pipeline_response)
deserialized = self._deserialize("ClusterPool", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -543,8 +548,8 @@ class ClusterPoolsOperations:
cluster_pool_name: str,
cluster_pool_tags: Union[_models.TagsObject, IO[bytes]],
**kwargs: Any
) -> _models.ClusterPool:
error_map = {
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -557,7 +562,7 @@ class ClusterPoolsOperations:
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)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -578,10 +583,10 @@ class ClusterPoolsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -589,18 +594,19 @@ class ClusterPoolsOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 200:
deserialized = self._deserialize("ClusterPool", pipeline_response)
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
deserialized = self._deserialize("ClusterPool", pipeline_response)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@ -707,10 +713,11 @@ class ClusterPoolsOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ClusterPool", pipeline_response)
deserialized = self._deserialize("ClusterPool", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -734,10 +741,8 @@ class ClusterPoolsOperations:
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
) -> None:
error_map = {
def _delete_initial(self, resource_group_name: str, cluster_pool_name: str, **kwargs: Any) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -749,7 +754,7 @@ class ClusterPoolsOperations:
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@ -759,10 +764,10 @@ class ClusterPoolsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -770,6 +775,10 @@ class ClusterPoolsOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
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)
@ -778,8 +787,12 @@ class ClusterPoolsOperations:
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, None, response_headers) # type: ignore
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_delete(self, resource_group_name: str, cluster_pool_name: str, **kwargs: Any) -> LROPoller[None]:
@ -803,7 +816,7 @@ class ClusterPoolsOperations:
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_initial( # type: ignore
raw_result = self._delete_initial(
resource_group_name=resource_group_name,
cluster_pool_name=cluster_pool_name,
api_version=api_version,
@ -812,6 +825,7 @@ class ClusterPoolsOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@ -847,7 +861,7 @@ class ClusterPoolsOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ClusterPoolListResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -864,7 +878,6 @@ class ClusterPoolsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -880,7 +893,6 @@ class ClusterPoolsOperations:
_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
@ -927,7 +939,7 @@ class ClusterPoolsOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ClusterPoolListResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -945,7 +957,6 @@ class ClusterPoolsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -961,7 +972,6 @@ class ClusterPoolsOperations:
_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
@ -997,8 +1007,8 @@ class ClusterPoolsOperations:
cluster_pool_name: str,
cluster_pool_upgrade_request: Union[_models.ClusterPoolUpgrade, IO[bytes]],
**kwargs: Any
) -> Optional[_models.ClusterPool]:
error_map = {
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -1011,7 +1021,7 @@ class ClusterPoolsOperations:
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)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -1032,10 +1042,10 @@ class ClusterPoolsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1043,18 +1053,20 @@ class ClusterPoolsOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
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"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@ -1161,10 +1173,11 @@ class ClusterPoolsOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ClusterPool", pipeline_response)
deserialized = self._deserialize("ClusterPool", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized

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

@ -0,0 +1,182 @@
# 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.
# --------------------------------------------------------------------------
import sys
from typing import Any, Callable, Dict, Iterable, Optional, Type, 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.rest import HttpRequest, HttpResponse
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
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_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", "2024-05-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}/upgradeHistories",
) # 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 ClusterUpgradeHistoriesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.hdinsightcontainers.HDInsightContainersMgmtClient`'s
:attr:`cluster_upgrade_histories` 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.ClusterUpgradeHistory"]:
"""Returns a list of upgrade history.
: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 ClusterUpgradeHistory or the result of
cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.hdinsightcontainers.models.ClusterUpgradeHistory]
: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.ClusterUpgradeHistoryListResult] = kwargs.pop("cls", None)
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_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.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.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ClusterUpgradeHistoryListResult", 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)

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

@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import sys
from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@ -16,13 +17,14 @@ from azure.core.exceptions import (
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
StreamClosedError,
StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.core.rest import HttpRequest
from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@ -30,8 +32,11 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@ -45,7 +50,7 @@ def build_list_by_cluster_pool_name_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-11-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -78,7 +83,7 @@ def build_upgrade_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-11-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -109,13 +114,50 @@ def build_upgrade_request(
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
def build_upgrade_manual_rollback_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", "2024-05-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}/clusters/{clusterName}/rollback",
) # 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"),
"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
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
def build_resize_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"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -152,7 +194,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-11-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -186,7 +228,7 @@ def build_create_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-11-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -223,7 +265,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -260,7 +302,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-11-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -294,7 +336,7 @@ def build_list_service_configs_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-11-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -328,7 +370,7 @@ def build_list_instance_views_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-11-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -362,7 +404,7 @@ def build_get_instance_view_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-11-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -430,7 +472,7 @@ class ClustersOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ClusterListResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -449,7 +491,6 @@ class ClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -465,7 +506,6 @@ class ClustersOperations:
_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
@ -502,8 +542,8 @@ class ClustersOperations:
cluster_name: str,
cluster_upgrade_request: Union[_models.ClusterUpgrade, IO[bytes]],
**kwargs: Any
) -> Optional[_models.Cluster]:
error_map = {
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -516,7 +556,7 @@ class ClustersOperations:
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.Cluster]] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -538,10 +578,10 @@ class ClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -549,18 +589,20 @@ class ClustersOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
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("Cluster", pipeline_response)
if response.status_code == 202:
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@ -674,10 +716,221 @@ class ClustersOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("Cluster", pipeline_response)
deserialized = self._deserialize("Cluster", pipeline_response.http_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.Cluster].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.Cluster](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _upgrade_manual_rollback_initial(
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_name: str,
cluster_rollback_upgrade_request: Union[_models.ClusterUpgradeRollback, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(cluster_rollback_upgrade_request, (IOBase, bytes)):
_content = cluster_rollback_upgrade_request
else:
_json = self._serialize.body(cluster_rollback_upgrade_request, "ClusterUpgradeRollback")
_request = build_upgrade_manual_rollback_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,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
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]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
def begin_upgrade_manual_rollback(
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_name: str,
cluster_rollback_upgrade_request: _models.ClusterUpgradeRollback,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.Cluster]:
"""Manual rollback upgrade for a cluster.
: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
:param cluster_rollback_upgrade_request: Manual rollback upgrade for a cluster. Required.
:type cluster_rollback_upgrade_request:
~azure.mgmt.hdinsightcontainers.models.ClusterUpgradeRollback
: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 Cluster or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hdinsightcontainers.models.Cluster]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_upgrade_manual_rollback(
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_name: str,
cluster_rollback_upgrade_request: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.Cluster]:
"""Manual rollback upgrade for a cluster.
: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
:param cluster_rollback_upgrade_request: Manual rollback upgrade for a cluster. Required.
:type cluster_rollback_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 Cluster or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hdinsightcontainers.models.Cluster]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_upgrade_manual_rollback(
self,
resource_group_name: str,
cluster_pool_name: str,
cluster_name: str,
cluster_rollback_upgrade_request: Union[_models.ClusterUpgradeRollback, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.Cluster]:
"""Manual rollback upgrade for a cluster.
: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
:param cluster_rollback_upgrade_request: Manual rollback upgrade for a cluster. Is either a
ClusterUpgradeRollback type or a IO[bytes] type. Required.
:type cluster_rollback_upgrade_request:
~azure.mgmt.hdinsightcontainers.models.ClusterUpgradeRollback or IO[bytes]
:return: An instance of LROPoller that returns either Cluster or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hdinsightcontainers.models.Cluster]
: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.Cluster] = 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_manual_rollback_initial(
resource_group_name=resource_group_name,
cluster_pool_name=cluster_pool_name,
cluster_name=cluster_name,
cluster_rollback_upgrade_request=cluster_rollback_upgrade_request,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("Cluster", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -708,8 +961,8 @@ class ClustersOperations:
cluster_name: str,
cluster_resize_request: Union[_models.ClusterResizeData, IO[bytes]],
**kwargs: Any
) -> Optional[_models.Cluster]:
error_map = {
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -722,7 +975,7 @@ class ClustersOperations:
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.Cluster]] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -744,10 +997,10 @@ class ClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -755,18 +1008,20 @@ class ClustersOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
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("Cluster", pipeline_response)
if response.status_code == 202:
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@ -880,10 +1135,11 @@ class ClustersOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("Cluster", pipeline_response)
deserialized = self._deserialize("Cluster", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -924,7 +1180,7 @@ class ClustersOperations:
:rtype: ~azure.mgmt.hdinsightcontainers.models.Cluster
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -947,7 +1203,6 @@ class ClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -962,7 +1217,7 @@ class ClustersOperations:
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("Cluster", pipeline_response)
deserialized = self._deserialize("Cluster", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -976,8 +1231,8 @@ class ClustersOperations:
cluster_name: str,
hd_insight_cluster: Union[_models.Cluster, IO[bytes]],
**kwargs: Any
) -> _models.Cluster:
error_map = {
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -990,7 +1245,7 @@ class ClustersOperations:
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.Cluster] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -1012,10 +1267,10 @@ class ClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1023,15 +1278,15 @@ class ClustersOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("Cluster", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("Cluster", pipeline_response)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@ -1145,10 +1400,11 @@ class ClustersOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("Cluster", pipeline_response)
deserialized = self._deserialize("Cluster", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -1179,8 +1435,8 @@ class ClustersOperations:
cluster_name: str,
cluster_patch_request: Union[_models.ClusterPatch, IO[bytes]],
**kwargs: Any
) -> _models.Cluster:
error_map = {
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -1193,7 +1449,7 @@ class ClustersOperations:
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.Cluster] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -1215,10 +1471,10 @@ class ClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1226,18 +1482,19 @@ class ClustersOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 200:
deserialized = self._deserialize("Cluster", pipeline_response)
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
deserialized = self._deserialize("Cluster", pipeline_response)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@ -1351,10 +1608,11 @@ class ClustersOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("Cluster", pipeline_response)
deserialized = self._deserialize("Cluster", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@ -1378,10 +1636,10 @@ class ClustersOperations:
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
def _delete_initial( # pylint: disable=inconsistent-return-statements
def _delete_initial(
self, resource_group_name: str, cluster_pool_name: str, cluster_name: str, **kwargs: Any
) -> None:
error_map = {
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -1393,7 +1651,7 @@ class ClustersOperations:
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@ -1404,10 +1662,10 @@ class ClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@ -1415,6 +1673,10 @@ class ClustersOperations:
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
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)
@ -1423,8 +1685,12 @@ class ClustersOperations:
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, None, response_headers) # type: ignore
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_delete(
@ -1452,7 +1718,7 @@ class ClustersOperations:
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_initial( # type: ignore
raw_result = self._delete_initial(
resource_group_name=resource_group_name,
cluster_pool_name=cluster_pool_name,
cluster_name=cluster_name,
@ -1462,6 +1728,7 @@ class ClustersOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@ -1509,7 +1776,7 @@ class ClustersOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ServiceConfigListResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -1529,7 +1796,6 @@ class ClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -1545,7 +1811,6 @@ class ClustersOperations:
_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
@ -1600,7 +1865,7 @@ class ClustersOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ClusterInstanceViewsResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -1620,7 +1885,6 @@ class ClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -1636,7 +1900,6 @@ class ClustersOperations:
_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
@ -1683,7 +1946,7 @@ class ClustersOperations:
:rtype: ~azure.mgmt.hdinsightcontainers.models.ClusterInstanceViewResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -1706,7 +1969,6 @@ class ClustersOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -1721,7 +1983,7 @@ class ClustersOperations:
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("ClusterInstanceViewResult", pipeline_response)
deserialized = self._deserialize("ClusterInstanceViewResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore

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

@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
import sys
from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
from azure.core.exceptions import (
ClientAuthenticationError,
@ -18,16 +19,18 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.rest import HttpRequest
from azure.core.rest import HttpRequest, HttpResponse
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
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@ -39,7 +42,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-11-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -151,7 +154,7 @@ class LocationsOperations:
:rtype: ~azure.mgmt.hdinsightcontainers.models.NameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -184,7 +187,6 @@ class LocationsOperations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@ -199,7 +201,7 @@ class LocationsOperations:
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("NameAvailabilityResult", pipeline_response)
deserialized = self._deserialize("NameAvailabilityResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore

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

@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import sys
from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
import urllib.parse
from azure.core.exceptions import (
@ -19,16 +20,18 @@ from azure.core.exceptions import (
)
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.rest import HttpRequest, HttpResponse
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
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@ -40,7 +43,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-11-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -88,7 +91,7 @@ class Operations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -104,7 +107,6 @@ class Operations:
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@ -120,7 +122,6 @@ class Operations:
_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

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

@ -1,2 +1,4 @@
-e ../../../tools/azure-sdk-tools
../../identity/azure-identity
-e ../../resources/azure-mgmt-resource
aiohttp

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

@ -0,0 +1,50 @@
# 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 cluster_upgrade_rollback.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_manual_rollback(
resource_group_name="hiloResourcegroup",
cluster_pool_name="clusterpool1",
cluster_name="cluster1",
cluster_rollback_upgrade_request={
"properties": {
"upgradeHistory": "/subscriptions/10e32bab-26da-4cc4-a441-52b318f824e6/resourceGroups/hiloResourcegroup/providers/Microsoft.HDInsight/clusterpools/clusterpool1/clusters/cluster1/upgradeHistories/01_11_2024_02_35_03_AM-HotfixUpgrade"
}
},
).result()
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2024-05-01-preview/examples/ClusterUpgradeRollback.json
if __name__ == "__main__":
main()

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

@ -75,21 +75,27 @@ def main():
},
},
"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",
"managedIdentityProfile": {
"identityList": [
{
"clientId": "de91f1d8-767f-460a-ac11-3cf103f74b34",
"objectId": "40491351-c240-4042-91e0-f644a1d2b441",
"resourceId": "/subscriptions/subid/resourceGroups/hiloResourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-msi",
"type": "cluster",
}
]
},
"ossVersion": "0.410.0",
"sshProfile": {"count": 2},
"sshProfile": {"count": 2, "vmSize": "Standard_E8as_v5"},
"trinoProfile": {},
},
"clusterType": "Trino",
"computeProfile": {
"availabilityZones": ["1", "2", "3"],
"nodes": [
{"count": 2, "type": "Head", "vmSize": "Standard_E8as_v5"},
{"count": 3, "type": "Worker", "vmSize": "Standard_E8as_v5"},
]
],
},
},
},
@ -97,6 +103,6 @@ def main():
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/CreateAutoscaleCluster.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2024-05-01-preview/examples/CreateAutoscaleCluster.json
if __name__ == "__main__":
main()

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

@ -39,13 +39,13 @@ def main():
"location": "West US 2",
"properties": {
"clusterPoolProfile": {"clusterPoolVersion": "1.2"},
"computeProfile": {"vmSize": "Standard_D3_v2"},
"computeProfile": {"availabilityZones": ["1", "2", "3"], "vmSize": "Standard_D3_v2"},
},
},
).result()
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/CreateClusterPool.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2024-05-01-preview/examples/CreateClusterPool.json
if __name__ == "__main__":
main()

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

@ -39,7 +39,7 @@ def main():
"location": "West US 2",
"properties": {
"clusterPoolProfile": {"clusterPoolVersion": "1.2"},
"computeProfile": {"vmSize": "Standard_D3_v2"},
"computeProfile": {"availabilityZones": ["1", "2", "3"], "vmSize": "Standard_D3_v2"},
"networkProfile": {
"enablePrivateApiServer": True,
"subnetId": "/subscriptions/subid/resourceGroups/hiloResourcegroup/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1",
@ -50,6 +50,6 @@ def main():
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/CreateClusterPoolWithPrivateAks.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2024-05-01-preview/examples/CreateClusterPoolWithPrivateAks.json
if __name__ == "__main__":
main()

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

@ -39,7 +39,7 @@ def main():
"location": "West US 2",
"properties": {
"clusterPoolProfile": {"clusterPoolVersion": "1.2"},
"computeProfile": {"vmSize": "Standard_D3_v2"},
"computeProfile": {"availabilityZones": ["1", "2", "3"], "vmSize": "Standard_D3_v2"},
"networkProfile": {
"outboundType": "userDefinedRouting",
"subnetId": "/subscriptions/subid/resourceGroups/hiloResourcegroup/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1",
@ -50,6 +50,6 @@ def main():
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/CreateClusterPoolWithUDRAks.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2024-05-01-preview/examples/CreateClusterPoolWithUDRAks.json
if __name__ == "__main__":
main()

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

@ -42,10 +42,15 @@ def main():
"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",
"managedIdentityProfile": {
"identityList": [
{
"clientId": "de91f1d8-767f-460a-ac11-3cf103f74b34",
"objectId": "40491351-c240-4042-91e0-f644a1d2b441",
"resourceId": "/subscriptions/subid/resourceGroups/hiloResourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-msi",
"type": "cluster",
}
]
},
"ossVersion": "2.2.3",
"rangerProfile": {
@ -68,13 +73,16 @@ def main():
},
},
"clusterType": "ranger",
"computeProfile": {"nodes": [{"count": 2, "type": "head", "vmSize": "Standard_D3_v2"}]},
"computeProfile": {
"availabilityZones": ["1", "2", "3"],
"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
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2024-05-01-preview/examples/CreateRangerCluster.json
if __name__ == "__main__":
main()

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

@ -42,10 +42,15 @@ def main():
"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",
"managedIdentityProfile": {
"identityList": [
{
"clientId": "de91f1d8-767f-460a-ac11-3cf103f74b34",
"objectId": "40491351-c240-4042-91e0-f644a1d2b441",
"resourceId": "/subscriptions/subid/resourceGroups/hiloResourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-msi",
"type": "cluster",
}
]
},
"ossVersion": "2.2.3",
"serviceConfigsProfiles": [
@ -86,16 +91,19 @@ def main():
},
],
"sparkProfile": {},
"sshProfile": {"count": 2},
"sshProfile": {"count": 2, "vmSize": "Standard_D3_v2"},
},
"clusterType": "spark",
"computeProfile": {"nodes": [{"count": 4, "type": "worker", "vmSize": "Standard_D3_v2"}]},
"computeProfile": {
"availabilityZones": ["1", "2", "3"],
"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/CreateSparkCluster.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2024-05-01-preview/examples/CreateSparkCluster.json
if __name__ == "__main__":
main()

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

@ -43,10 +43,15 @@ def main():
"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",
"managedIdentityProfile": {
"identityList": [
{
"clientId": "de91f1d8-767f-460a-ac11-3cf103f74b34",
"objectId": "40491351-c240-4042-91e0-f644a1d2b441",
"resourceId": "/subscriptions/subid/resourceGroups/hiloResourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-msi",
"type": "cluster",
}
]
},
"ossVersion": "2.2.3",
"serviceConfigsProfiles": [
@ -87,16 +92,19 @@ def main():
},
],
"sparkProfile": {},
"sshProfile": {"count": 2},
"sshProfile": {"count": 2, "vmSize": "Standard_D3_v2"},
},
"clusterType": "spark",
"computeProfile": {"nodes": [{"count": 4, "type": "worker", "vmSize": "Standard_D3_v2"}]},
"computeProfile": {
"availabilityZones": ["1", "2", "3"],
"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
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2024-05-01-preview/examples/CreateSparkClusterWithInternalIngress.json
if __name__ == "__main__":
main()

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

@ -37,6 +37,6 @@ def main():
).result()
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/DeleteCluster.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2024-05-01-preview/examples/DeleteCluster.json
if __name__ == "__main__":
main()

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

@ -36,6 +36,6 @@ def main():
).result()
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/DeleteClusterPool.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2024-05-01-preview/examples/DeleteClusterPool.json
if __name__ == "__main__":
main()

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

@ -38,6 +38,6 @@ def main():
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/GetCluster.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2024-05-01-preview/examples/GetCluster.json
if __name__ == "__main__":
main()

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

@ -38,6 +38,6 @@ def main():
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/GetClusterInstanceView.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2024-05-01-preview/examples/GetClusterInstanceView.json
if __name__ == "__main__":
main()

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

@ -37,6 +37,6 @@ def main():
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/GetClusterPool.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2024-05-01-preview/examples/GetClusterPool.json
if __name__ == "__main__":
main()

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

@ -35,6 +35,6 @@ def main():
print(item)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/GetOperations.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2024-05-01-preview/examples/GetOperations.json
if __name__ == "__main__":
main()

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

@ -0,0 +1,68 @@
# 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 install_new_cluster_libraries.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="00000000-0000-0000-0000-000000000000",
)
client.cluster_libraries.begin_manage_libraries(
resource_group_name="hiloResourceGroup",
cluster_pool_name="clusterPool",
cluster_name="cluster",
operation={
"properties": {
"action": "Install",
"libraries": [
{
"properties": {
"name": "requests",
"remarks": "PyPi packages.",
"type": "pypi",
"version": "2.31.0",
}
},
{
"properties": {
"groupId": "org.apache.flink",
"name": "flink-connector-kafka",
"remarks": "Maven packages.",
"type": "maven",
"version": "3.0.2-1.18",
}
},
],
}
},
).result()
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2024-05-01-preview/examples/InstallNewClusterLibraries.json
if __name__ == "__main__":
main()

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

@ -37,6 +37,6 @@ def main():
print(item)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/ListAvailableClusterPoolVersions.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2024-05-01-preview/examples/ListAvailableClusterPoolVersions.json
if __name__ == "__main__":
main()

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

@ -37,6 +37,6 @@ def main():
print(item)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/ListAvailableClusterVersions.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2024-05-01-preview/examples/ListAvailableClusterVersions.json
if __name__ == "__main__":
main()

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

@ -39,6 +39,6 @@ def main():
print(item)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/ListClusterAvailableUpgrades.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2024-05-01-preview/examples/ListClusterAvailableUpgrades.json
if __name__ == "__main__":
main()

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

@ -39,6 +39,6 @@ def main():
print(item)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/ListClusterInstanceViews.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2024-05-01-preview/examples/ListClusterInstanceViews.json
if __name__ == "__main__":
main()

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

@ -39,6 +39,6 @@ def main():
print(item)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/ListClusterJobs.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2024-05-01-preview/examples/ListClusterJobs.json
if __name__ == "__main__":
main()

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

@ -38,6 +38,6 @@ def main():
print(item)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/ListClusterPoolAvailableUpgrades.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2024-05-01-preview/examples/ListClusterPoolAvailableUpgrades.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_upgrade_history.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_upgrade_histories.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/2024-05-01-preview/examples/ListClusterPoolUpgradeHistory.json
if __name__ == "__main__":
main()

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

@ -37,6 +37,6 @@ def main():
print(item)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/ListClusterPools.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2024-05-01-preview/examples/ListClusterPools.json
if __name__ == "__main__":
main()

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

@ -35,6 +35,6 @@ def main():
print(item)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/ListClusterPoolsSubscription.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2024-05-01-preview/examples/ListClusterPoolsSubscription.json
if __name__ == "__main__":
main()

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

@ -39,6 +39,6 @@ def main():
print(item)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/ListClusterServiceConfigs.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2024-05-01-preview/examples/ListClusterServiceConfigs.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_upgrade_history.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_upgrade_histories.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/2024-05-01-preview/examples/ListClusterUpgradeHistory.json
if __name__ == "__main__":
main()

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

@ -38,6 +38,6 @@ def main():
print(item)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/ListClustersByClusterPoolName.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2024-05-01-preview/examples/ListClustersByClusterPoolName.json
if __name__ == "__main__":
main()

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

@ -39,6 +39,6 @@ def main():
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/LocationsNameAvailability.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2024-05-01-preview/examples/LocationsNameAvailability.json
if __name__ == "__main__":
main()

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

@ -110,6 +110,6 @@ def main():
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/PatchCluster.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2024-05-01-preview/examples/PatchCluster.json
if __name__ == "__main__":
main()

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

@ -40,6 +40,6 @@ def main():
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/PatchClusterPool.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2024-05-01-preview/examples/PatchClusterPool.json
if __name__ == "__main__":
main()

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

@ -64,6 +64,6 @@ def main():
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/PatchRangerCluster.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2024-05-01-preview/examples/PatchRangerCluster.json
if __name__ == "__main__":
main()

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

@ -41,6 +41,6 @@ def main():
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/ResizeCluster.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2024-05-01-preview/examples/ResizeCluster.json
if __name__ == "__main__":
main()

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

@ -54,6 +54,6 @@ def main():
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/RunClusterJob.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2024-05-01-preview/examples/RunClusterJob.json
if __name__ == "__main__":
main()

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

@ -0,0 +1,53 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from 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 uninstall_existing_cluster_libraries.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="00000000-0000-0000-0000-000000000000",
)
client.cluster_libraries.begin_manage_libraries(
resource_group_name="hiloResourceGroup",
cluster_pool_name="clusterPool",
cluster_name="cluster",
operation={
"properties": {
"action": "Uninstall",
"libraries": [
{"properties": {"name": "tensorflow", "type": "pypi"}},
{"properties": {"groupId": "org.apache.flink", "name": "flink-connector-hudi", "type": "maven"}},
],
}
},
).result()
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2024-05-01-preview/examples/UninstallExistingClusterLibraries.json
if __name__ == "__main__":
main()

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

@ -41,6 +41,6 @@ def main():
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/UpgradeAKSPatchVersionForCluster.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2024-05-01-preview/examples/UpgradeAKSPatchVersionForCluster.json
if __name__ == "__main__":
main()

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

@ -46,6 +46,6 @@ def main():
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/UpgradeAKSPatchVersionForClusterPool.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2024-05-01-preview/examples/UpgradeAKSPatchVersionForClusterPool.json
if __name__ == "__main__":
main()

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

@ -49,6 +49,6 @@ def main():
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/UpgradeHotfixForCluster.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2024-05-01-preview/examples/UpgradeHotfixForCluster.json
if __name__ == "__main__":
main()

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

@ -40,6 +40,6 @@ def main():
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/UpgradeNodeOsForClusterPool.json
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2024-05-01-preview/examples/UpgradeNodeOsForClusterPool.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.
# --------------------------------------------------------------------------
import os
import pytest
from dotenv import load_dotenv
from devtools_testutils import (
test_proxy,
add_general_regex_sanitizer,
add_body_key_sanitizer,
add_header_regex_sanitizer,
)
load_dotenv()
# aovid record sensitive identity information in recordings
@pytest.fixture(scope="session", autouse=True)
def add_sanitizers(test_proxy):
hdinsightcontainersmgmt_subscription_id = os.environ.get(
"AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000"
)
hdinsightcontainersmgmt_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000")
hdinsightcontainersmgmt_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000")
hdinsightcontainersmgmt_client_secret = os.environ.get(
"AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000"
)
add_general_regex_sanitizer(
regex=hdinsightcontainersmgmt_subscription_id, value="00000000-0000-0000-0000-000000000000"
)
add_general_regex_sanitizer(regex=hdinsightcontainersmgmt_tenant_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=hdinsightcontainersmgmt_client_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(
regex=hdinsightcontainersmgmt_client_secret, value="00000000-0000-0000-0000-000000000000"
)
add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]")
add_header_regex_sanitizer(key="Cookie", value="cookie;")
add_body_key_sanitizer(json_path="$..access_token", value="access_token")

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

@ -0,0 +1,30 @@
# 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.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
AZURE_LOCATION = "eastus"
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestHDInsightContainersMgmtAvailableClusterPoolVersionsOperations(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(HDInsightContainersMgmtClient)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_list_by_location(self, resource_group):
response = self.client.available_cluster_pool_versions.list_by_location(
location="str",
api_version="2024-05-01-preview",
)
result = [r for r in response]
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,31 @@
# 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.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.hdinsightcontainers.aio import HDInsightContainersMgmtClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
from devtools_testutils.aio import recorded_by_proxy_async
AZURE_LOCATION = "eastus"
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestHDInsightContainersMgmtAvailableClusterPoolVersionsOperationsAsync(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(HDInsightContainersMgmtClient, is_async=True)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_list_by_location(self, resource_group):
response = self.client.available_cluster_pool_versions.list_by_location(
location="str",
api_version="2024-05-01-preview",
)
result = [r async for r in response]
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,30 @@
# 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.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
AZURE_LOCATION = "eastus"
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestHDInsightContainersMgmtAvailableClusterVersionsOperations(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(HDInsightContainersMgmtClient)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_list_by_location(self, resource_group):
response = self.client.available_cluster_versions.list_by_location(
location="str",
api_version="2024-05-01-preview",
)
result = [r for r in response]
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,31 @@
# 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.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.hdinsightcontainers.aio import HDInsightContainersMgmtClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
from devtools_testutils.aio import recorded_by_proxy_async
AZURE_LOCATION = "eastus"
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestHDInsightContainersMgmtAvailableClusterVersionsOperationsAsync(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(HDInsightContainersMgmtClient, is_async=True)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_list_by_location(self, resource_group):
response = self.client.available_cluster_versions.list_by_location(
location="str",
api_version="2024-05-01-preview",
)
result = [r async for r in response]
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,32 @@
# 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.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
AZURE_LOCATION = "eastus"
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestHDInsightContainersMgmtClusterAvailableUpgradesOperations(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(HDInsightContainersMgmtClient)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_list(self, resource_group):
response = self.client.cluster_available_upgrades.list(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_name="str",
api_version="2024-05-01-preview",
)
result = [r for r in response]
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,33 @@
# 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.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.hdinsightcontainers.aio import HDInsightContainersMgmtClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
from devtools_testutils.aio import recorded_by_proxy_async
AZURE_LOCATION = "eastus"
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestHDInsightContainersMgmtClusterAvailableUpgradesOperationsAsync(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(HDInsightContainersMgmtClient, is_async=True)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_list(self, resource_group):
response = self.client.cluster_available_upgrades.list(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_name="str",
api_version="2024-05-01-preview",
)
result = [r async for r in response]
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,59 @@
# 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.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
AZURE_LOCATION = "eastus"
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestHDInsightContainersMgmtClusterJobsOperations(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(HDInsightContainersMgmtClient)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_begin_run_job(self, resource_group):
response = self.client.cluster_jobs.begin_run_job(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_name="str",
cluster_job={
"properties": "cluster_job_properties",
"id": "str",
"name": "str",
"systemData": {
"createdAt": "2020-02-20 00:00:00",
"createdBy": "str",
"createdByType": "str",
"lastModifiedAt": "2020-02-20 00:00:00",
"lastModifiedBy": "str",
"lastModifiedByType": "str",
},
"type": "str",
},
api_version="2024-05-01-preview",
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_list(self, resource_group):
response = self.client.cluster_jobs.list(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_name="str",
api_version="2024-05-01-preview",
)
result = [r for r in response]
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,62 @@
# 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.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.hdinsightcontainers.aio import HDInsightContainersMgmtClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
from devtools_testutils.aio import recorded_by_proxy_async
AZURE_LOCATION = "eastus"
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestHDInsightContainersMgmtClusterJobsOperationsAsync(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(HDInsightContainersMgmtClient, is_async=True)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_begin_run_job(self, resource_group):
response = await (
await self.client.cluster_jobs.begin_run_job(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_name="str",
cluster_job={
"properties": "cluster_job_properties",
"id": "str",
"name": "str",
"systemData": {
"createdAt": "2020-02-20 00:00:00",
"createdBy": "str",
"createdByType": "str",
"lastModifiedAt": "2020-02-20 00:00:00",
"lastModifiedBy": "str",
"lastModifiedByType": "str",
},
"type": "str",
},
api_version="2024-05-01-preview",
)
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_list(self, resource_group):
response = self.client.cluster_jobs.list(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_name="str",
api_version="2024-05-01-preview",
)
result = [r async for r in response]
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,78 @@
# 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.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
AZURE_LOCATION = "eastus"
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestHDInsightContainersMgmtClusterLibrariesOperations(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(HDInsightContainersMgmtClient)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_list(self, resource_group):
response = self.client.cluster_libraries.list(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_name="str",
category="str",
api_version="2024-05-01-preview",
)
result = [r for r in response]
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_begin_manage_libraries(self, resource_group):
response = self.client.cluster_libraries.begin_manage_libraries(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_name="str",
operation={
"properties": {
"action": "str",
"libraries": [
{
"properties": "cluster_library_properties",
"id": "str",
"name": "str",
"systemData": {
"createdAt": "2020-02-20 00:00:00",
"createdBy": "str",
"createdByType": "str",
"lastModifiedAt": "2020-02-20 00:00:00",
"lastModifiedBy": "str",
"lastModifiedByType": "str",
},
"type": "str",
}
],
},
"id": "str",
"name": "str",
"systemData": {
"createdAt": "2020-02-20 00:00:00",
"createdBy": "str",
"createdByType": "str",
"lastModifiedAt": "2020-02-20 00:00:00",
"lastModifiedBy": "str",
"lastModifiedByType": "str",
},
"type": "str",
},
api_version="2024-05-01-preview",
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,81 @@
# 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.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.hdinsightcontainers.aio import HDInsightContainersMgmtClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
from devtools_testutils.aio import recorded_by_proxy_async
AZURE_LOCATION = "eastus"
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestHDInsightContainersMgmtClusterLibrariesOperationsAsync(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(HDInsightContainersMgmtClient, is_async=True)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_list(self, resource_group):
response = self.client.cluster_libraries.list(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_name="str",
category="str",
api_version="2024-05-01-preview",
)
result = [r async for r in response]
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_begin_manage_libraries(self, resource_group):
response = await (
await self.client.cluster_libraries.begin_manage_libraries(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_name="str",
operation={
"properties": {
"action": "str",
"libraries": [
{
"properties": "cluster_library_properties",
"id": "str",
"name": "str",
"systemData": {
"createdAt": "2020-02-20 00:00:00",
"createdBy": "str",
"createdByType": "str",
"lastModifiedAt": "2020-02-20 00:00:00",
"lastModifiedBy": "str",
"lastModifiedByType": "str",
},
"type": "str",
}
],
},
"id": "str",
"name": "str",
"systemData": {
"createdAt": "2020-02-20 00:00:00",
"createdBy": "str",
"createdByType": "str",
"lastModifiedAt": "2020-02-20 00:00:00",
"lastModifiedBy": "str",
"lastModifiedByType": "str",
},
"type": "str",
},
api_version="2024-05-01-preview",
)
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,31 @@
# 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.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
AZURE_LOCATION = "eastus"
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestHDInsightContainersMgmtClusterPoolAvailableUpgradesOperations(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(HDInsightContainersMgmtClient)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_list(self, resource_group):
response = self.client.cluster_pool_available_upgrades.list(
resource_group_name=resource_group.name,
cluster_pool_name="str",
api_version="2024-05-01-preview",
)
result = [r for r in response]
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,32 @@
# 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.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.hdinsightcontainers.aio import HDInsightContainersMgmtClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
from devtools_testutils.aio import recorded_by_proxy_async
AZURE_LOCATION = "eastus"
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestHDInsightContainersMgmtClusterPoolAvailableUpgradesOperationsAsync(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(HDInsightContainersMgmtClient, is_async=True)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_list(self, resource_group):
response = self.client.cluster_pool_available_upgrades.list(
resource_group_name=resource_group.name,
cluster_pool_name="str",
api_version="2024-05-01-preview",
)
result = [r async for r in response]
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,31 @@
# 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.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
AZURE_LOCATION = "eastus"
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestHDInsightContainersMgmtClusterPoolUpgradeHistoriesOperations(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(HDInsightContainersMgmtClient)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_list(self, resource_group):
response = self.client.cluster_pool_upgrade_histories.list(
resource_group_name=resource_group.name,
cluster_pool_name="str",
api_version="2024-05-01-preview",
)
result = [r for r in response]
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,32 @@
# 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.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.hdinsightcontainers.aio import HDInsightContainersMgmtClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
from devtools_testutils.aio import recorded_by_proxy_async
AZURE_LOCATION = "eastus"
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestHDInsightContainersMgmtClusterPoolUpgradeHistoriesOperationsAsync(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(HDInsightContainersMgmtClient, is_async=True)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_list(self, resource_group):
response = self.client.cluster_pool_upgrade_histories.list(
resource_group_name=resource_group.name,
cluster_pool_name="str",
api_version="2024-05-01-preview",
)
result = [r async for r in response]
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,145 @@
# 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.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
AZURE_LOCATION = "eastus"
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestHDInsightContainersMgmtClusterPoolsOperations(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(HDInsightContainersMgmtClient)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_get(self, resource_group):
response = self.client.cluster_pools.get(
resource_group_name=resource_group.name,
cluster_pool_name="str",
api_version="2024-05-01-preview",
)
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_begin_create_or_update(self, resource_group):
response = self.client.cluster_pools.begin_create_or_update(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_pool={
"location": "str",
"id": "str",
"name": "str",
"properties": {
"computeProfile": {"vmSize": "str", "availabilityZones": ["str"], "count": 0},
"aksClusterProfile": {
"aksClusterAgentPoolIdentityProfile": {
"msiClientId": "str",
"msiObjectId": "str",
"msiResourceId": "str",
},
"aksClusterResourceId": "str",
"aksVersion": "str",
},
"aksManagedResourceGroupName": "str",
"clusterPoolProfile": {
"clusterPoolVersion": "str",
"publicIpTag": {"ipTagType": "str", "tag": "str"},
},
"deploymentId": "str",
"logAnalyticsProfile": {"enabled": bool, "workspaceId": "str"},
"managedResourceGroupName": "str",
"networkProfile": {
"subnetId": "str",
"apiServerAuthorizedIpRanges": ["str"],
"enablePrivateApiServer": bool,
"outboundType": "loadBalancer",
},
"provisioningState": "str",
"status": "str",
},
"systemData": {
"createdAt": "2020-02-20 00:00:00",
"createdBy": "str",
"createdByType": "str",
"lastModifiedAt": "2020-02-20 00:00:00",
"lastModifiedBy": "str",
"lastModifiedByType": "str",
},
"tags": {"str": "str"},
"type": "str",
},
api_version="2024-05-01-preview",
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_begin_update_tags(self, resource_group):
response = self.client.cluster_pools.begin_update_tags(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_pool_tags={"tags": {"str": "str"}},
api_version="2024-05-01-preview",
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_begin_delete(self, resource_group):
response = self.client.cluster_pools.begin_delete(
resource_group_name=resource_group.name,
cluster_pool_name="str",
api_version="2024-05-01-preview",
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_list_by_subscription(self, resource_group):
response = self.client.cluster_pools.list_by_subscription(
api_version="2024-05-01-preview",
)
result = [r for r in response]
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_list_by_resource_group(self, resource_group):
response = self.client.cluster_pools.list_by_resource_group(
resource_group_name=resource_group.name,
api_version="2024-05-01-preview",
)
result = [r for r in response]
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_begin_upgrade(self, resource_group):
response = self.client.cluster_pools.begin_upgrade(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_pool_upgrade_request={"properties": "cluster_pool_upgrade_properties"},
api_version="2024-05-01-preview",
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,154 @@
# 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.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.hdinsightcontainers.aio import HDInsightContainersMgmtClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
from devtools_testutils.aio import recorded_by_proxy_async
AZURE_LOCATION = "eastus"
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestHDInsightContainersMgmtClusterPoolsOperationsAsync(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(HDInsightContainersMgmtClient, is_async=True)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_get(self, resource_group):
response = await self.client.cluster_pools.get(
resource_group_name=resource_group.name,
cluster_pool_name="str",
api_version="2024-05-01-preview",
)
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_begin_create_or_update(self, resource_group):
response = await (
await self.client.cluster_pools.begin_create_or_update(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_pool={
"location": "str",
"id": "str",
"name": "str",
"properties": {
"computeProfile": {"vmSize": "str", "availabilityZones": ["str"], "count": 0},
"aksClusterProfile": {
"aksClusterAgentPoolIdentityProfile": {
"msiClientId": "str",
"msiObjectId": "str",
"msiResourceId": "str",
},
"aksClusterResourceId": "str",
"aksVersion": "str",
},
"aksManagedResourceGroupName": "str",
"clusterPoolProfile": {
"clusterPoolVersion": "str",
"publicIpTag": {"ipTagType": "str", "tag": "str"},
},
"deploymentId": "str",
"logAnalyticsProfile": {"enabled": bool, "workspaceId": "str"},
"managedResourceGroupName": "str",
"networkProfile": {
"subnetId": "str",
"apiServerAuthorizedIpRanges": ["str"],
"enablePrivateApiServer": bool,
"outboundType": "loadBalancer",
},
"provisioningState": "str",
"status": "str",
},
"systemData": {
"createdAt": "2020-02-20 00:00:00",
"createdBy": "str",
"createdByType": "str",
"lastModifiedAt": "2020-02-20 00:00:00",
"lastModifiedBy": "str",
"lastModifiedByType": "str",
},
"tags": {"str": "str"},
"type": "str",
},
api_version="2024-05-01-preview",
)
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_begin_update_tags(self, resource_group):
response = await (
await self.client.cluster_pools.begin_update_tags(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_pool_tags={"tags": {"str": "str"}},
api_version="2024-05-01-preview",
)
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_begin_delete(self, resource_group):
response = await (
await self.client.cluster_pools.begin_delete(
resource_group_name=resource_group.name,
cluster_pool_name="str",
api_version="2024-05-01-preview",
)
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_list_by_subscription(self, resource_group):
response = self.client.cluster_pools.list_by_subscription(
api_version="2024-05-01-preview",
)
result = [r async for r in response]
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_list_by_resource_group(self, resource_group):
response = self.client.cluster_pools.list_by_resource_group(
resource_group_name=resource_group.name,
api_version="2024-05-01-preview",
)
result = [r async for r in response]
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_begin_upgrade(self, resource_group):
response = await (
await self.client.cluster_pools.begin_upgrade(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_pool_upgrade_request={"properties": "cluster_pool_upgrade_properties"},
api_version="2024-05-01-preview",
)
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,32 @@
# 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.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
AZURE_LOCATION = "eastus"
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestHDInsightContainersMgmtClusterUpgradeHistoriesOperations(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(HDInsightContainersMgmtClient)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_list(self, resource_group):
response = self.client.cluster_upgrade_histories.list(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_name="str",
api_version="2024-05-01-preview",
)
result = [r for r in response]
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,33 @@
# 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.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.hdinsightcontainers.aio import HDInsightContainersMgmtClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
from devtools_testutils.aio import recorded_by_proxy_async
AZURE_LOCATION = "eastus"
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestHDInsightContainersMgmtClusterUpgradeHistoriesOperationsAsync(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(HDInsightContainersMgmtClient, is_async=True)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_list(self, resource_group):
response = self.client.cluster_upgrade_histories.list(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_name="str",
api_version="2024-05-01-preview",
)
result = [r async for r in response]
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,503 @@
# 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.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
AZURE_LOCATION = "eastus"
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestHDInsightContainersMgmtClustersOperations(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(HDInsightContainersMgmtClient)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_list_by_cluster_pool_name(self, resource_group):
response = self.client.clusters.list_by_cluster_pool_name(
resource_group_name=resource_group.name,
cluster_pool_name="str",
api_version="2024-05-01-preview",
)
result = [r for r in response]
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_begin_upgrade(self, resource_group):
response = self.client.clusters.begin_upgrade(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_name="str",
cluster_upgrade_request={"properties": "cluster_upgrade_properties"},
api_version="2024-05-01-preview",
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_begin_upgrade_manual_rollback(self, resource_group):
response = self.client.clusters.begin_upgrade_manual_rollback(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_name="str",
cluster_rollback_upgrade_request={"properties": {"upgradeHistory": "str"}},
api_version="2024-05-01-preview",
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_begin_resize(self, resource_group):
response = self.client.clusters.begin_resize(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_name="str",
cluster_resize_request={
"location": "str",
"id": "str",
"name": "str",
"properties": {"targetWorkerNodeCount": 0},
"systemData": {
"createdAt": "2020-02-20 00:00:00",
"createdBy": "str",
"createdByType": "str",
"lastModifiedAt": "2020-02-20 00:00:00",
"lastModifiedBy": "str",
"lastModifiedByType": "str",
},
"tags": {"str": "str"},
"type": "str",
},
api_version="2024-05-01-preview",
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_get(self, resource_group):
response = self.client.clusters.get(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_name="str",
api_version="2024-05-01-preview",
)
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_begin_create(self, resource_group):
response = self.client.clusters.begin_create(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_name="str",
hd_insight_cluster={
"location": "str",
"id": "str",
"name": "str",
"properties": {
"clusterProfile": {
"authorizationProfile": {"groupIds": ["str"], "userIds": ["str"]},
"clusterVersion": "str",
"ossVersion": "str",
"autoscaleProfile": {
"enabled": bool,
"autoscaleType": "str",
"gracefulDecommissionTimeout": 0,
"loadBasedConfig": {
"maxNodes": 0,
"minNodes": 0,
"scalingRules": [
{
"actionType": "str",
"comparisonRule": {"operator": "str", "threshold": 0.0},
"evaluationCount": 0,
"scalingMetric": "str",
}
],
"cooldownPeriod": 0,
"pollInterval": 0,
},
"scheduleBasedConfig": {
"defaultCount": 0,
"schedules": [{"count": 0, "days": ["str"], "endTime": "str", "startTime": "str"}],
"timeZone": "str",
},
},
"clusterAccessProfile": {"enableInternalIngress": bool, "privateLinkServiceId": "str"},
"components": [{"name": "str", "version": "str"}],
"connectivityProfile": {
"web": {"fqdn": "str", "privateFqdn": "str"},
"ssh": [{"endpoint": "str", "privateSshEndpoint": "str"}],
},
"flinkProfile": {
"jobManager": {"cpu": 0.0, "memory": 0},
"storage": {"storageUri": "str", "storagekey": "str"},
"taskManager": {"cpu": 0.0, "memory": 0},
"catalogOptions": {
"hive": {
"metastoreDbConnectionURL": "str",
"metastoreDbConnectionAuthenticationMode": "str",
"metastoreDbConnectionPasswordSecret": "str",
"metastoreDbConnectionUserName": "str",
}
},
"deploymentMode": "str",
"historyServer": {"cpu": 0.0, "memory": 0},
"jobSpec": {
"jarName": "str",
"jobJarDirectory": "str",
"upgradeMode": "str",
"args": "str",
"entryClass": "str",
"savePointName": "str",
},
"numReplicas": 0,
},
"identityProfile": {"msiClientId": "str", "msiObjectId": "str", "msiResourceId": "str"},
"kafkaProfile": {
"diskStorage": {"dataDiskSize": 0, "dataDiskType": "str"},
"connectivityEndpoints": {"bootstrapServerEndpoint": "str", "brokerEndpoints": ["str"]},
"enableKRaft": True,
"enablePublicEndpoints": False,
"remoteStorageUri": "str",
},
"llapProfile": {"str": {}},
"logAnalyticsProfile": {
"enabled": bool,
"applicationLogs": {"stdErrorEnabled": bool, "stdOutEnabled": bool},
"metricsEnabled": bool,
},
"managedIdentityProfile": {
"identityList": [{"clientId": "str", "objectId": "str", "resourceId": "str", "type": "str"}]
},
"prometheusProfile": {"enabled": False},
"rangerPluginProfile": {"enabled": False},
"rangerProfile": {
"rangerAdmin": {
"admins": ["str"],
"database": {
"host": "str",
"name": "str",
"passwordSecretRef": "str",
"username": "str",
},
},
"rangerUsersync": {
"enabled": True,
"groups": ["str"],
"mode": "automatic",
"userMappingLocation": "str",
"users": ["str"],
},
"rangerAudit": {"storageAccount": "str"},
},
"scriptActionProfiles": [
{
"name": "str",
"services": ["str"],
"type": "str",
"url": "str",
"parameters": "str",
"shouldPersist": True,
"timeoutInMinutes": 0,
}
],
"secretsProfile": {
"keyVaultResourceId": "str",
"secrets": [
{"keyVaultObjectName": "str", "referenceName": "str", "type": "str", "version": "str"}
],
},
"serviceConfigsProfiles": [
{
"configs": [
{
"component": "str",
"files": [
{
"fileName": "str",
"content": "str",
"encoding": "str",
"path": "str",
"values": {"str": "str"},
}
],
}
],
"serviceName": "str",
}
],
"sparkProfile": {
"defaultStorageUrl": "str",
"metastoreSpec": {
"dbName": "str",
"dbServerHost": "str",
"dbConnectionAuthenticationMode": "IdentityAuth",
"dbPasswordSecretName": "str",
"dbUserName": "str",
"keyVaultId": "str",
"thriftUrl": "str",
},
"userPluginsSpec": {"plugins": [{"path": "str"}]},
},
"sshProfile": {"count": 0, "podPrefix": "str", "vmSize": "str"},
"stubProfile": {"str": {}},
"trinoProfile": {
"catalogOptions": {
"hive": [
{
"catalogName": "str",
"metastoreDbConnectionURL": "str",
"metastoreWarehouseDir": "str",
"metastoreDbConnectionAuthenticationMode": "str",
"metastoreDbConnectionPasswordSecret": "str",
"metastoreDbConnectionUserName": "str",
}
]
},
"coordinator": {
"debug": {"enable": False, "port": 8008, "suspend": False},
"highAvailabilityEnabled": True,
},
"userPluginsSpec": {"plugins": [{"enabled": bool, "name": "str", "path": "str"}]},
"userTelemetrySpec": {
"storage": {
"hivecatalogName": "str",
"hivecatalogSchema": "trinologs",
"partitionRetentionInDays": 365,
"path": "str",
}
},
"worker": {"debug": {"enable": False, "port": 8008, "suspend": False}},
},
},
"clusterType": "str",
"computeProfile": {
"nodes": [{"count": 0, "type": "str", "vmSize": "str"}],
"availabilityZones": ["str"],
},
"deploymentId": "str",
"provisioningState": "str",
"status": "str",
},
"systemData": {
"createdAt": "2020-02-20 00:00:00",
"createdBy": "str",
"createdByType": "str",
"lastModifiedAt": "2020-02-20 00:00:00",
"lastModifiedBy": "str",
"lastModifiedByType": "str",
},
"tags": {"str": "str"},
"type": "str",
},
api_version="2024-05-01-preview",
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_begin_update(self, resource_group):
response = self.client.clusters.begin_update(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_name="str",
cluster_patch_request={
"properties": {
"clusterProfile": {
"authorizationProfile": {"groupIds": ["str"], "userIds": ["str"]},
"autoscaleProfile": {
"enabled": bool,
"autoscaleType": "str",
"gracefulDecommissionTimeout": 0,
"loadBasedConfig": {
"maxNodes": 0,
"minNodes": 0,
"scalingRules": [
{
"actionType": "str",
"comparisonRule": {"operator": "str", "threshold": 0.0},
"evaluationCount": 0,
"scalingMetric": "str",
}
],
"cooldownPeriod": 0,
"pollInterval": 0,
},
"scheduleBasedConfig": {
"defaultCount": 0,
"schedules": [{"count": 0, "days": ["str"], "endTime": "str", "startTime": "str"}],
"timeZone": "str",
},
},
"logAnalyticsProfile": {
"enabled": bool,
"applicationLogs": {"stdErrorEnabled": bool, "stdOutEnabled": bool},
"metricsEnabled": bool,
},
"prometheusProfile": {"enabled": False},
"rangerPluginProfile": {"enabled": False},
"rangerProfile": {
"rangerAdmin": {
"admins": ["str"],
"database": {
"host": "str",
"name": "str",
"passwordSecretRef": "str",
"username": "str",
},
},
"rangerUsersync": {
"enabled": True,
"groups": ["str"],
"mode": "automatic",
"userMappingLocation": "str",
"users": ["str"],
},
"rangerAudit": {"storageAccount": "str"},
},
"scriptActionProfiles": [
{
"name": "str",
"services": ["str"],
"type": "str",
"url": "str",
"parameters": "str",
"shouldPersist": True,
"timeoutInMinutes": 0,
}
],
"secretsProfile": {
"keyVaultResourceId": "str",
"secrets": [
{"keyVaultObjectName": "str", "referenceName": "str", "type": "str", "version": "str"}
],
},
"serviceConfigsProfiles": [
{
"configs": [
{
"component": "str",
"files": [
{
"fileName": "str",
"content": "str",
"encoding": "str",
"path": "str",
"values": {"str": "str"},
}
],
}
],
"serviceName": "str",
}
],
"sshProfile": {"count": 0, "podPrefix": "str", "vmSize": "str"},
"trinoProfile": {
"catalogOptions": {
"hive": [
{
"catalogName": "str",
"metastoreDbConnectionURL": "str",
"metastoreWarehouseDir": "str",
"metastoreDbConnectionAuthenticationMode": "str",
"metastoreDbConnectionPasswordSecret": "str",
"metastoreDbConnectionUserName": "str",
}
]
},
"coordinator": {
"debug": {"enable": False, "port": 8008, "suspend": False},
"highAvailabilityEnabled": True,
},
"userPluginsSpec": {"plugins": [{"enabled": bool, "name": "str", "path": "str"}]},
"userTelemetrySpec": {
"storage": {
"hivecatalogName": "str",
"hivecatalogSchema": "trinologs",
"partitionRetentionInDays": 365,
"path": "str",
}
},
"worker": {"debug": {"enable": False, "port": 8008, "suspend": False}},
},
}
},
"tags": {"str": "str"},
},
api_version="2024-05-01-preview",
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_begin_delete(self, resource_group):
response = self.client.clusters.begin_delete(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_name="str",
api_version="2024-05-01-preview",
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_list_service_configs(self, resource_group):
response = self.client.clusters.list_service_configs(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_name="str",
api_version="2024-05-01-preview",
)
result = [r for r in response]
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_list_instance_views(self, resource_group):
response = self.client.clusters.list_instance_views(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_name="str",
api_version="2024-05-01-preview",
)
result = [r for r in response]
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_get_instance_view(self, resource_group):
response = self.client.clusters.get_instance_view(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_name="str",
api_version="2024-05-01-preview",
)
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,528 @@
# 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.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.hdinsightcontainers.aio import HDInsightContainersMgmtClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
from devtools_testutils.aio import recorded_by_proxy_async
AZURE_LOCATION = "eastus"
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestHDInsightContainersMgmtClustersOperationsAsync(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(HDInsightContainersMgmtClient, is_async=True)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_list_by_cluster_pool_name(self, resource_group):
response = self.client.clusters.list_by_cluster_pool_name(
resource_group_name=resource_group.name,
cluster_pool_name="str",
api_version="2024-05-01-preview",
)
result = [r async for r in response]
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_begin_upgrade(self, resource_group):
response = await (
await self.client.clusters.begin_upgrade(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_name="str",
cluster_upgrade_request={"properties": "cluster_upgrade_properties"},
api_version="2024-05-01-preview",
)
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_begin_upgrade_manual_rollback(self, resource_group):
response = await (
await self.client.clusters.begin_upgrade_manual_rollback(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_name="str",
cluster_rollback_upgrade_request={"properties": {"upgradeHistory": "str"}},
api_version="2024-05-01-preview",
)
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_begin_resize(self, resource_group):
response = await (
await self.client.clusters.begin_resize(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_name="str",
cluster_resize_request={
"location": "str",
"id": "str",
"name": "str",
"properties": {"targetWorkerNodeCount": 0},
"systemData": {
"createdAt": "2020-02-20 00:00:00",
"createdBy": "str",
"createdByType": "str",
"lastModifiedAt": "2020-02-20 00:00:00",
"lastModifiedBy": "str",
"lastModifiedByType": "str",
},
"tags": {"str": "str"},
"type": "str",
},
api_version="2024-05-01-preview",
)
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_get(self, resource_group):
response = await self.client.clusters.get(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_name="str",
api_version="2024-05-01-preview",
)
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_begin_create(self, resource_group):
response = await (
await self.client.clusters.begin_create(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_name="str",
hd_insight_cluster={
"location": "str",
"id": "str",
"name": "str",
"properties": {
"clusterProfile": {
"authorizationProfile": {"groupIds": ["str"], "userIds": ["str"]},
"clusterVersion": "str",
"ossVersion": "str",
"autoscaleProfile": {
"enabled": bool,
"autoscaleType": "str",
"gracefulDecommissionTimeout": 0,
"loadBasedConfig": {
"maxNodes": 0,
"minNodes": 0,
"scalingRules": [
{
"actionType": "str",
"comparisonRule": {"operator": "str", "threshold": 0.0},
"evaluationCount": 0,
"scalingMetric": "str",
}
],
"cooldownPeriod": 0,
"pollInterval": 0,
},
"scheduleBasedConfig": {
"defaultCount": 0,
"schedules": [{"count": 0, "days": ["str"], "endTime": "str", "startTime": "str"}],
"timeZone": "str",
},
},
"clusterAccessProfile": {"enableInternalIngress": bool, "privateLinkServiceId": "str"},
"components": [{"name": "str", "version": "str"}],
"connectivityProfile": {
"web": {"fqdn": "str", "privateFqdn": "str"},
"ssh": [{"endpoint": "str", "privateSshEndpoint": "str"}],
},
"flinkProfile": {
"jobManager": {"cpu": 0.0, "memory": 0},
"storage": {"storageUri": "str", "storagekey": "str"},
"taskManager": {"cpu": 0.0, "memory": 0},
"catalogOptions": {
"hive": {
"metastoreDbConnectionURL": "str",
"metastoreDbConnectionAuthenticationMode": "str",
"metastoreDbConnectionPasswordSecret": "str",
"metastoreDbConnectionUserName": "str",
}
},
"deploymentMode": "str",
"historyServer": {"cpu": 0.0, "memory": 0},
"jobSpec": {
"jarName": "str",
"jobJarDirectory": "str",
"upgradeMode": "str",
"args": "str",
"entryClass": "str",
"savePointName": "str",
},
"numReplicas": 0,
},
"identityProfile": {"msiClientId": "str", "msiObjectId": "str", "msiResourceId": "str"},
"kafkaProfile": {
"diskStorage": {"dataDiskSize": 0, "dataDiskType": "str"},
"connectivityEndpoints": {"bootstrapServerEndpoint": "str", "brokerEndpoints": ["str"]},
"enableKRaft": True,
"enablePublicEndpoints": False,
"remoteStorageUri": "str",
},
"llapProfile": {"str": {}},
"logAnalyticsProfile": {
"enabled": bool,
"applicationLogs": {"stdErrorEnabled": bool, "stdOutEnabled": bool},
"metricsEnabled": bool,
},
"managedIdentityProfile": {
"identityList": [
{"clientId": "str", "objectId": "str", "resourceId": "str", "type": "str"}
]
},
"prometheusProfile": {"enabled": False},
"rangerPluginProfile": {"enabled": False},
"rangerProfile": {
"rangerAdmin": {
"admins": ["str"],
"database": {
"host": "str",
"name": "str",
"passwordSecretRef": "str",
"username": "str",
},
},
"rangerUsersync": {
"enabled": True,
"groups": ["str"],
"mode": "automatic",
"userMappingLocation": "str",
"users": ["str"],
},
"rangerAudit": {"storageAccount": "str"},
},
"scriptActionProfiles": [
{
"name": "str",
"services": ["str"],
"type": "str",
"url": "str",
"parameters": "str",
"shouldPersist": True,
"timeoutInMinutes": 0,
}
],
"secretsProfile": {
"keyVaultResourceId": "str",
"secrets": [
{
"keyVaultObjectName": "str",
"referenceName": "str",
"type": "str",
"version": "str",
}
],
},
"serviceConfigsProfiles": [
{
"configs": [
{
"component": "str",
"files": [
{
"fileName": "str",
"content": "str",
"encoding": "str",
"path": "str",
"values": {"str": "str"},
}
],
}
],
"serviceName": "str",
}
],
"sparkProfile": {
"defaultStorageUrl": "str",
"metastoreSpec": {
"dbName": "str",
"dbServerHost": "str",
"dbConnectionAuthenticationMode": "IdentityAuth",
"dbPasswordSecretName": "str",
"dbUserName": "str",
"keyVaultId": "str",
"thriftUrl": "str",
},
"userPluginsSpec": {"plugins": [{"path": "str"}]},
},
"sshProfile": {"count": 0, "podPrefix": "str", "vmSize": "str"},
"stubProfile": {"str": {}},
"trinoProfile": {
"catalogOptions": {
"hive": [
{
"catalogName": "str",
"metastoreDbConnectionURL": "str",
"metastoreWarehouseDir": "str",
"metastoreDbConnectionAuthenticationMode": "str",
"metastoreDbConnectionPasswordSecret": "str",
"metastoreDbConnectionUserName": "str",
}
]
},
"coordinator": {
"debug": {"enable": False, "port": 8008, "suspend": False},
"highAvailabilityEnabled": True,
},
"userPluginsSpec": {"plugins": [{"enabled": bool, "name": "str", "path": "str"}]},
"userTelemetrySpec": {
"storage": {
"hivecatalogName": "str",
"hivecatalogSchema": "trinologs",
"partitionRetentionInDays": 365,
"path": "str",
}
},
"worker": {"debug": {"enable": False, "port": 8008, "suspend": False}},
},
},
"clusterType": "str",
"computeProfile": {
"nodes": [{"count": 0, "type": "str", "vmSize": "str"}],
"availabilityZones": ["str"],
},
"deploymentId": "str",
"provisioningState": "str",
"status": "str",
},
"systemData": {
"createdAt": "2020-02-20 00:00:00",
"createdBy": "str",
"createdByType": "str",
"lastModifiedAt": "2020-02-20 00:00:00",
"lastModifiedBy": "str",
"lastModifiedByType": "str",
},
"tags": {"str": "str"},
"type": "str",
},
api_version="2024-05-01-preview",
)
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_begin_update(self, resource_group):
response = await (
await self.client.clusters.begin_update(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_name="str",
cluster_patch_request={
"properties": {
"clusterProfile": {
"authorizationProfile": {"groupIds": ["str"], "userIds": ["str"]},
"autoscaleProfile": {
"enabled": bool,
"autoscaleType": "str",
"gracefulDecommissionTimeout": 0,
"loadBasedConfig": {
"maxNodes": 0,
"minNodes": 0,
"scalingRules": [
{
"actionType": "str",
"comparisonRule": {"operator": "str", "threshold": 0.0},
"evaluationCount": 0,
"scalingMetric": "str",
}
],
"cooldownPeriod": 0,
"pollInterval": 0,
},
"scheduleBasedConfig": {
"defaultCount": 0,
"schedules": [{"count": 0, "days": ["str"], "endTime": "str", "startTime": "str"}],
"timeZone": "str",
},
},
"logAnalyticsProfile": {
"enabled": bool,
"applicationLogs": {"stdErrorEnabled": bool, "stdOutEnabled": bool},
"metricsEnabled": bool,
},
"prometheusProfile": {"enabled": False},
"rangerPluginProfile": {"enabled": False},
"rangerProfile": {
"rangerAdmin": {
"admins": ["str"],
"database": {
"host": "str",
"name": "str",
"passwordSecretRef": "str",
"username": "str",
},
},
"rangerUsersync": {
"enabled": True,
"groups": ["str"],
"mode": "automatic",
"userMappingLocation": "str",
"users": ["str"],
},
"rangerAudit": {"storageAccount": "str"},
},
"scriptActionProfiles": [
{
"name": "str",
"services": ["str"],
"type": "str",
"url": "str",
"parameters": "str",
"shouldPersist": True,
"timeoutInMinutes": 0,
}
],
"secretsProfile": {
"keyVaultResourceId": "str",
"secrets": [
{
"keyVaultObjectName": "str",
"referenceName": "str",
"type": "str",
"version": "str",
}
],
},
"serviceConfigsProfiles": [
{
"configs": [
{
"component": "str",
"files": [
{
"fileName": "str",
"content": "str",
"encoding": "str",
"path": "str",
"values": {"str": "str"},
}
],
}
],
"serviceName": "str",
}
],
"sshProfile": {"count": 0, "podPrefix": "str", "vmSize": "str"},
"trinoProfile": {
"catalogOptions": {
"hive": [
{
"catalogName": "str",
"metastoreDbConnectionURL": "str",
"metastoreWarehouseDir": "str",
"metastoreDbConnectionAuthenticationMode": "str",
"metastoreDbConnectionPasswordSecret": "str",
"metastoreDbConnectionUserName": "str",
}
]
},
"coordinator": {
"debug": {"enable": False, "port": 8008, "suspend": False},
"highAvailabilityEnabled": True,
},
"userPluginsSpec": {"plugins": [{"enabled": bool, "name": "str", "path": "str"}]},
"userTelemetrySpec": {
"storage": {
"hivecatalogName": "str",
"hivecatalogSchema": "trinologs",
"partitionRetentionInDays": 365,
"path": "str",
}
},
"worker": {"debug": {"enable": False, "port": 8008, "suspend": False}},
},
}
},
"tags": {"str": "str"},
},
api_version="2024-05-01-preview",
)
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_begin_delete(self, resource_group):
response = await (
await self.client.clusters.begin_delete(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_name="str",
api_version="2024-05-01-preview",
)
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_list_service_configs(self, resource_group):
response = self.client.clusters.list_service_configs(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_name="str",
api_version="2024-05-01-preview",
)
result = [r async for r in response]
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_list_instance_views(self, resource_group):
response = self.client.clusters.list_instance_views(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_name="str",
api_version="2024-05-01-preview",
)
result = [r async for r in response]
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_get_instance_view(self, resource_group):
response = await self.client.clusters.get_instance_view(
resource_group_name=resource_group.name,
cluster_pool_name="str",
cluster_name="str",
api_version="2024-05-01-preview",
)
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,31 @@
# 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.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
AZURE_LOCATION = "eastus"
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestHDInsightContainersMgmtLocationsOperations(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(HDInsightContainersMgmtClient)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_check_name_availability(self, resource_group):
response = self.client.locations.check_name_availability(
location="str",
name_availability_parameters={"name": "str", "type": "str"},
api_version="2024-05-01-preview",
)
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,32 @@
# 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.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.hdinsightcontainers.aio import HDInsightContainersMgmtClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
from devtools_testutils.aio import recorded_by_proxy_async
AZURE_LOCATION = "eastus"
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestHDInsightContainersMgmtLocationsOperationsAsync(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(HDInsightContainersMgmtClient, is_async=True)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_check_name_availability(self, resource_group):
response = await self.client.locations.check_name_availability(
location="str",
name_availability_parameters={"name": "str", "type": "str"},
api_version="2024-05-01-preview",
)
# please add some check logic here by yourself
# ...

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше