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

[AutoRelease] t2-standbypool-2024-09-13-98554(can only be merged by SDK owner) (#37385)

* code and test

* update-testcase

* Update CHANGELOG.md

* Update _version.py

* Update CHANGELOG.md

---------

Co-authored-by: azure-sdk <PythonSdkPipelines>
Co-authored-by: ChenxiJiang333 <v-chenjiang@microsoft.com>
Co-authored-by: ChenxiJiang333 <119990644+ChenxiJiang333@users.noreply.github.com>
Co-authored-by: Yuchao Yan <yuchaoyan@microsoft.com>
This commit is contained in:
Azure SDK Bot 2024-09-24 20:41:06 -07:00 коммит произвёл GitHub
Родитель 2ed3c4a513
Коммит 430cd2198f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
67 изменённых файлов: 9503 добавлений и 5508 удалений

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

@ -1,5 +1,118 @@
# Release History
## 1.0.0 (2024-09-25)
### Features Added
- Client `StandbyPoolMgmtClient` added property `send_request`
- Client `StandbyPoolMgmtClient` added operation group `standby_virtual_machine_pool_runtime_views`
- Client `StandbyPoolMgmtClient` added operation group `standby_container_group_pool_runtime_views`
- Model `ContainerGroupProfile` added property `id`
- Model `ContainerGroupProfile` added property `revision`
- Model `ContainerGroupProperties` added property `container_group_profile`
- Model `ContainerGroupProperties` added property `subnet_ids`
- Model `ErrorAdditionalInfo` added property `info`
- Model `ErrorAdditionalInfo` added property `type`
- Model `ErrorDetail` added property `additional_info`
- Model `ErrorDetail` added property `code`
- Model `ErrorDetail` added property `details`
- Model `ErrorDetail` added property `message`
- Model `ErrorDetail` added property `target`
- Model `ErrorResponse` added property `error`
- Model `Operation` added property `action_type`
- Model `Operation` added property `display`
- Model `Operation` added property `is_data_action`
- Model `Operation` added property `name`
- Model `Operation` added property `origin`
- Model `OperationDisplay` added property `description`
- Model `OperationDisplay` added property `operation`
- Model `OperationDisplay` added property `provider`
- Model `OperationDisplay` added property `resource`
- Model `ProxyResource` added property `id`
- Model `ProxyResource` added property `name`
- Model `ProxyResource` added property `system_data`
- Model `ProxyResource` added property `type`
- Model `Resource` added property `id`
- Model `Resource` added property `name`
- Model `Resource` added property `system_data`
- Model `Resource` added property `type`
- Model `StandbyContainerGroupPoolElasticityProfile` added property `max_ready_capacity`
- Model `StandbyContainerGroupPoolElasticityProfile` added property `refill_policy`
- Model `StandbyContainerGroupPoolResource` added property `id`
- Model `StandbyContainerGroupPoolResource` added property `location`
- Model `StandbyContainerGroupPoolResource` added property `name`
- Model `StandbyContainerGroupPoolResource` added property `properties`
- Model `StandbyContainerGroupPoolResource` added property `system_data`
- Model `StandbyContainerGroupPoolResource` added property `tags`
- Model `StandbyContainerGroupPoolResource` added property `type`
- Model `StandbyContainerGroupPoolResourceProperties` added property `container_group_properties`
- Model `StandbyContainerGroupPoolResourceProperties` added property `elasticity_profile`
- Model `StandbyContainerGroupPoolResourceProperties` added property `provisioning_state`
- Model `StandbyContainerGroupPoolResourceUpdate` added property `properties`
- Model `StandbyContainerGroupPoolResourceUpdate` added property `tags`
- Model `StandbyContainerGroupPoolResourceUpdateProperties` added property `container_group_properties`
- Model `StandbyContainerGroupPoolResourceUpdateProperties` added property `elasticity_profile`
- Model `StandbyVirtualMachinePoolElasticityProfile` added property `max_ready_capacity`
- Model `StandbyVirtualMachinePoolElasticityProfile` added property `min_ready_capacity`
- Model `StandbyVirtualMachinePoolElasticityProfile` added property `min_ready_capacity`
- Model `StandbyVirtualMachinePoolResource` added property `id`
- Model `StandbyVirtualMachinePoolResource` added property `location`
- Model `StandbyVirtualMachinePoolResource` added property `name`
- Model `StandbyVirtualMachinePoolResource` added property `properties`
- Model `StandbyVirtualMachinePoolResource` added property `system_data`
- Model `StandbyVirtualMachinePoolResource` added property `tags`
- Model `StandbyVirtualMachinePoolResource` added property `type`
- Model `StandbyVirtualMachinePoolResourceProperties` added property `attached_virtual_machine_scale_set_id`
- Model `StandbyVirtualMachinePoolResourceProperties` added property `elasticity_profile`
- Model `StandbyVirtualMachinePoolResourceProperties` added property `provisioning_state`
- Model `StandbyVirtualMachinePoolResourceProperties` added property `virtual_machine_state`
- Model `StandbyVirtualMachinePoolResourceUpdate` added property `properties`
- Model `StandbyVirtualMachinePoolResourceUpdate` added property `tags`
- Model `StandbyVirtualMachinePoolResourceUpdateProperties` added property `attached_virtual_machine_scale_set_id`
- Model `StandbyVirtualMachinePoolResourceUpdateProperties` added property `elasticity_profile`
- Model `StandbyVirtualMachinePoolResourceUpdateProperties` added property `virtual_machine_state`
- Model `StandbyVirtualMachineResource` added property `id`
- Model `StandbyVirtualMachineResource` added property `name`
- Model `StandbyVirtualMachineResource` added property `properties`
- Model `StandbyVirtualMachineResource` added property `system_data`
- Model `StandbyVirtualMachineResource` added property `type`
- Model `StandbyVirtualMachineResourceProperties` added property `provisioning_state`
- Model `StandbyVirtualMachineResourceProperties` added property `virtual_machine_resource_id`
- Model `Subnet` added property `id`
- Model `SystemData` added property `created_at`
- Model `SystemData` added property `created_by`
- Model `SystemData` added property `created_by_type`
- Model `SystemData` added property `last_modified_at`
- Model `SystemData` added property `last_modified_by`
- Model `SystemData` added property `last_modified_by_type`
- Model `TrackedResource` added property `id`
- Model `TrackedResource` added property `location`
- Model `TrackedResource` added property `name`
- Model `TrackedResource` added property `system_data`
- Model `TrackedResource` added property `tags`
- Model `TrackedResource` added property `type`
- Added model `ContainerGroupInstanceCountSummary`
- Added model `PoolResourceStateCount`
- Added model `StandbyContainerGroupPoolRuntimeViewResource`
- Added model `StandbyContainerGroupPoolRuntimeViewResourceProperties`
- Added model `StandbyVirtualMachinePoolRuntimeViewResource`
- Added model `StandbyVirtualMachinePoolRuntimeViewResourceProperties`
- Added model `VirtualMachineInstanceCountSummary`
- Added model `StandbyContainerGroupPoolRuntimeViewsOperations`
- Added model `StandbyVirtualMachinePoolRuntimeViewsOperations`
### Breaking Changes
- Model `ProxyResource` deleted or renamed its instance variable `additional_properties`
- Deleted or renamed model `ContainerGroupProfileUpdate`
- Deleted or renamed model `ContainerGroupPropertiesUpdate`
- Deleted or renamed model `OperationListResult`
- Deleted or renamed model `StandbyContainerGroupPoolElasticityProfileUpdate`
- Deleted or renamed model `StandbyContainerGroupPoolResourceListResult`
- Deleted or renamed model `StandbyVirtualMachinePoolElasticityProfileUpdate`
- Deleted or renamed model `StandbyVirtualMachinePoolResourceListResult`
- Deleted or renamed model `StandbyVirtualMachineResourceListResult`
## 1.0.0b1 (2024-04-22)
* Initial Release

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

@ -1,11 +1,6 @@
{
"commit": "92de53a5f1e0e03c94b40475d2135d97148ed014",
"commit": "e695076ad458a3eac3d6943f9e923544ff52b1e4",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.7",
"use": [
"@autorest/python@6.13.7",
"@autorest/modelerfour@4.27.0"
],
"autorest_command": "autorest specification/standbypool/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.13.7 --use=@autorest/modelerfour@4.27.0 --version=3.9.7 --version-tolerant=False",
"readme": "specification/standbypool/resource-manager/readme.md"
"typespec_src": "specification/standbypool/StandbyPool.Management",
"@azure-tools/typespec-python": "0.31.1"
}

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

@ -2,11 +2,11 @@
# --------------------------------------------------------------------------
# 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.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from ._standby_pool_mgmt_client import StandbyPoolMgmtClient
from ._client import StandbyPoolMgmtClient
from ._version import VERSION
__version__ = VERSION

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

@ -2,24 +2,26 @@
# --------------------------------------------------------------------------
# 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.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
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
from azure.mgmt.core import ARMPipelineClient
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
from . import models as _models
from ._configuration import StandbyPoolMgmtClientConfiguration
from ._serialization import Deserializer, Serializer
from .operations import (
Operations,
StandbyContainerGroupPoolRuntimeViewsOperations,
StandbyContainerGroupPoolsOperations,
StandbyVirtualMachinePoolRuntimeViewsOperations,
StandbyVirtualMachinePoolsOperations,
StandbyVirtualMachinesOperations,
)
@ -34,23 +36,31 @@ class StandbyPoolMgmtClient: # pylint: disable=client-accepts-api-version-keywo
:ivar operations: Operations operations
:vartype operations: azure.mgmt.standbypool.operations.Operations
:ivar standby_container_group_pools: StandbyContainerGroupPoolsOperations operations
:vartype standby_container_group_pools:
azure.mgmt.standbypool.operations.StandbyContainerGroupPoolsOperations
:ivar standby_virtual_machine_pools: StandbyVirtualMachinePoolsOperations operations
:vartype standby_virtual_machine_pools:
azure.mgmt.standbypool.operations.StandbyVirtualMachinePoolsOperations
:ivar standby_virtual_machines: StandbyVirtualMachinesOperations operations
:vartype standby_virtual_machines:
azure.mgmt.standbypool.operations.StandbyVirtualMachinesOperations
:param credential: Credential needed for the client to connect to Azure. Required.
:ivar standby_virtual_machine_pool_runtime_views:
StandbyVirtualMachinePoolRuntimeViewsOperations operations
:vartype standby_virtual_machine_pool_runtime_views:
azure.mgmt.standbypool.operations.StandbyVirtualMachinePoolRuntimeViewsOperations
:ivar standby_container_group_pools: StandbyContainerGroupPoolsOperations operations
:vartype standby_container_group_pools:
azure.mgmt.standbypool.operations.StandbyContainerGroupPoolsOperations
:ivar standby_container_group_pool_runtime_views:
StandbyContainerGroupPoolRuntimeViewsOperations operations
:vartype standby_container_group_pool_runtime_views:
azure.mgmt.standbypool.operations.StandbyContainerGroupPoolRuntimeViewsOperations
:param credential: Credential used to authenticate requests to the service. 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".
:param base_url: Service host. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: Api Version. Default value is "2023-12-01-preview". Note that overriding
this default value may result in unsupported behavior.
:keyword api_version: The API version to use for this operation. Default value is "2024-03-01".
Note that overriding this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
@ -63,8 +73,9 @@ class StandbyPoolMgmtClient: # pylint: disable=client-accepts-api-version-keywo
base_url: str = "https://management.azure.com",
**kwargs: Any
) -> None:
_endpoint = "{endpoint}"
self._config = StandbyPoolMgmtClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs
)
_policies = kwargs.pop("policies", None)
if _policies is None:
@ -84,30 +95,35 @@ class StandbyPoolMgmtClient: # pylint: disable=client-accepts-api-version-keywo
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
self._config.http_logging_policy,
]
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
self._client: ARMPipelineClient = ARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize = Serializer()
self._deserialize = Deserializer()
self._serialize.client_side_validation = False
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
self.standby_container_group_pools = StandbyContainerGroupPoolsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.standby_virtual_machine_pools = StandbyVirtualMachinePoolsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.standby_virtual_machines = StandbyVirtualMachinesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.standby_virtual_machine_pool_runtime_views = StandbyVirtualMachinePoolRuntimeViewsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.standby_container_group_pools = StandbyContainerGroupPoolsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.standby_container_group_pool_runtime_views = StandbyContainerGroupPoolRuntimeViewsOperations(
self._client, self._config, self._serialize, self._deserialize
)
def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = client._send_request(request)
>>> response = client.send_request(request)
<HttpResponse: 200 OK>
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
@ -120,13 +136,17 @@ class StandbyPoolMgmtClient: # pylint: disable=client-accepts-api-version-keywo
"""
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
path_format_arguments = {
"endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
}
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
def close(self) -> None:
self._client.close()
def __enter__(self) -> "StandbyPoolMgmtClient":
def __enter__(self) -> Self:
self._client.__enter__()
return self

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

@ -2,7 +2,7 @@
# --------------------------------------------------------------------------
# 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.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
@ -24,17 +24,25 @@ class StandbyPoolMgmtClientConfiguration: # pylint: disable=too-many-instance-a
Note that all parameters used to create this instance are saved as instance
attributes.
:param credential: Credential needed for the client to connect to Azure. Required.
:param credential: Credential used to authenticate requests to the service. 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
:keyword api_version: Api Version. Default value is "2023-12-01-preview". Note that overriding
this default value may result in unsupported behavior.
:param base_url: Service host. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: The API version to use for this operation. Default value is "2024-03-01".
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-12-01-preview")
def __init__(
self,
credential: "TokenCredential",
subscription_id: str,
base_url: str = "https://management.azure.com",
**kwargs: Any
) -> None:
api_version: str = kwargs.pop("api_version", "2024-03-01")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
@ -43,6 +51,7 @@ class StandbyPoolMgmtClientConfiguration: # pylint: disable=too-many-instance-a
self.credential = credential
self.subscription_id = subscription_id
self.base_url = base_url
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-standbypool/{}".format(VERSION))

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

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

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

@ -0,0 +1,50 @@
# --------------------------------------------------------------------------
# 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) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import functools
def api_version_validation(**kwargs):
params_added_on = kwargs.pop("params_added_on", {})
method_added_on = kwargs.pop("method_added_on", "")
def decorator(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
try:
# this assumes the client has an _api_version attribute
client = args[0]
client_api_version = client._config.api_version # pylint: disable=protected-access
except AttributeError:
return func(*args, **kwargs)
if method_added_on > client_api_version:
raise ValueError(
f"'{func.__name__}' is not available in API version "
f"{client_api_version}. Pass service API version {method_added_on} or newer to your client."
)
unsupported = {
parameter: api_version
for api_version, parameters in params_added_on.items()
for parameter in parameters
if parameter in kwargs and api_version > client_api_version
}
if unsupported:
raise ValueError(
"".join(
[
f"'{param}' is not available in API version {client_api_version}. "
f"Use service API version {version} or newer.\n"
for param, version in unsupported.items()
]
)
)
return func(*args, **kwargs)
return wrapper
return decorator

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

@ -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

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

@ -2,8 +2,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.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
VERSION = "1.0.0b1"
VERSION = "1.0.0"

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

@ -2,11 +2,11 @@
# --------------------------------------------------------------------------
# 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.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from ._standby_pool_mgmt_client import StandbyPoolMgmtClient
from ._client import StandbyPoolMgmtClient
try:
from ._patch import __all__ as _patch_all

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

@ -2,24 +2,26 @@
# --------------------------------------------------------------------------
# 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.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
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
from azure.mgmt.core import AsyncARMPipelineClient
from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy
from .. import models as _models
from .._serialization import Deserializer, Serializer
from ._configuration import StandbyPoolMgmtClientConfiguration
from .operations import (
Operations,
StandbyContainerGroupPoolRuntimeViewsOperations,
StandbyContainerGroupPoolsOperations,
StandbyVirtualMachinePoolRuntimeViewsOperations,
StandbyVirtualMachinePoolsOperations,
StandbyVirtualMachinesOperations,
)
@ -34,23 +36,31 @@ class StandbyPoolMgmtClient: # pylint: disable=client-accepts-api-version-keywo
:ivar operations: Operations operations
:vartype operations: azure.mgmt.standbypool.aio.operations.Operations
:ivar standby_container_group_pools: StandbyContainerGroupPoolsOperations operations
:vartype standby_container_group_pools:
azure.mgmt.standbypool.aio.operations.StandbyContainerGroupPoolsOperations
:ivar standby_virtual_machine_pools: StandbyVirtualMachinePoolsOperations operations
:vartype standby_virtual_machine_pools:
azure.mgmt.standbypool.aio.operations.StandbyVirtualMachinePoolsOperations
:ivar standby_virtual_machines: StandbyVirtualMachinesOperations operations
:vartype standby_virtual_machines:
azure.mgmt.standbypool.aio.operations.StandbyVirtualMachinesOperations
:param credential: Credential needed for the client to connect to Azure. Required.
:ivar standby_virtual_machine_pool_runtime_views:
StandbyVirtualMachinePoolRuntimeViewsOperations operations
:vartype standby_virtual_machine_pool_runtime_views:
azure.mgmt.standbypool.aio.operations.StandbyVirtualMachinePoolRuntimeViewsOperations
:ivar standby_container_group_pools: StandbyContainerGroupPoolsOperations operations
:vartype standby_container_group_pools:
azure.mgmt.standbypool.aio.operations.StandbyContainerGroupPoolsOperations
:ivar standby_container_group_pool_runtime_views:
StandbyContainerGroupPoolRuntimeViewsOperations operations
:vartype standby_container_group_pool_runtime_views:
azure.mgmt.standbypool.aio.operations.StandbyContainerGroupPoolRuntimeViewsOperations
:param credential: Credential used to authenticate requests to the service. 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".
:param base_url: Service host. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: Api Version. Default value is "2023-12-01-preview". Note that overriding
this default value may result in unsupported behavior.
:keyword api_version: The API version to use for this operation. Default value is "2024-03-01".
Note that overriding this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
@ -63,8 +73,9 @@ class StandbyPoolMgmtClient: # pylint: disable=client-accepts-api-version-keywo
base_url: str = "https://management.azure.com",
**kwargs: Any
) -> None:
_endpoint = "{endpoint}"
self._config = StandbyPoolMgmtClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs
)
_policies = kwargs.pop("policies", None)
if _policies is None:
@ -84,24 +95,29 @@ class StandbyPoolMgmtClient: # pylint: disable=client-accepts-api-version-keywo
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
self._config.http_logging_policy,
]
self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize = Serializer()
self._deserialize = Deserializer()
self._serialize.client_side_validation = False
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
self.standby_container_group_pools = StandbyContainerGroupPoolsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.standby_virtual_machine_pools = StandbyVirtualMachinePoolsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.standby_virtual_machines = StandbyVirtualMachinesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.standby_virtual_machine_pool_runtime_views = StandbyVirtualMachinePoolRuntimeViewsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.standby_container_group_pools = StandbyContainerGroupPoolsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.standby_container_group_pool_runtime_views = StandbyContainerGroupPoolRuntimeViewsOperations(
self._client, self._config, self._serialize, self._deserialize
)
def _send_request(
def send_request(
self, request: HttpRequest, *, stream: bool = False, **kwargs: Any
) -> Awaitable[AsyncHttpResponse]:
"""Runs the network request through the client's chained policies.
@ -109,7 +125,7 @@ class StandbyPoolMgmtClient: # pylint: disable=client-accepts-api-version-keywo
>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = await client._send_request(request)
>>> response = await client.send_request(request)
<AsyncHttpResponse: 200 OK>
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
@ -122,13 +138,17 @@ class StandbyPoolMgmtClient: # pylint: disable=client-accepts-api-version-keywo
"""
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
path_format_arguments = {
"endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
}
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
async def close(self) -> None:
await self._client.close()
async def __aenter__(self) -> "StandbyPoolMgmtClient":
async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self

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

@ -2,7 +2,7 @@
# --------------------------------------------------------------------------
# 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.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
@ -24,17 +24,25 @@ class StandbyPoolMgmtClientConfiguration: # pylint: disable=too-many-instance-a
Note that all parameters used to create this instance are saved as instance
attributes.
:param credential: Credential needed for the client to connect to Azure. Required.
:param credential: Credential used to authenticate requests to the service. 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
:keyword api_version: Api Version. Default value is "2023-12-01-preview". Note that overriding
this default value may result in unsupported behavior.
:param base_url: Service host. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: The API version to use for this operation. Default value is "2024-03-01".
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-12-01-preview")
def __init__(
self,
credential: "AsyncTokenCredential",
subscription_id: str,
base_url: str = "https://management.azure.com",
**kwargs: Any
) -> None:
api_version: str = kwargs.pop("api_version", "2024-03-01")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
@ -43,6 +51,7 @@ class StandbyPoolMgmtClientConfiguration: # pylint: disable=too-many-instance-a
self.credential = credential
self.subscription_id = subscription_id
self.base_url = base_url
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-standbypool/{}".format(VERSION))

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

@ -2,14 +2,16 @@
# --------------------------------------------------------------------------
# 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.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from ._operations import Operations
from ._standby_container_group_pools_operations import StandbyContainerGroupPoolsOperations
from ._standby_virtual_machine_pools_operations import StandbyVirtualMachinePoolsOperations
from ._standby_virtual_machines_operations import StandbyVirtualMachinesOperations
from ._operations import StandbyVirtualMachinePoolsOperations
from ._operations import StandbyVirtualMachinesOperations
from ._operations import StandbyVirtualMachinePoolRuntimeViewsOperations
from ._operations import StandbyContainerGroupPoolsOperations
from ._operations import StandbyContainerGroupPoolRuntimeViewsOperations
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
@ -17,9 +19,11 @@ from ._patch import patch_sdk as _patch_sdk
__all__ = [
"Operations",
"StandbyContainerGroupPoolsOperations",
"StandbyVirtualMachinePoolsOperations",
"StandbyVirtualMachinesOperations",
"StandbyVirtualMachinePoolRuntimeViewsOperations",
"StandbyContainerGroupPoolsOperations",
"StandbyContainerGroupPoolRuntimeViewsOperations",
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()

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

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

@ -1,725 +0,0 @@
# 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
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._standby_container_group_pools_operations import (
build_create_or_update_request,
build_delete_request,
build_get_request,
build_list_by_resource_group_request,
build_list_by_subscription_request,
build_update_request,
)
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class StandbyContainerGroupPoolsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.standbypool.aio.StandbyPoolMgmtClient`'s
:attr:`standby_container_group_pools` 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_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.StandbyContainerGroupPoolResource"]:
"""List StandbyContainerGroupPoolResource resources by subscription ID.
:return: An iterator like instance of either StandbyContainerGroupPoolResource or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.standbypool.models.StandbyContainerGroupPoolResource]
: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.StandbyContainerGroupPoolResourceListResult] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_by_subscription_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("StandbyContainerGroupPoolResourceListResult", 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)
@distributed_trace
def list_by_resource_group(
self, resource_group_name: str, **kwargs: Any
) -> AsyncIterable["_models.StandbyContainerGroupPoolResource"]:
"""List StandbyContainerGroupPoolResource resources by resource group.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:return: An iterator like instance of either StandbyContainerGroupPoolResource or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.standbypool.models.StandbyContainerGroupPoolResource]
: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.StandbyContainerGroupPoolResourceListResult] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_by_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("StandbyContainerGroupPoolResourceListResult", 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)
@distributed_trace_async
async def get(
self, resource_group_name: str, standby_container_group_pool_name: str, **kwargs: Any
) -> _models.StandbyContainerGroupPoolResource:
"""Get a StandbyContainerGroupPoolResource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param standby_container_group_pool_name: Name of the standby container group pool. Required.
:type standby_container_group_pool_name: str
:return: StandbyContainerGroupPoolResource or the result of cls(response)
:rtype: ~azure.mgmt.standbypool.models.StandbyContainerGroupPoolResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.StandbyContainerGroupPoolResource] = kwargs.pop("cls", None)
_request = build_get_request(
resource_group_name=resource_group_name,
standby_container_group_pool_name=standby_container_group_pool_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("StandbyContainerGroupPoolResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
async def _create_or_update_initial(
self,
resource_group_name: str,
standby_container_group_pool_name: str,
resource: Union[_models.StandbyContainerGroupPoolResource, IO[bytes]],
**kwargs: Any
) -> _models.StandbyContainerGroupPoolResource:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.StandbyContainerGroupPoolResource] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(resource, (IOBase, bytes)):
_content = resource
else:
_json = self._serialize.body(resource, "StandbyContainerGroupPoolResource")
_request = build_create_or_update_request(
resource_group_name=resource_group_name,
standby_container_group_pool_name=standby_container_group_pool_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 200:
deserialized = self._deserialize("StandbyContainerGroupPoolResource", pipeline_response)
if response.status_code == 201:
response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After"))
deserialized = self._deserialize("StandbyContainerGroupPoolResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
standby_container_group_pool_name: str,
resource: _models.StandbyContainerGroupPoolResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.StandbyContainerGroupPoolResource]:
"""Create a StandbyContainerGroupPoolResource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param standby_container_group_pool_name: Name of the standby container group pool. Required.
:type standby_container_group_pool_name: str
:param resource: Resource create parameters. Required.
:type resource: ~azure.mgmt.standbypool.models.StandbyContainerGroupPoolResource
: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 StandbyContainerGroupPoolResource or
the result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.standbypool.models.StandbyContainerGroupPoolResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
standby_container_group_pool_name: str,
resource: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.StandbyContainerGroupPoolResource]:
"""Create a StandbyContainerGroupPoolResource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param standby_container_group_pool_name: Name of the standby container group pool. Required.
:type standby_container_group_pool_name: str
:param resource: Resource create parameters. Required.
:type resource: 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 StandbyContainerGroupPoolResource or
the result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.standbypool.models.StandbyContainerGroupPoolResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
standby_container_group_pool_name: str,
resource: Union[_models.StandbyContainerGroupPoolResource, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.StandbyContainerGroupPoolResource]:
"""Create a StandbyContainerGroupPoolResource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param standby_container_group_pool_name: Name of the standby container group pool. Required.
:type standby_container_group_pool_name: str
:param resource: Resource create parameters. Is either a StandbyContainerGroupPoolResource type
or a IO[bytes] type. Required.
:type resource: ~azure.mgmt.standbypool.models.StandbyContainerGroupPoolResource or IO[bytes]
:return: An instance of AsyncLROPoller that returns either StandbyContainerGroupPoolResource or
the result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.standbypool.models.StandbyContainerGroupPoolResource]
: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.StandbyContainerGroupPoolResource] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_or_update_initial(
resource_group_name=resource_group_name,
standby_container_group_pool_name=standby_container_group_pool_name,
resource=resource,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("StandbyContainerGroupPoolResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(
AsyncPollingMethod,
AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs),
)
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller[_models.StandbyContainerGroupPoolResource].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller[_models.StandbyContainerGroupPoolResource](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
@overload
async def update(
self,
resource_group_name: str,
standby_container_group_pool_name: str,
properties: _models.StandbyContainerGroupPoolResourceUpdate,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.StandbyContainerGroupPoolResource:
"""Update a StandbyContainerGroupPoolResource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param standby_container_group_pool_name: Name of the standby container group pool. Required.
:type standby_container_group_pool_name: str
:param properties: The resource properties to be updated. Required.
:type properties: ~azure.mgmt.standbypool.models.StandbyContainerGroupPoolResourceUpdate
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: StandbyContainerGroupPoolResource or the result of cls(response)
:rtype: ~azure.mgmt.standbypool.models.StandbyContainerGroupPoolResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def update(
self,
resource_group_name: str,
standby_container_group_pool_name: str,
properties: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.StandbyContainerGroupPoolResource:
"""Update a StandbyContainerGroupPoolResource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param standby_container_group_pool_name: Name of the standby container group pool. Required.
:type standby_container_group_pool_name: str
:param properties: The resource properties to be updated. Required.
:type properties: 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: StandbyContainerGroupPoolResource or the result of cls(response)
:rtype: ~azure.mgmt.standbypool.models.StandbyContainerGroupPoolResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def update(
self,
resource_group_name: str,
standby_container_group_pool_name: str,
properties: Union[_models.StandbyContainerGroupPoolResourceUpdate, IO[bytes]],
**kwargs: Any
) -> _models.StandbyContainerGroupPoolResource:
"""Update a StandbyContainerGroupPoolResource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param standby_container_group_pool_name: Name of the standby container group pool. Required.
:type standby_container_group_pool_name: str
:param properties: The resource properties to be updated. Is either a
StandbyContainerGroupPoolResourceUpdate type or a IO[bytes] type. Required.
:type properties: ~azure.mgmt.standbypool.models.StandbyContainerGroupPoolResourceUpdate or
IO[bytes]
:return: StandbyContainerGroupPoolResource or the result of cls(response)
:rtype: ~azure.mgmt.standbypool.models.StandbyContainerGroupPoolResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.StandbyContainerGroupPoolResource] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(properties, (IOBase, bytes)):
_content = properties
else:
_json = self._serialize.body(properties, "StandbyContainerGroupPoolResourceUpdate")
_request = build_update_request(
resource_group_name=resource_group_name,
standby_container_group_pool_name=standby_container_group_pool_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("StandbyContainerGroupPoolResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, standby_container_group_pool_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
standby_container_group_pool_name=standby_container_group_pool_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After"))
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
if cls:
return cls(pipeline_response, None, response_headers) # type: ignore
@distributed_trace_async
async def begin_delete(
self, resource_group_name: str, standby_container_group_pool_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Delete a StandbyContainerGroupPoolResource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param standby_container_group_pool_name: Name of the standby container group pool. Required.
:type standby_container_group_pool_name: 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:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
standby_container_group_pool_name=standby_container_group_pool_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # 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

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

@ -1,725 +0,0 @@
# 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
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._standby_virtual_machine_pools_operations import (
build_create_or_update_request,
build_delete_request,
build_get_request,
build_list_by_resource_group_request,
build_list_by_subscription_request,
build_update_request,
)
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class StandbyVirtualMachinePoolsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.standbypool.aio.StandbyPoolMgmtClient`'s
:attr:`standby_virtual_machine_pools` 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_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.StandbyVirtualMachinePoolResource"]:
"""List StandbyVirtualMachinePoolResource resources by subscription ID.
:return: An iterator like instance of either StandbyVirtualMachinePoolResource or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.standbypool.models.StandbyVirtualMachinePoolResource]
: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.StandbyVirtualMachinePoolResourceListResult] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_by_subscription_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("StandbyVirtualMachinePoolResourceListResult", 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)
@distributed_trace
def list_by_resource_group(
self, resource_group_name: str, **kwargs: Any
) -> AsyncIterable["_models.StandbyVirtualMachinePoolResource"]:
"""List StandbyVirtualMachinePoolResource resources by resource group.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:return: An iterator like instance of either StandbyVirtualMachinePoolResource or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.standbypool.models.StandbyVirtualMachinePoolResource]
: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.StandbyVirtualMachinePoolResourceListResult] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_by_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("StandbyVirtualMachinePoolResourceListResult", 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)
@distributed_trace_async
async def get(
self, resource_group_name: str, standby_virtual_machine_pool_name: str, **kwargs: Any
) -> _models.StandbyVirtualMachinePoolResource:
"""Get a StandbyVirtualMachinePoolResource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param standby_virtual_machine_pool_name: Name of the standby virtual machine pool. Required.
:type standby_virtual_machine_pool_name: str
:return: StandbyVirtualMachinePoolResource or the result of cls(response)
:rtype: ~azure.mgmt.standbypool.models.StandbyVirtualMachinePoolResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.StandbyVirtualMachinePoolResource] = kwargs.pop("cls", None)
_request = build_get_request(
resource_group_name=resource_group_name,
standby_virtual_machine_pool_name=standby_virtual_machine_pool_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("StandbyVirtualMachinePoolResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
async def _create_or_update_initial(
self,
resource_group_name: str,
standby_virtual_machine_pool_name: str,
resource: Union[_models.StandbyVirtualMachinePoolResource, IO[bytes]],
**kwargs: Any
) -> _models.StandbyVirtualMachinePoolResource:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.StandbyVirtualMachinePoolResource] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(resource, (IOBase, bytes)):
_content = resource
else:
_json = self._serialize.body(resource, "StandbyVirtualMachinePoolResource")
_request = build_create_or_update_request(
resource_group_name=resource_group_name,
standby_virtual_machine_pool_name=standby_virtual_machine_pool_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 200:
deserialized = self._deserialize("StandbyVirtualMachinePoolResource", pipeline_response)
if response.status_code == 201:
response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After"))
deserialized = self._deserialize("StandbyVirtualMachinePoolResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
standby_virtual_machine_pool_name: str,
resource: _models.StandbyVirtualMachinePoolResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.StandbyVirtualMachinePoolResource]:
"""Create a StandbyVirtualMachinePoolResource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param standby_virtual_machine_pool_name: Name of the standby virtual machine pool. Required.
:type standby_virtual_machine_pool_name: str
:param resource: Resource create parameters. Required.
:type resource: ~azure.mgmt.standbypool.models.StandbyVirtualMachinePoolResource
: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 StandbyVirtualMachinePoolResource or
the result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.standbypool.models.StandbyVirtualMachinePoolResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
standby_virtual_machine_pool_name: str,
resource: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.StandbyVirtualMachinePoolResource]:
"""Create a StandbyVirtualMachinePoolResource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param standby_virtual_machine_pool_name: Name of the standby virtual machine pool. Required.
:type standby_virtual_machine_pool_name: str
:param resource: Resource create parameters. Required.
:type resource: 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 StandbyVirtualMachinePoolResource or
the result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.standbypool.models.StandbyVirtualMachinePoolResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
standby_virtual_machine_pool_name: str,
resource: Union[_models.StandbyVirtualMachinePoolResource, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.StandbyVirtualMachinePoolResource]:
"""Create a StandbyVirtualMachinePoolResource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param standby_virtual_machine_pool_name: Name of the standby virtual machine pool. Required.
:type standby_virtual_machine_pool_name: str
:param resource: Resource create parameters. Is either a StandbyVirtualMachinePoolResource type
or a IO[bytes] type. Required.
:type resource: ~azure.mgmt.standbypool.models.StandbyVirtualMachinePoolResource or IO[bytes]
:return: An instance of AsyncLROPoller that returns either StandbyVirtualMachinePoolResource or
the result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.standbypool.models.StandbyVirtualMachinePoolResource]
: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.StandbyVirtualMachinePoolResource] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_or_update_initial(
resource_group_name=resource_group_name,
standby_virtual_machine_pool_name=standby_virtual_machine_pool_name,
resource=resource,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("StandbyVirtualMachinePoolResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(
AsyncPollingMethod,
AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs),
)
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller[_models.StandbyVirtualMachinePoolResource].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller[_models.StandbyVirtualMachinePoolResource](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
@overload
async def update(
self,
resource_group_name: str,
standby_virtual_machine_pool_name: str,
properties: _models.StandbyVirtualMachinePoolResourceUpdate,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.StandbyVirtualMachinePoolResource:
"""Update a StandbyVirtualMachinePoolResource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param standby_virtual_machine_pool_name: Name of the standby virtual machine pool. Required.
:type standby_virtual_machine_pool_name: str
:param properties: The resource properties to be updated. Required.
:type properties: ~azure.mgmt.standbypool.models.StandbyVirtualMachinePoolResourceUpdate
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: StandbyVirtualMachinePoolResource or the result of cls(response)
:rtype: ~azure.mgmt.standbypool.models.StandbyVirtualMachinePoolResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def update(
self,
resource_group_name: str,
standby_virtual_machine_pool_name: str,
properties: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.StandbyVirtualMachinePoolResource:
"""Update a StandbyVirtualMachinePoolResource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param standby_virtual_machine_pool_name: Name of the standby virtual machine pool. Required.
:type standby_virtual_machine_pool_name: str
:param properties: The resource properties to be updated. Required.
:type properties: 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: StandbyVirtualMachinePoolResource or the result of cls(response)
:rtype: ~azure.mgmt.standbypool.models.StandbyVirtualMachinePoolResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def update(
self,
resource_group_name: str,
standby_virtual_machine_pool_name: str,
properties: Union[_models.StandbyVirtualMachinePoolResourceUpdate, IO[bytes]],
**kwargs: Any
) -> _models.StandbyVirtualMachinePoolResource:
"""Update a StandbyVirtualMachinePoolResource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param standby_virtual_machine_pool_name: Name of the standby virtual machine pool. Required.
:type standby_virtual_machine_pool_name: str
:param properties: The resource properties to be updated. Is either a
StandbyVirtualMachinePoolResourceUpdate type or a IO[bytes] type. Required.
:type properties: ~azure.mgmt.standbypool.models.StandbyVirtualMachinePoolResourceUpdate or
IO[bytes]
:return: StandbyVirtualMachinePoolResource or the result of cls(response)
:rtype: ~azure.mgmt.standbypool.models.StandbyVirtualMachinePoolResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.StandbyVirtualMachinePoolResource] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(properties, (IOBase, bytes)):
_content = properties
else:
_json = self._serialize.body(properties, "StandbyVirtualMachinePoolResourceUpdate")
_request = build_update_request(
resource_group_name=resource_group_name,
standby_virtual_machine_pool_name=standby_virtual_machine_pool_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("StandbyVirtualMachinePoolResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, standby_virtual_machine_pool_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
standby_virtual_machine_pool_name=standby_virtual_machine_pool_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After"))
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
if cls:
return cls(pipeline_response, None, response_headers) # type: ignore
@distributed_trace_async
async def begin_delete(
self, resource_group_name: str, standby_virtual_machine_pool_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Delete a StandbyVirtualMachinePoolResource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param standby_virtual_machine_pool_name: Name of the standby virtual machine pool. Required.
:type standby_virtual_machine_pool_name: 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:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
standby_virtual_machine_pool_name=standby_virtual_machine_pool_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # 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

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

@ -1,211 +0,0 @@
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.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._standby_virtual_machines_operations import (
build_get_request,
build_list_by_standby_virtual_machine_pool_resource_request,
)
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class StandbyVirtualMachinesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.standbypool.aio.StandbyPoolMgmtClient`'s
:attr:`standby_virtual_machines` 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_by_standby_virtual_machine_pool_resource( # pylint: disable=name-too-long
self, resource_group_name: str, standby_virtual_machine_pool_name: str, **kwargs: Any
) -> AsyncIterable["_models.StandbyVirtualMachineResource"]:
"""List StandbyVirtualMachineResource resources by StandbyVirtualMachinePoolResource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param standby_virtual_machine_pool_name: Name of the standby virtual machine pool. Required.
:type standby_virtual_machine_pool_name: str
:return: An iterator like instance of either StandbyVirtualMachineResource or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.standbypool.models.StandbyVirtualMachineResource]
: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.StandbyVirtualMachineResourceListResult] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_by_standby_virtual_machine_pool_resource_request(
resource_group_name=resource_group_name,
standby_virtual_machine_pool_name=standby_virtual_machine_pool_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("StandbyVirtualMachineResourceListResult", 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)
@distributed_trace_async
async def get(
self,
resource_group_name: str,
standby_virtual_machine_pool_name: str,
standby_virtual_machine_name: str,
**kwargs: Any
) -> _models.StandbyVirtualMachineResource:
"""Get a StandbyVirtualMachineResource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param standby_virtual_machine_pool_name: Name of the standby virtual machine pool. Required.
:type standby_virtual_machine_pool_name: str
:param standby_virtual_machine_name: Name of the standby virtual machine. Required.
:type standby_virtual_machine_name: str
:return: StandbyVirtualMachineResource or the result of cls(response)
:rtype: ~azure.mgmt.standbypool.models.StandbyVirtualMachineResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.StandbyVirtualMachineResource] = kwargs.pop("cls", None)
_request = build_get_request(
resource_group_name=resource_group_name,
standby_virtual_machine_pool_name=standby_virtual_machine_pool_name,
standby_virtual_machine_name=standby_virtual_machine_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("StandbyVirtualMachineResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore

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

@ -2,86 +2,84 @@
# --------------------------------------------------------------------------
# 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.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from ._models_py3 import ContainerGroupProfile
from ._models_py3 import ContainerGroupProfileUpdate
from ._models_py3 import ContainerGroupProperties
from ._models_py3 import ContainerGroupPropertiesUpdate
from ._models_py3 import ErrorAdditionalInfo
from ._models_py3 import ErrorDetail
from ._models_py3 import ErrorResponse
from ._models_py3 import Operation
from ._models_py3 import OperationDisplay
from ._models_py3 import OperationListResult
from ._models_py3 import ProxyResource
from ._models_py3 import Resource
from ._models_py3 import StandbyContainerGroupPoolElasticityProfile
from ._models_py3 import StandbyContainerGroupPoolElasticityProfileUpdate
from ._models_py3 import StandbyContainerGroupPoolResource
from ._models_py3 import StandbyContainerGroupPoolResourceListResult
from ._models_py3 import StandbyContainerGroupPoolResourceProperties
from ._models_py3 import StandbyContainerGroupPoolResourceUpdate
from ._models_py3 import StandbyContainerGroupPoolResourceUpdateProperties
from ._models_py3 import StandbyVirtualMachinePoolElasticityProfile
from ._models_py3 import StandbyVirtualMachinePoolElasticityProfileUpdate
from ._models_py3 import StandbyVirtualMachinePoolResource
from ._models_py3 import StandbyVirtualMachinePoolResourceListResult
from ._models_py3 import StandbyVirtualMachinePoolResourceProperties
from ._models_py3 import StandbyVirtualMachinePoolResourceUpdate
from ._models_py3 import StandbyVirtualMachinePoolResourceUpdateProperties
from ._models_py3 import StandbyVirtualMachineResource
from ._models_py3 import StandbyVirtualMachineResourceListResult
from ._models_py3 import StandbyVirtualMachineResourceProperties
from ._models_py3 import Subnet
from ._models_py3 import SystemData
from ._models_py3 import TrackedResource
from ._models import ContainerGroupInstanceCountSummary
from ._models import ContainerGroupProfile
from ._models import ContainerGroupProperties
from ._models import ErrorAdditionalInfo
from ._models import ErrorDetail
from ._models import ErrorResponse
from ._models import Operation
from ._models import OperationDisplay
from ._models import PoolResourceStateCount
from ._models import ProxyResource
from ._models import Resource
from ._models import StandbyContainerGroupPoolElasticityProfile
from ._models import StandbyContainerGroupPoolResource
from ._models import StandbyContainerGroupPoolResourceProperties
from ._models import StandbyContainerGroupPoolResourceUpdate
from ._models import StandbyContainerGroupPoolResourceUpdateProperties
from ._models import StandbyContainerGroupPoolRuntimeViewResource
from ._models import StandbyContainerGroupPoolRuntimeViewResourceProperties
from ._models import StandbyVirtualMachinePoolElasticityProfile
from ._models import StandbyVirtualMachinePoolResource
from ._models import StandbyVirtualMachinePoolResourceProperties
from ._models import StandbyVirtualMachinePoolResourceUpdate
from ._models import StandbyVirtualMachinePoolResourceUpdateProperties
from ._models import StandbyVirtualMachinePoolRuntimeViewResource
from ._models import StandbyVirtualMachinePoolRuntimeViewResourceProperties
from ._models import StandbyVirtualMachineResource
from ._models import StandbyVirtualMachineResourceProperties
from ._models import Subnet
from ._models import SystemData
from ._models import TrackedResource
from ._models import VirtualMachineInstanceCountSummary
from ._standby_pool_mgmt_client_enums import ActionType
from ._standby_pool_mgmt_client_enums import CreatedByType
from ._standby_pool_mgmt_client_enums import Origin
from ._standby_pool_mgmt_client_enums import ProvisioningState
from ._standby_pool_mgmt_client_enums import RefillPolicy
from ._standby_pool_mgmt_client_enums import VirtualMachineState
from ._enums import ActionType
from ._enums import CreatedByType
from ._enums import Origin
from ._enums import ProvisioningState
from ._enums import RefillPolicy
from ._enums import VirtualMachineState
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
from ._patch import patch_sdk as _patch_sdk
__all__ = [
"ContainerGroupInstanceCountSummary",
"ContainerGroupProfile",
"ContainerGroupProfileUpdate",
"ContainerGroupProperties",
"ContainerGroupPropertiesUpdate",
"ErrorAdditionalInfo",
"ErrorDetail",
"ErrorResponse",
"Operation",
"OperationDisplay",
"OperationListResult",
"PoolResourceStateCount",
"ProxyResource",
"Resource",
"StandbyContainerGroupPoolElasticityProfile",
"StandbyContainerGroupPoolElasticityProfileUpdate",
"StandbyContainerGroupPoolResource",
"StandbyContainerGroupPoolResourceListResult",
"StandbyContainerGroupPoolResourceProperties",
"StandbyContainerGroupPoolResourceUpdate",
"StandbyContainerGroupPoolResourceUpdateProperties",
"StandbyContainerGroupPoolRuntimeViewResource",
"StandbyContainerGroupPoolRuntimeViewResourceProperties",
"StandbyVirtualMachinePoolElasticityProfile",
"StandbyVirtualMachinePoolElasticityProfileUpdate",
"StandbyVirtualMachinePoolResource",
"StandbyVirtualMachinePoolResourceListResult",
"StandbyVirtualMachinePoolResourceProperties",
"StandbyVirtualMachinePoolResourceUpdate",
"StandbyVirtualMachinePoolResourceUpdateProperties",
"StandbyVirtualMachinePoolRuntimeViewResource",
"StandbyVirtualMachinePoolRuntimeViewResourceProperties",
"StandbyVirtualMachineResource",
"StandbyVirtualMachineResourceListResult",
"StandbyVirtualMachineResourceProperties",
"Subnet",
"SystemData",
"TrackedResource",
"VirtualMachineInstanceCountSummary",
"ActionType",
"CreatedByType",
"Origin",

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

@ -2,7 +2,7 @@
# --------------------------------------------------------------------------
# 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.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
@ -11,18 +11,25 @@ from azure.core import CaseInsensitiveEnumMeta
class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs."""
"""Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal
only APIs.
"""
INTERNAL = "Internal"
"""Actions are for internal-only APIs."""
class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The type of identity that created the resource."""
"""The kind of entity that created the resource."""
USER = "User"
"""The entity was created by a user."""
APPLICATION = "Application"
"""The entity was created by an application."""
MANAGED_IDENTITY = "ManagedIdentity"
"""The entity was created by a managed identity."""
KEY = "Key"
"""The entity was created by a key."""
class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta):
@ -31,8 +38,11 @@ class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""
USER = "user"
"""Indicates the operation is initiated by a user."""
SYSTEM = "system"
"""Indicates the operation is initiated by a system."""
USER_SYSTEM = "user,system"
"""Indicates the operation is initiated by a user or system."""
class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):

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

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

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

@ -2,14 +2,16 @@
# --------------------------------------------------------------------------
# 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.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from ._operations import Operations
from ._standby_container_group_pools_operations import StandbyContainerGroupPoolsOperations
from ._standby_virtual_machine_pools_operations import StandbyVirtualMachinePoolsOperations
from ._standby_virtual_machines_operations import StandbyVirtualMachinesOperations
from ._operations import StandbyVirtualMachinePoolsOperations
from ._operations import StandbyVirtualMachinesOperations
from ._operations import StandbyVirtualMachinePoolRuntimeViewsOperations
from ._operations import StandbyContainerGroupPoolsOperations
from ._operations import StandbyContainerGroupPoolRuntimeViewsOperations
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
@ -17,9 +19,11 @@ from ._patch import patch_sdk as _patch_sdk
__all__ = [
"Operations",
"StandbyContainerGroupPoolsOperations",
"StandbyVirtualMachinePoolsOperations",
"StandbyVirtualMachinesOperations",
"StandbyVirtualMachinePoolRuntimeViewsOperations",
"StandbyContainerGroupPoolsOperations",
"StandbyContainerGroupPoolRuntimeViewsOperations",
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()

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

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

@ -1,933 +0,0 @@
# 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
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.arm_polling import ARMPolling
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.StandbyPool/standbyContainerGroupPools"
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools",
) # 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
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_request(
resource_group_name: str, standby_container_group_pool_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}",
) # 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
),
"standbyContainerGroupPoolName": _SERIALIZER.url(
"standby_container_group_pool_name",
standby_container_group_pool_name,
"str",
pattern=r"^[a-zA-Z0-9-]{3,24}$",
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_create_or_update_request(
resource_group_name: str, standby_container_group_pool_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-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.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}",
) # 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
),
"standbyContainerGroupPoolName": _SERIALIZER.url(
"standby_container_group_pool_name",
standby_container_group_pool_name,
"str",
pattern=r"^[a-zA-Z0-9-]{3,24}$",
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_update_request(
resource_group_name: str, standby_container_group_pool_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-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.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}",
) # 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
),
"standbyContainerGroupPoolName": _SERIALIZER.url(
"standby_container_group_pool_name",
standby_container_group_pool_name,
"str",
pattern=r"^[a-zA-Z0-9-]{3,24}$",
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_request(
resource_group_name: str, standby_container_group_pool_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}",
) # 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
),
"standbyContainerGroupPoolName": _SERIALIZER.url(
"standby_container_group_pool_name",
standby_container_group_pool_name,
"str",
pattern=r"^[a-zA-Z0-9-]{3,24}$",
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
class StandbyContainerGroupPoolsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.standbypool.StandbyPoolMgmtClient`'s
:attr:`standby_container_group_pools` 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_by_subscription(self, **kwargs: Any) -> Iterable["_models.StandbyContainerGroupPoolResource"]:
"""List StandbyContainerGroupPoolResource resources by subscription ID.
:return: An iterator like instance of either StandbyContainerGroupPoolResource or the result of
cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.standbypool.models.StandbyContainerGroupPoolResource]
: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.StandbyContainerGroupPoolResourceListResult] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_by_subscription_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("StandbyContainerGroupPoolResourceListResult", 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)
@distributed_trace
def list_by_resource_group(
self, resource_group_name: str, **kwargs: Any
) -> Iterable["_models.StandbyContainerGroupPoolResource"]:
"""List StandbyContainerGroupPoolResource resources by resource group.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:return: An iterator like instance of either StandbyContainerGroupPoolResource or the result of
cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.standbypool.models.StandbyContainerGroupPoolResource]
: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.StandbyContainerGroupPoolResourceListResult] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_by_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("StandbyContainerGroupPoolResourceListResult", 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)
@distributed_trace
def get(
self, resource_group_name: str, standby_container_group_pool_name: str, **kwargs: Any
) -> _models.StandbyContainerGroupPoolResource:
"""Get a StandbyContainerGroupPoolResource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param standby_container_group_pool_name: Name of the standby container group pool. Required.
:type standby_container_group_pool_name: str
:return: StandbyContainerGroupPoolResource or the result of cls(response)
:rtype: ~azure.mgmt.standbypool.models.StandbyContainerGroupPoolResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.StandbyContainerGroupPoolResource] = kwargs.pop("cls", None)
_request = build_get_request(
resource_group_name=resource_group_name,
standby_container_group_pool_name=standby_container_group_pool_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("StandbyContainerGroupPoolResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
def _create_or_update_initial(
self,
resource_group_name: str,
standby_container_group_pool_name: str,
resource: Union[_models.StandbyContainerGroupPoolResource, IO[bytes]],
**kwargs: Any
) -> _models.StandbyContainerGroupPoolResource:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.StandbyContainerGroupPoolResource] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(resource, (IOBase, bytes)):
_content = resource
else:
_json = self._serialize.body(resource, "StandbyContainerGroupPoolResource")
_request = build_create_or_update_request(
resource_group_name=resource_group_name,
standby_container_group_pool_name=standby_container_group_pool_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 200:
deserialized = self._deserialize("StandbyContainerGroupPoolResource", pipeline_response)
if response.status_code == 201:
response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After"))
deserialized = self._deserialize("StandbyContainerGroupPoolResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
def begin_create_or_update(
self,
resource_group_name: str,
standby_container_group_pool_name: str,
resource: _models.StandbyContainerGroupPoolResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.StandbyContainerGroupPoolResource]:
"""Create a StandbyContainerGroupPoolResource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param standby_container_group_pool_name: Name of the standby container group pool. Required.
:type standby_container_group_pool_name: str
:param resource: Resource create parameters. Required.
:type resource: ~azure.mgmt.standbypool.models.StandbyContainerGroupPoolResource
: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 StandbyContainerGroupPoolResource or the
result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.standbypool.models.StandbyContainerGroupPoolResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_or_update(
self,
resource_group_name: str,
standby_container_group_pool_name: str,
resource: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.StandbyContainerGroupPoolResource]:
"""Create a StandbyContainerGroupPoolResource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param standby_container_group_pool_name: Name of the standby container group pool. Required.
:type standby_container_group_pool_name: str
:param resource: Resource create parameters. Required.
:type resource: 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 StandbyContainerGroupPoolResource or the
result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.standbypool.models.StandbyContainerGroupPoolResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_or_update(
self,
resource_group_name: str,
standby_container_group_pool_name: str,
resource: Union[_models.StandbyContainerGroupPoolResource, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.StandbyContainerGroupPoolResource]:
"""Create a StandbyContainerGroupPoolResource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param standby_container_group_pool_name: Name of the standby container group pool. Required.
:type standby_container_group_pool_name: str
:param resource: Resource create parameters. Is either a StandbyContainerGroupPoolResource type
or a IO[bytes] type. Required.
:type resource: ~azure.mgmt.standbypool.models.StandbyContainerGroupPoolResource or IO[bytes]
:return: An instance of LROPoller that returns either StandbyContainerGroupPoolResource or the
result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.standbypool.models.StandbyContainerGroupPoolResource]
: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.StandbyContainerGroupPoolResource] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_or_update_initial(
resource_group_name=resource_group_name,
standby_container_group_pool_name=standby_container_group_pool_name,
resource=resource,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("StandbyContainerGroupPoolResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(
PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs)
)
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.StandbyContainerGroupPoolResource].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.StandbyContainerGroupPoolResource](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
@overload
def update(
self,
resource_group_name: str,
standby_container_group_pool_name: str,
properties: _models.StandbyContainerGroupPoolResourceUpdate,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.StandbyContainerGroupPoolResource:
"""Update a StandbyContainerGroupPoolResource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param standby_container_group_pool_name: Name of the standby container group pool. Required.
:type standby_container_group_pool_name: str
:param properties: The resource properties to be updated. Required.
:type properties: ~azure.mgmt.standbypool.models.StandbyContainerGroupPoolResourceUpdate
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: StandbyContainerGroupPoolResource or the result of cls(response)
:rtype: ~azure.mgmt.standbypool.models.StandbyContainerGroupPoolResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def update(
self,
resource_group_name: str,
standby_container_group_pool_name: str,
properties: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.StandbyContainerGroupPoolResource:
"""Update a StandbyContainerGroupPoolResource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param standby_container_group_pool_name: Name of the standby container group pool. Required.
:type standby_container_group_pool_name: str
:param properties: The resource properties to be updated. Required.
:type properties: 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: StandbyContainerGroupPoolResource or the result of cls(response)
:rtype: ~azure.mgmt.standbypool.models.StandbyContainerGroupPoolResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def update(
self,
resource_group_name: str,
standby_container_group_pool_name: str,
properties: Union[_models.StandbyContainerGroupPoolResourceUpdate, IO[bytes]],
**kwargs: Any
) -> _models.StandbyContainerGroupPoolResource:
"""Update a StandbyContainerGroupPoolResource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param standby_container_group_pool_name: Name of the standby container group pool. Required.
:type standby_container_group_pool_name: str
:param properties: The resource properties to be updated. Is either a
StandbyContainerGroupPoolResourceUpdate type or a IO[bytes] type. Required.
:type properties: ~azure.mgmt.standbypool.models.StandbyContainerGroupPoolResourceUpdate or
IO[bytes]
:return: StandbyContainerGroupPoolResource or the result of cls(response)
:rtype: ~azure.mgmt.standbypool.models.StandbyContainerGroupPoolResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.StandbyContainerGroupPoolResource] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(properties, (IOBase, bytes)):
_content = properties
else:
_json = self._serialize.body(properties, "StandbyContainerGroupPoolResourceUpdate")
_request = build_update_request(
resource_group_name=resource_group_name,
standby_container_group_pool_name=standby_container_group_pool_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("StandbyContainerGroupPoolResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, standby_container_group_pool_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
standby_container_group_pool_name=standby_container_group_pool_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After"))
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
if cls:
return cls(pipeline_response, None, response_headers) # type: ignore
@distributed_trace
def begin_delete(
self, resource_group_name: str, standby_container_group_pool_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Delete a StandbyContainerGroupPoolResource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param standby_container_group_pool_name: Name of the standby container group pool. Required.
:type standby_container_group_pool_name: 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:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
standby_container_group_pool_name=standby_container_group_pool_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # 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

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

@ -1,933 +0,0 @@
# 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
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.arm_polling import ARMPolling
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools"
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools",
) # 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
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_request(
resource_group_name: str, standby_virtual_machine_pool_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}",
) # 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
),
"standbyVirtualMachinePoolName": _SERIALIZER.url(
"standby_virtual_machine_pool_name",
standby_virtual_machine_pool_name,
"str",
pattern=r"^[a-zA-Z0-9-]{3,24}$",
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_create_or_update_request(
resource_group_name: str, standby_virtual_machine_pool_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-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.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}",
) # 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
),
"standbyVirtualMachinePoolName": _SERIALIZER.url(
"standby_virtual_machine_pool_name",
standby_virtual_machine_pool_name,
"str",
pattern=r"^[a-zA-Z0-9-]{3,24}$",
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_update_request(
resource_group_name: str, standby_virtual_machine_pool_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-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.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}",
) # 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
),
"standbyVirtualMachinePoolName": _SERIALIZER.url(
"standby_virtual_machine_pool_name",
standby_virtual_machine_pool_name,
"str",
pattern=r"^[a-zA-Z0-9-]{3,24}$",
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_request(
resource_group_name: str, standby_virtual_machine_pool_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}",
) # 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
),
"standbyVirtualMachinePoolName": _SERIALIZER.url(
"standby_virtual_machine_pool_name",
standby_virtual_machine_pool_name,
"str",
pattern=r"^[a-zA-Z0-9-]{3,24}$",
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
class StandbyVirtualMachinePoolsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.standbypool.StandbyPoolMgmtClient`'s
:attr:`standby_virtual_machine_pools` 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_by_subscription(self, **kwargs: Any) -> Iterable["_models.StandbyVirtualMachinePoolResource"]:
"""List StandbyVirtualMachinePoolResource resources by subscription ID.
:return: An iterator like instance of either StandbyVirtualMachinePoolResource or the result of
cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.standbypool.models.StandbyVirtualMachinePoolResource]
: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.StandbyVirtualMachinePoolResourceListResult] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_by_subscription_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("StandbyVirtualMachinePoolResourceListResult", 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)
@distributed_trace
def list_by_resource_group(
self, resource_group_name: str, **kwargs: Any
) -> Iterable["_models.StandbyVirtualMachinePoolResource"]:
"""List StandbyVirtualMachinePoolResource resources by resource group.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:return: An iterator like instance of either StandbyVirtualMachinePoolResource or the result of
cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.standbypool.models.StandbyVirtualMachinePoolResource]
: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.StandbyVirtualMachinePoolResourceListResult] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_by_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("StandbyVirtualMachinePoolResourceListResult", 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)
@distributed_trace
def get(
self, resource_group_name: str, standby_virtual_machine_pool_name: str, **kwargs: Any
) -> _models.StandbyVirtualMachinePoolResource:
"""Get a StandbyVirtualMachinePoolResource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param standby_virtual_machine_pool_name: Name of the standby virtual machine pool. Required.
:type standby_virtual_machine_pool_name: str
:return: StandbyVirtualMachinePoolResource or the result of cls(response)
:rtype: ~azure.mgmt.standbypool.models.StandbyVirtualMachinePoolResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.StandbyVirtualMachinePoolResource] = kwargs.pop("cls", None)
_request = build_get_request(
resource_group_name=resource_group_name,
standby_virtual_machine_pool_name=standby_virtual_machine_pool_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("StandbyVirtualMachinePoolResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
def _create_or_update_initial(
self,
resource_group_name: str,
standby_virtual_machine_pool_name: str,
resource: Union[_models.StandbyVirtualMachinePoolResource, IO[bytes]],
**kwargs: Any
) -> _models.StandbyVirtualMachinePoolResource:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.StandbyVirtualMachinePoolResource] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(resource, (IOBase, bytes)):
_content = resource
else:
_json = self._serialize.body(resource, "StandbyVirtualMachinePoolResource")
_request = build_create_or_update_request(
resource_group_name=resource_group_name,
standby_virtual_machine_pool_name=standby_virtual_machine_pool_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 200:
deserialized = self._deserialize("StandbyVirtualMachinePoolResource", pipeline_response)
if response.status_code == 201:
response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After"))
deserialized = self._deserialize("StandbyVirtualMachinePoolResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@overload
def begin_create_or_update(
self,
resource_group_name: str,
standby_virtual_machine_pool_name: str,
resource: _models.StandbyVirtualMachinePoolResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.StandbyVirtualMachinePoolResource]:
"""Create a StandbyVirtualMachinePoolResource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param standby_virtual_machine_pool_name: Name of the standby virtual machine pool. Required.
:type standby_virtual_machine_pool_name: str
:param resource: Resource create parameters. Required.
:type resource: ~azure.mgmt.standbypool.models.StandbyVirtualMachinePoolResource
: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 StandbyVirtualMachinePoolResource or the
result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.standbypool.models.StandbyVirtualMachinePoolResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_or_update(
self,
resource_group_name: str,
standby_virtual_machine_pool_name: str,
resource: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.StandbyVirtualMachinePoolResource]:
"""Create a StandbyVirtualMachinePoolResource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param standby_virtual_machine_pool_name: Name of the standby virtual machine pool. Required.
:type standby_virtual_machine_pool_name: str
:param resource: Resource create parameters. Required.
:type resource: 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 StandbyVirtualMachinePoolResource or the
result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.standbypool.models.StandbyVirtualMachinePoolResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_or_update(
self,
resource_group_name: str,
standby_virtual_machine_pool_name: str,
resource: Union[_models.StandbyVirtualMachinePoolResource, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.StandbyVirtualMachinePoolResource]:
"""Create a StandbyVirtualMachinePoolResource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param standby_virtual_machine_pool_name: Name of the standby virtual machine pool. Required.
:type standby_virtual_machine_pool_name: str
:param resource: Resource create parameters. Is either a StandbyVirtualMachinePoolResource type
or a IO[bytes] type. Required.
:type resource: ~azure.mgmt.standbypool.models.StandbyVirtualMachinePoolResource or IO[bytes]
:return: An instance of LROPoller that returns either StandbyVirtualMachinePoolResource or the
result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.standbypool.models.StandbyVirtualMachinePoolResource]
: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.StandbyVirtualMachinePoolResource] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_or_update_initial(
resource_group_name=resource_group_name,
standby_virtual_machine_pool_name=standby_virtual_machine_pool_name,
resource=resource,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("StandbyVirtualMachinePoolResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
polling_method: PollingMethod = cast(
PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs)
)
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.StandbyVirtualMachinePoolResource].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.StandbyVirtualMachinePoolResource](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
@overload
def update(
self,
resource_group_name: str,
standby_virtual_machine_pool_name: str,
properties: _models.StandbyVirtualMachinePoolResourceUpdate,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.StandbyVirtualMachinePoolResource:
"""Update a StandbyVirtualMachinePoolResource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param standby_virtual_machine_pool_name: Name of the standby virtual machine pool. Required.
:type standby_virtual_machine_pool_name: str
:param properties: The resource properties to be updated. Required.
:type properties: ~azure.mgmt.standbypool.models.StandbyVirtualMachinePoolResourceUpdate
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: StandbyVirtualMachinePoolResource or the result of cls(response)
:rtype: ~azure.mgmt.standbypool.models.StandbyVirtualMachinePoolResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def update(
self,
resource_group_name: str,
standby_virtual_machine_pool_name: str,
properties: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.StandbyVirtualMachinePoolResource:
"""Update a StandbyVirtualMachinePoolResource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param standby_virtual_machine_pool_name: Name of the standby virtual machine pool. Required.
:type standby_virtual_machine_pool_name: str
:param properties: The resource properties to be updated. Required.
:type properties: 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: StandbyVirtualMachinePoolResource or the result of cls(response)
:rtype: ~azure.mgmt.standbypool.models.StandbyVirtualMachinePoolResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def update(
self,
resource_group_name: str,
standby_virtual_machine_pool_name: str,
properties: Union[_models.StandbyVirtualMachinePoolResourceUpdate, IO[bytes]],
**kwargs: Any
) -> _models.StandbyVirtualMachinePoolResource:
"""Update a StandbyVirtualMachinePoolResource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param standby_virtual_machine_pool_name: Name of the standby virtual machine pool. Required.
:type standby_virtual_machine_pool_name: str
:param properties: The resource properties to be updated. Is either a
StandbyVirtualMachinePoolResourceUpdate type or a IO[bytes] type. Required.
:type properties: ~azure.mgmt.standbypool.models.StandbyVirtualMachinePoolResourceUpdate or
IO[bytes]
:return: StandbyVirtualMachinePoolResource or the result of cls(response)
:rtype: ~azure.mgmt.standbypool.models.StandbyVirtualMachinePoolResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.StandbyVirtualMachinePoolResource] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(properties, (IOBase, bytes)):
_content = properties
else:
_json = self._serialize.body(properties, "StandbyVirtualMachinePoolResourceUpdate")
_request = build_update_request(
resource_group_name=resource_group_name,
standby_virtual_machine_pool_name=standby_virtual_machine_pool_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("StandbyVirtualMachinePoolResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, standby_virtual_machine_pool_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
standby_virtual_machine_pool_name=standby_virtual_machine_pool_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After"))
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
if cls:
return cls(pipeline_response, None, response_headers) # type: ignore
@distributed_trace
def begin_delete(
self, resource_group_name: str, standby_virtual_machine_pool_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Delete a StandbyVirtualMachinePoolResource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param standby_virtual_machine_pool_name: Name of the standby virtual machine pool. Required.
:type standby_virtual_machine_pool_name: 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:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
standby_virtual_machine_pool_name=standby_virtual_machine_pool_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # 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

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

@ -1,293 +0,0 @@
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_by_standby_virtual_machine_pool_resource_request( # pylint: disable=name-too-long
resource_group_name: str, standby_virtual_machine_pool_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/standbyVirtualMachines",
) # 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
),
"standbyVirtualMachinePoolName": _SERIALIZER.url(
"standby_virtual_machine_pool_name",
standby_virtual_machine_pool_name,
"str",
pattern=r"^[a-zA-Z0-9-]{3,24}$",
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_request(
resource_group_name: str,
standby_virtual_machine_pool_name: str,
standby_virtual_machine_name: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/standbyVirtualMachines/{standbyVirtualMachineName}",
) # 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
),
"standbyVirtualMachinePoolName": _SERIALIZER.url(
"standby_virtual_machine_pool_name",
standby_virtual_machine_pool_name,
"str",
pattern=r"^[a-zA-Z0-9-]{3,24}$",
),
"standbyVirtualMachineName": _SERIALIZER.url(
"standby_virtual_machine_name", standby_virtual_machine_name, "str", pattern=r"^[_a-zA-Z0-9-]{3,64}$"
),
}
_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 StandbyVirtualMachinesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.standbypool.StandbyPoolMgmtClient`'s
:attr:`standby_virtual_machines` 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_by_standby_virtual_machine_pool_resource( # pylint: disable=name-too-long
self, resource_group_name: str, standby_virtual_machine_pool_name: str, **kwargs: Any
) -> Iterable["_models.StandbyVirtualMachineResource"]:
"""List StandbyVirtualMachineResource resources by StandbyVirtualMachinePoolResource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param standby_virtual_machine_pool_name: Name of the standby virtual machine pool. Required.
:type standby_virtual_machine_pool_name: str
:return: An iterator like instance of either StandbyVirtualMachineResource or the result of
cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.standbypool.models.StandbyVirtualMachineResource]
: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.StandbyVirtualMachineResourceListResult] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_by_standby_virtual_machine_pool_resource_request(
resource_group_name=resource_group_name,
standby_virtual_machine_pool_name=standby_virtual_machine_pool_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("StandbyVirtualMachineResourceListResult", 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)
@distributed_trace
def get(
self,
resource_group_name: str,
standby_virtual_machine_pool_name: str,
standby_virtual_machine_name: str,
**kwargs: Any
) -> _models.StandbyVirtualMachineResource:
"""Get a StandbyVirtualMachineResource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param standby_virtual_machine_pool_name: Name of the standby virtual machine pool. Required.
:type standby_virtual_machine_pool_name: str
:param standby_virtual_machine_name: Name of the standby virtual machine. Required.
:type standby_virtual_machine_name: str
:return: StandbyVirtualMachineResource or the result of cls(response)
:rtype: ~azure.mgmt.standbypool.models.StandbyVirtualMachineResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.StandbyVirtualMachineResource] = kwargs.pop("cls", None)
_request = build_get_request(
resource_group_name=resource_group_name,
standby_virtual_machine_pool_name=standby_virtual_machine_pool_name,
standby_virtual_machine_name=standby_virtual_machine_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("StandbyVirtualMachineResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore

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

@ -1,2 +1,3 @@
-e ../../../tools/azure-sdk-tools
../../identity/azure-identity
aiohttp

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

@ -2,7 +2,7 @@
# --------------------------------------------------------------------------
# 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.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
@ -35,6 +35,6 @@ def main():
print(item)
# x-ms-original-file: specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2023-12-01-preview/examples/Operations_List.json
# x-ms-original-file: 2024-03-01/Operations_List.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) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.standbypool import StandbyPoolMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-standbypool
# USAGE
python standby_container_group_pool_runtime_views_get.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = StandbyPoolMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.standby_container_group_pool_runtime_views.get(
resource_group_name="rgstandbypool",
standby_container_group_pool_name="pool",
runtime_view="latest",
)
print(response)
# x-ms-original-file: 2024-03-01/StandbyContainerGroupPoolRuntimeViews_Get.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) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.standbypool import StandbyPoolMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-standbypool
# USAGE
python standby_container_group_pool_runtime_views_list_by_standby_pool.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = StandbyPoolMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.standby_container_group_pool_runtime_views.list_by_standby_pool(
resource_group_name="rgstandbypool",
standby_container_group_pool_name="pool",
)
for item in response:
print(item)
# x-ms-original-file: 2024-03-01/StandbyContainerGroupPoolRuntimeViews_ListByStandbyPool.json
if __name__ == "__main__":
main()

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

@ -2,12 +2,10 @@
# --------------------------------------------------------------------------
# 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.
# Code generated by Microsoft (R) Python 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.standbypool import StandbyPoolMgmtClient
@ -29,7 +27,7 @@ from azure.mgmt.standbypool import StandbyPoolMgmtClient
def main():
client = StandbyPoolMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8CC31D61-82D7-4B2B-B9DC-6B924DE7D229",
subscription_id="SUBSCRIPTION_ID",
)
response = client.standby_container_group_pools.begin_create_or_update(
@ -40,12 +38,12 @@ def main():
"properties": {
"containerGroupProperties": {
"containerGroupProfile": {
"id": "/subscriptions/8CC31D61-82D7-4B2B-B9DC-6B924DE7D229/resourceGroups/rgstandbypool/providers/Microsoft.ContainerInstance/containerGroupProfiles/cgProfile",
"id": "/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.ContainerInstance/containerGroupProfiles/cgProfile",
"revision": 1,
},
"subnetIds": [
{
"id": "/subscriptions/8cf6c1b6-c80f-437c-87ad-45fbaff54f73/resourceGroups/rgstandbypool/providers/Microsoft.Network/virtualNetworks/cgSubnet/subnets/cgSubnet"
"id": "/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.Network/virtualNetworks/cgSubnet/subnets/cgSubnet"
}
],
},
@ -57,6 +55,6 @@ def main():
print(response)
# x-ms-original-file: specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2023-12-01-preview/examples/StandbyContainerGroupPools_CreateOrUpdate.json
# x-ms-original-file: 2024-03-01/StandbyContainerGroupPools_CreateOrUpdate.json
if __name__ == "__main__":
main()

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

@ -2,7 +2,7 @@
# --------------------------------------------------------------------------
# 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.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
@ -27,7 +27,7 @@ from azure.mgmt.standbypool import StandbyPoolMgmtClient
def main():
client = StandbyPoolMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8CC31D61-82D7-4B2B-B9DC-6B924DE7D229",
subscription_id="SUBSCRIPTION_ID",
)
client.standby_container_group_pools.begin_delete(
@ -36,6 +36,6 @@ def main():
).result()
# x-ms-original-file: specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2023-12-01-preview/examples/StandbyContainerGroupPools_Delete.json
# x-ms-original-file: 2024-03-01/StandbyContainerGroupPools_Delete.json
if __name__ == "__main__":
main()

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

@ -2,7 +2,7 @@
# --------------------------------------------------------------------------
# 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.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
@ -27,7 +27,7 @@ from azure.mgmt.standbypool import StandbyPoolMgmtClient
def main():
client = StandbyPoolMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8CC31D61-82D7-4B2B-B9DC-6B924DE7D229",
subscription_id="SUBSCRIPTION_ID",
)
response = client.standby_container_group_pools.get(
@ -37,6 +37,6 @@ def main():
print(response)
# x-ms-original-file: specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2023-12-01-preview/examples/StandbyContainerGroupPools_Get.json
# x-ms-original-file: 2024-03-01/StandbyContainerGroupPools_Get.json
if __name__ == "__main__":
main()

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

@ -2,7 +2,7 @@
# --------------------------------------------------------------------------
# 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.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
@ -27,7 +27,7 @@ from azure.mgmt.standbypool import StandbyPoolMgmtClient
def main():
client = StandbyPoolMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8CC31D61-82D7-4B2B-B9DC-6B924DE7D229",
subscription_id="SUBSCRIPTION_ID",
)
response = client.standby_container_group_pools.list_by_resource_group(
@ -37,6 +37,6 @@ def main():
print(item)
# x-ms-original-file: specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2023-12-01-preview/examples/StandbyContainerGroupPools_ListByResourceGroup.json
# x-ms-original-file: 2024-03-01/StandbyContainerGroupPools_ListByResourceGroup.json
if __name__ == "__main__":
main()

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

@ -2,7 +2,7 @@
# --------------------------------------------------------------------------
# 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.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
@ -27,7 +27,7 @@ from azure.mgmt.standbypool import StandbyPoolMgmtClient
def main():
client = StandbyPoolMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8CC31D61-82D7-4B2B-B9DC-6B924DE7D229",
subscription_id="SUBSCRIPTION_ID",
)
response = client.standby_container_group_pools.list_by_subscription()
@ -35,6 +35,6 @@ def main():
print(item)
# x-ms-original-file: specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2023-12-01-preview/examples/StandbyContainerGroupPools_ListBySubscription.json
# x-ms-original-file: 2024-03-01/StandbyContainerGroupPools_ListBySubscription.json
if __name__ == "__main__":
main()

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

@ -2,12 +2,10 @@
# --------------------------------------------------------------------------
# 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.
# Code generated by Microsoft (R) Python 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.standbypool import StandbyPoolMgmtClient
@ -29,7 +27,7 @@ from azure.mgmt.standbypool import StandbyPoolMgmtClient
def main():
client = StandbyPoolMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8CC31D61-82D7-4B2B-B9DC-6B924DE7D229",
subscription_id="SUBSCRIPTION_ID",
)
response = client.standby_container_group_pools.update(
@ -39,12 +37,12 @@ def main():
"properties": {
"containerGroupProperties": {
"containerGroupProfile": {
"id": "/subscriptions/8CC31D61-82D7-4B2B-B9DC-6B924DE7D229/resourceGroups/rgstandbypool/providers/Microsoft.ContainerInstance/containerGroupProfiles/cgProfile",
"id": "/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.ContainerInstance/containerGroupProfiles/cgProfile",
"revision": 2,
},
"subnetIds": [
{
"id": "/subscriptions/8cf6c1b6-c80f-437c-87ad-45fbaff54f73/resourceGroups/rgstandbypool/providers/Microsoft.Network/virtualNetworks/cgSubnet/subnets/cgSubnet"
"id": "/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.Network/virtualNetworks/cgSubnet/subnets/cgSubnet"
}
],
},
@ -56,6 +54,6 @@ def main():
print(response)
# x-ms-original-file: specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2023-12-01-preview/examples/StandbyContainerGroupPools_Update.json
# x-ms-original-file: 2024-03-01/StandbyContainerGroupPools_Update.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) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.standbypool import StandbyPoolMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-standbypool
# USAGE
python standby_virtual_machine_pool_runtime_views_get.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = StandbyPoolMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.standby_virtual_machine_pool_runtime_views.get(
resource_group_name="rgstandbypool",
standby_virtual_machine_pool_name="pool",
runtime_view="latest",
)
print(response)
# x-ms-original-file: 2024-03-01/StandbyVirtualMachinePoolRuntimeViews_Get.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) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.standbypool import StandbyPoolMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-standbypool
# USAGE
python standby_virtual_machine_pool_runtime_views_list_by_standby_pool.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = StandbyPoolMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.standby_virtual_machine_pool_runtime_views.list_by_standby_pool(
resource_group_name="rgstandbypool",
standby_virtual_machine_pool_name="pool",
)
for item in response:
print(item)
# x-ms-original-file: 2024-03-01/StandbyVirtualMachinePoolRuntimeViews_ListByStandbyPool.json
if __name__ == "__main__":
main()

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

@ -2,12 +2,10 @@
# --------------------------------------------------------------------------
# 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.
# Code generated by Microsoft (R) Python 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.standbypool import StandbyPoolMgmtClient
@ -29,7 +27,7 @@ from azure.mgmt.standbypool import StandbyPoolMgmtClient
def main():
client = StandbyPoolMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8CC31D61-82D7-4B2B-B9DC-6B924DE7D229",
subscription_id="SUBSCRIPTION_ID",
)
response = client.standby_virtual_machine_pools.begin_create_or_update(
@ -38,8 +36,8 @@ def main():
resource={
"location": "West US",
"properties": {
"attachedVirtualMachineScaleSetId": "/subscriptions/8CC31D61-82D7-4B2B-B9DC-6B924DE7D229/resourceGroups/rgstandbypool/providers/Microsoft.Compute/virtualMachineScaleSets/myVmss",
"elasticityProfile": {"maxReadyCapacity": 304},
"attachedVirtualMachineScaleSetId": "/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.Compute/virtualMachineScaleSets/myVmss",
"elasticityProfile": {"maxReadyCapacity": 304, "minReadyCapacity": 300},
"virtualMachineState": "Running",
},
"tags": {},
@ -48,6 +46,6 @@ def main():
print(response)
# x-ms-original-file: specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2023-12-01-preview/examples/StandbyVirtualMachinePools_CreateOrUpdate.json
# x-ms-original-file: 2024-03-01/StandbyVirtualMachinePools_CreateOrUpdate.json
if __name__ == "__main__":
main()

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

@ -2,7 +2,7 @@
# --------------------------------------------------------------------------
# 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.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
@ -27,7 +27,7 @@ from azure.mgmt.standbypool import StandbyPoolMgmtClient
def main():
client = StandbyPoolMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8CC31D61-82D7-4B2B-B9DC-6B924DE7D229",
subscription_id="SUBSCRIPTION_ID",
)
client.standby_virtual_machine_pools.begin_delete(
@ -36,6 +36,6 @@ def main():
).result()
# x-ms-original-file: specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2023-12-01-preview/examples/StandbyVirtualMachinePools_Delete.json
# x-ms-original-file: 2024-03-01/StandbyVirtualMachinePools_Delete.json
if __name__ == "__main__":
main()

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

@ -2,7 +2,7 @@
# --------------------------------------------------------------------------
# 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.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
@ -27,7 +27,7 @@ from azure.mgmt.standbypool import StandbyPoolMgmtClient
def main():
client = StandbyPoolMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8CC31D61-82D7-4B2B-B9DC-6B924DE7D229",
subscription_id="SUBSCRIPTION_ID",
)
response = client.standby_virtual_machine_pools.get(
@ -37,6 +37,6 @@ def main():
print(response)
# x-ms-original-file: specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2023-12-01-preview/examples/StandbyVirtualMachinePools_Get.json
# x-ms-original-file: 2024-03-01/StandbyVirtualMachinePools_Get.json
if __name__ == "__main__":
main()

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

@ -2,7 +2,7 @@
# --------------------------------------------------------------------------
# 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.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
@ -27,7 +27,7 @@ from azure.mgmt.standbypool import StandbyPoolMgmtClient
def main():
client = StandbyPoolMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8CC31D61-82D7-4B2B-B9DC-6B924DE7D229",
subscription_id="SUBSCRIPTION_ID",
)
response = client.standby_virtual_machine_pools.list_by_resource_group(
@ -37,6 +37,6 @@ def main():
print(item)
# x-ms-original-file: specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2023-12-01-preview/examples/StandbyVirtualMachinePools_ListByResourceGroup.json
# x-ms-original-file: 2024-03-01/StandbyVirtualMachinePools_ListByResourceGroup.json
if __name__ == "__main__":
main()

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

@ -2,7 +2,7 @@
# --------------------------------------------------------------------------
# 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.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
@ -27,7 +27,7 @@ from azure.mgmt.standbypool import StandbyPoolMgmtClient
def main():
client = StandbyPoolMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8CC31D61-82D7-4B2B-B9DC-6B924DE7D229",
subscription_id="SUBSCRIPTION_ID",
)
response = client.standby_virtual_machine_pools.list_by_subscription()
@ -35,6 +35,6 @@ def main():
print(item)
# x-ms-original-file: specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2023-12-01-preview/examples/StandbyVirtualMachinePools_ListBySubscription.json
# x-ms-original-file: 2024-03-01/StandbyVirtualMachinePools_ListBySubscription.json
if __name__ == "__main__":
main()

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

@ -2,12 +2,10 @@
# --------------------------------------------------------------------------
# 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.
# Code generated by Microsoft (R) Python 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.standbypool import StandbyPoolMgmtClient
@ -29,7 +27,7 @@ from azure.mgmt.standbypool import StandbyPoolMgmtClient
def main():
client = StandbyPoolMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8CC31D61-82D7-4B2B-B9DC-6B924DE7D229",
subscription_id="SUBSCRIPTION_ID",
)
response = client.standby_virtual_machine_pools.update(
@ -37,8 +35,8 @@ def main():
standby_virtual_machine_pool_name="pool",
properties={
"properties": {
"attachedVirtualMachineScaleSetId": "/subscriptions/8CC31D61-82D7-4B2B-B9DC-6B924DE7D229/resourceGroups/rgstandbypool/providers/Microsoft.Compute/virtualMachineScaleSets/myVmss",
"elasticityProfile": {"maxReadyCapacity": 304},
"attachedVirtualMachineScaleSetId": "/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.Compute/virtualMachineScaleSets/myVmss",
"elasticityProfile": {"maxReadyCapacity": 304, "minReadyCapacity": 300},
"virtualMachineState": "Running",
},
"tags": {},
@ -47,6 +45,6 @@ def main():
print(response)
# x-ms-original-file: specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2023-12-01-preview/examples/StandbyVirtualMachinePools_Update.json
# x-ms-original-file: 2024-03-01/StandbyVirtualMachinePools_Update.json
if __name__ == "__main__":
main()

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

@ -2,7 +2,7 @@
# --------------------------------------------------------------------------
# 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.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
@ -27,7 +27,7 @@ from azure.mgmt.standbypool import StandbyPoolMgmtClient
def main():
client = StandbyPoolMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8CC31D61-82D7-4B2B-B9DC-6B924DE7D229",
subscription_id="SUBSCRIPTION_ID",
)
response = client.standby_virtual_machines.get(
@ -38,6 +38,6 @@ def main():
print(response)
# x-ms-original-file: specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2023-12-01-preview/examples/StandbyVirtualMachines_Get.json
# x-ms-original-file: 2024-03-01/StandbyVirtualMachines_Get.json
if __name__ == "__main__":
main()

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

@ -2,7 +2,7 @@
# --------------------------------------------------------------------------
# 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.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
@ -27,7 +27,7 @@ from azure.mgmt.standbypool import StandbyPoolMgmtClient
def main():
client = StandbyPoolMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8CC31D61-82D7-4B2B-B9DC-6B924DE7D229",
subscription_id="SUBSCRIPTION_ID",
)
response = client.standby_virtual_machines.list_by_standby_virtual_machine_pool_resource(
@ -38,6 +38,6 @@ def main():
print(item)
# x-ms-original-file: specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2023-12-01-preview/examples/StandbyVirtualMachines_ListByStandbyVirtualMachinePoolResource.json
# x-ms-original-file: 2024-03-01/StandbyVirtualMachines_ListByStandbyVirtualMachinePoolResource.json
if __name__ == "__main__":
main()

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

@ -0,0 +1,35 @@
# 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) Python 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):
standbypoolmgmt_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000")
standbypoolmgmt_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000")
standbypoolmgmt_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000")
standbypoolmgmt_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=standbypoolmgmt_subscription_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=standbypoolmgmt_tenant_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=standbypoolmgmt_client_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=standbypoolmgmt_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,27 @@
# 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) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.standbypool import StandbyPoolMgmtClient
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 TestStandbyPoolMgmtOperations(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(StandbyPoolMgmtClient)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_operations_list(self, resource_group):
response = self.client.operations.list()
result = [r for r in response]
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,28 @@
# 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) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.standbypool.aio import StandbyPoolMgmtClient
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 TestStandbyPoolMgmtOperationsAsync(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(StandbyPoolMgmtClient, is_async=True)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_operations_list(self, resource_group):
response = self.client.operations.list()
result = [r async for r in response]
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,42 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.standbypool import StandbyPoolMgmtClient
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 TestStandbyPoolMgmtStandbyContainerGroupPoolRuntimeViewsOperations(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(StandbyPoolMgmtClient)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_standby_container_group_pool_runtime_views_get(self, resource_group):
response = self.client.standby_container_group_pool_runtime_views.get(
resource_group_name=resource_group.name,
standby_container_group_pool_name="str",
runtime_view="str",
)
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_standby_container_group_pool_runtime_views_list_by_standby_pool(self, resource_group):
response = self.client.standby_container_group_pool_runtime_views.list_by_standby_pool(
resource_group_name=resource_group.name,
standby_container_group_pool_name="str",
)
result = [r for r in response]
# please add some check logic here by yourself
# ...

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

@ -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) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.standbypool.aio import StandbyPoolMgmtClient
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 TestStandbyPoolMgmtStandbyContainerGroupPoolRuntimeViewsOperationsAsync(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(StandbyPoolMgmtClient, is_async=True)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_standby_container_group_pool_runtime_views_get(self, resource_group):
response = await self.client.standby_container_group_pool_runtime_views.get(
resource_group_name=resource_group.name,
standby_container_group_pool_name="str",
runtime_view="str",
)
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_standby_container_group_pool_runtime_views_list_by_standby_pool(self, resource_group):
response = self.client.standby_container_group_pool_runtime_views.list_by_standby_pool(
resource_group_name=resource_group.name,
standby_container_group_pool_name="str",
)
result = [r async for r in response]
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,114 @@
# 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) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.standbypool import StandbyPoolMgmtClient
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 TestStandbyPoolMgmtStandbyContainerGroupPoolsOperations(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(StandbyPoolMgmtClient)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_standby_container_group_pools_get(self, resource_group):
response = self.client.standby_container_group_pools.get(
resource_group_name=resource_group.name,
standby_container_group_pool_name="str",
)
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_standby_container_group_pools_begin_create_or_update(self, resource_group):
response = self.client.standby_container_group_pools.begin_create_or_update(
resource_group_name=resource_group.name,
standby_container_group_pool_name="str",
resource={
"location": "str",
"id": "str",
"name": "str",
"properties": {
"containerGroupProperties": {
"containerGroupProfile": {"id": "str", "revision": 0},
"subnetIds": [{"id": "str"}],
},
"elasticityProfile": {"maxReadyCapacity": 0, "refillPolicy": "str"},
"provisioningState": "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",
},
).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_standby_container_group_pools_begin_delete(self, resource_group):
response = self.client.standby_container_group_pools.begin_delete(
resource_group_name=resource_group.name,
standby_container_group_pool_name="str",
).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_standby_container_group_pools_update(self, resource_group):
response = self.client.standby_container_group_pools.update(
resource_group_name=resource_group.name,
standby_container_group_pool_name="str",
properties={
"properties": {
"containerGroupProperties": {
"containerGroupProfile": {"id": "str", "revision": 0},
"subnetIds": [{"id": "str"}],
},
"elasticityProfile": {"maxReadyCapacity": 0, "refillPolicy": "str"},
},
"tags": {"str": "str"},
},
)
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_standby_container_group_pools_list_by_resource_group(self, resource_group):
response = self.client.standby_container_group_pools.list_by_resource_group(
resource_group_name=resource_group.name,
)
result = [r for r in response]
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_standby_container_group_pools_list_by_subscription(self, resource_group):
response = self.client.standby_container_group_pools.list_by_subscription()
result = [r for r in response]
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,119 @@
# 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) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.standbypool.aio import StandbyPoolMgmtClient
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 TestStandbyPoolMgmtStandbyContainerGroupPoolsOperationsAsync(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(StandbyPoolMgmtClient, is_async=True)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_standby_container_group_pools_get(self, resource_group):
response = await self.client.standby_container_group_pools.get(
resource_group_name=resource_group.name,
standby_container_group_pool_name="str",
)
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_standby_container_group_pools_begin_create_or_update(self, resource_group):
response = await (
await self.client.standby_container_group_pools.begin_create_or_update(
resource_group_name=resource_group.name,
standby_container_group_pool_name="str",
resource={
"location": "str",
"id": "str",
"name": "str",
"properties": {
"containerGroupProperties": {
"containerGroupProfile": {"id": "str", "revision": 0},
"subnetIds": [{"id": "str"}],
},
"elasticityProfile": {"maxReadyCapacity": 0, "refillPolicy": "str"},
"provisioningState": "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",
},
)
).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_standby_container_group_pools_begin_delete(self, resource_group):
response = await (
await self.client.standby_container_group_pools.begin_delete(
resource_group_name=resource_group.name,
standby_container_group_pool_name="str",
)
).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_standby_container_group_pools_update(self, resource_group):
response = await self.client.standby_container_group_pools.update(
resource_group_name=resource_group.name,
standby_container_group_pool_name="str",
properties={
"properties": {
"containerGroupProperties": {
"containerGroupProfile": {"id": "str", "revision": 0},
"subnetIds": [{"id": "str"}],
},
"elasticityProfile": {"maxReadyCapacity": 0, "refillPolicy": "str"},
},
"tags": {"str": "str"},
},
)
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_standby_container_group_pools_list_by_resource_group(self, resource_group):
response = self.client.standby_container_group_pools.list_by_resource_group(
resource_group_name=resource_group.name,
)
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_standby_container_group_pools_list_by_subscription(self, resource_group):
response = self.client.standby_container_group_pools.list_by_subscription()
result = [r async for r in response]
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,42 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.standbypool import StandbyPoolMgmtClient
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 TestStandbyPoolMgmtStandbyVirtualMachinePoolRuntimeViewsOperations(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(StandbyPoolMgmtClient)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_standby_virtual_machine_pool_runtime_views_get(self, resource_group):
response = self.client.standby_virtual_machine_pool_runtime_views.get(
resource_group_name=resource_group.name,
standby_virtual_machine_pool_name="str",
runtime_view="str",
)
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_standby_virtual_machine_pool_runtime_views_list_by_standby_pool(self, resource_group):
response = self.client.standby_virtual_machine_pool_runtime_views.list_by_standby_pool(
resource_group_name=resource_group.name,
standby_virtual_machine_pool_name="str",
)
result = [r for r in response]
# please add some check logic here by yourself
# ...

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

@ -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) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.standbypool.aio import StandbyPoolMgmtClient
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 TestStandbyPoolMgmtStandbyVirtualMachinePoolRuntimeViewsOperationsAsync(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(StandbyPoolMgmtClient, is_async=True)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_standby_virtual_machine_pool_runtime_views_get(self, resource_group):
response = await self.client.standby_virtual_machine_pool_runtime_views.get(
resource_group_name=resource_group.name,
standby_virtual_machine_pool_name="str",
runtime_view="str",
)
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_standby_virtual_machine_pool_runtime_views_list_by_standby_pool(self, resource_group):
response = self.client.standby_virtual_machine_pool_runtime_views.list_by_standby_pool(
resource_group_name=resource_group.name,
standby_virtual_machine_pool_name="str",
)
result = [r async for r in response]
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,110 @@
# 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) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.standbypool import StandbyPoolMgmtClient
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 TestStandbyPoolMgmtStandbyVirtualMachinePoolsOperations(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(StandbyPoolMgmtClient)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_standby_virtual_machine_pools_get(self, resource_group):
response = self.client.standby_virtual_machine_pools.get(
resource_group_name=resource_group.name,
standby_virtual_machine_pool_name="str",
)
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_standby_virtual_machine_pools_begin_create_or_update(self, resource_group):
response = self.client.standby_virtual_machine_pools.begin_create_or_update(
resource_group_name=resource_group.name,
standby_virtual_machine_pool_name="str",
resource={
"location": "str",
"id": "str",
"name": "str",
"properties": {
"virtualMachineState": "str",
"attachedVirtualMachineScaleSetId": "str",
"elasticityProfile": {"maxReadyCapacity": 0, "minReadyCapacity": 0},
"provisioningState": "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",
},
).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_standby_virtual_machine_pools_begin_delete(self, resource_group):
response = self.client.standby_virtual_machine_pools.begin_delete(
resource_group_name=resource_group.name,
standby_virtual_machine_pool_name="str",
).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_standby_virtual_machine_pools_update(self, resource_group):
response = self.client.standby_virtual_machine_pools.update(
resource_group_name=resource_group.name,
standby_virtual_machine_pool_name="str",
properties={
"properties": {
"attachedVirtualMachineScaleSetId": "str",
"elasticityProfile": {"maxReadyCapacity": 0, "minReadyCapacity": 0},
"virtualMachineState": "str",
},
"tags": {"str": "str"},
},
)
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_standby_virtual_machine_pools_list_by_resource_group(self, resource_group):
response = self.client.standby_virtual_machine_pools.list_by_resource_group(
resource_group_name=resource_group.name,
)
result = [r for r in response]
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_standby_virtual_machine_pools_list_by_subscription(self, resource_group):
response = self.client.standby_virtual_machine_pools.list_by_subscription()
result = [r for r in response]
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,115 @@
# 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) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.standbypool.aio import StandbyPoolMgmtClient
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 TestStandbyPoolMgmtStandbyVirtualMachinePoolsOperationsAsync(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(StandbyPoolMgmtClient, is_async=True)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_standby_virtual_machine_pools_get(self, resource_group):
response = await self.client.standby_virtual_machine_pools.get(
resource_group_name=resource_group.name,
standby_virtual_machine_pool_name="str",
)
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_standby_virtual_machine_pools_begin_create_or_update(self, resource_group):
response = await (
await self.client.standby_virtual_machine_pools.begin_create_or_update(
resource_group_name=resource_group.name,
standby_virtual_machine_pool_name="str",
resource={
"location": "str",
"id": "str",
"name": "str",
"properties": {
"virtualMachineState": "str",
"attachedVirtualMachineScaleSetId": "str",
"elasticityProfile": {"maxReadyCapacity": 0, "minReadyCapacity": 0},
"provisioningState": "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",
},
)
).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_standby_virtual_machine_pools_begin_delete(self, resource_group):
response = await (
await self.client.standby_virtual_machine_pools.begin_delete(
resource_group_name=resource_group.name,
standby_virtual_machine_pool_name="str",
)
).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_standby_virtual_machine_pools_update(self, resource_group):
response = await self.client.standby_virtual_machine_pools.update(
resource_group_name=resource_group.name,
standby_virtual_machine_pool_name="str",
properties={
"properties": {
"attachedVirtualMachineScaleSetId": "str",
"elasticityProfile": {"maxReadyCapacity": 0, "minReadyCapacity": 0},
"virtualMachineState": "str",
},
"tags": {"str": "str"},
},
)
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_standby_virtual_machine_pools_list_by_resource_group(self, resource_group):
response = self.client.standby_virtual_machine_pools.list_by_resource_group(
resource_group_name=resource_group.name,
)
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_standby_virtual_machine_pools_list_by_subscription(self, resource_group):
response = self.client.standby_virtual_machine_pools.list_by_subscription()
result = [r async for r in response]
# please add some check logic here by yourself
# ...

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

@ -0,0 +1,42 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.standbypool import StandbyPoolMgmtClient
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 TestStandbyPoolMgmtStandbyVirtualMachinesOperations(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(StandbyPoolMgmtClient)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_standby_virtual_machines_get(self, resource_group):
response = self.client.standby_virtual_machines.get(
resource_group_name=resource_group.name,
standby_virtual_machine_pool_name="str",
standby_virtual_machine_name="str",
)
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_standby_virtual_machines_list_by_standby_virtual_machine_pool_resource(self, resource_group):
response = self.client.standby_virtual_machines.list_by_standby_virtual_machine_pool_resource(
resource_group_name=resource_group.name,
standby_virtual_machine_pool_name="str",
)
result = [r for r in response]
# please add some check logic here by yourself
# ...

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

@ -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) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.standbypool.aio import StandbyPoolMgmtClient
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 TestStandbyPoolMgmtStandbyVirtualMachinesOperationsAsync(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(StandbyPoolMgmtClient, is_async=True)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_standby_virtual_machines_get(self, resource_group):
response = await self.client.standby_virtual_machines.get(
resource_group_name=resource_group.name,
standby_virtual_machine_pool_name="str",
standby_virtual_machine_name="str",
)
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_standby_virtual_machines_list_by_standby_virtual_machine_pool_resource(self, resource_group):
response = self.client.standby_virtual_machines.list_by_standby_virtual_machine_pool_resource(
resource_group_name=resource_group.name,
standby_virtual_machine_pool_name="str",
)
result = [r async for r in response]
# please add some check logic here by yourself
# ...

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

@ -75,6 +75,7 @@ setup(
},
install_requires=[
"isodate>=0.6.1",
"typing-extensions>=4.6.0",
"azure-common>=1.1",
"azure-mgmt-core>=1.3.2",
],

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

@ -0,0 +1,35 @@
# 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) Python 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):
standbypoolmgmt_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000")
standbypoolmgmt_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000")
standbypoolmgmt_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000")
standbypoolmgmt_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=standbypoolmgmt_subscription_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=standbypoolmgmt_tenant_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=standbypoolmgmt_client_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=standbypoolmgmt_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,28 @@
# 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) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.standbypool.aio import StandbyPoolMgmtClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
from devtools_testutils.aio import recorded_by_proxy_async
AZURE_LOCATION = "eastus"
@pytest.mark.live_test_only
class TestStandbyPoolMgmtOperationsAsync(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(StandbyPoolMgmtClient, is_async=True)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_operations_list(self, resource_group):
response = self.client.operations.list()
result = [r async for r in response]
assert result

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

@ -0,0 +1,27 @@
# 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) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.standbypool import StandbyPoolMgmtClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
AZURE_LOCATION = "eastus"
@pytest.mark.live_test_only
class TestStandbyPoolMgmtOperations(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(StandbyPoolMgmtClient)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_operations_list(self, resource_group):
response = self.client.operations.list()
result = [r for r in response]
assert result

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

@ -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) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.standbypool.aio import StandbyPoolMgmtClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
from devtools_testutils.aio import recorded_by_proxy_async
AZURE_LOCATION = "eastus"
@pytest.mark.live_test_only
class TestStandbyPoolMgmtStandbyVirtualMachinePoolsOperationsAsync(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(StandbyPoolMgmtClient, is_async=True)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_standby_virtual_machine_pools_list_by_resource_group(self, resource_group):
response = self.client.standby_virtual_machine_pools.list_by_resource_group(
resource_group_name=resource_group.name,
)
result = [r async for r in response]
assert result == []

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

@ -0,0 +1,29 @@
# 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) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.standbypool import StandbyPoolMgmtClient
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
AZURE_LOCATION = "eastus"
@pytest.mark.live_test_only
class TestStandbyPoolMgmtStandbyVirtualMachinePoolsOperations(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(StandbyPoolMgmtClient)
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_standby_virtual_machine_pools_list_by_resource_group(self, resource_group):
response = self.client.standby_virtual_machine_pools.list_by_resource_group(
resource_group_name=resource_group.name,
)
result = [r for r in response]
assert result == []

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

@ -0,0 +1,4 @@
directory: specification/standbypool/StandbyPool.Management
commit: e695076ad458a3eac3d6943f9e923544ff52b1e4
repo: Azure/azure-rest-api-specs
additionalDirectories: