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

[AutoRelease] t2-batch-2024-08-23-81943(can only be merged by SDK owner) (#36998)

* code and test

* update-testcase

* Delete sdk/batch/azure-mgmt-batch/assets.json

* update-testcase

* changelog

* changelog

* 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: msyyc <70930885+msyyc@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:46 -07:00 коммит произвёл GitHub
Родитель b55e230aae
Коммит b6a47ab635
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
146 изменённых файлов: 6509 добавлений и 2817 удалений

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

@ -1,5 +1,65 @@
# Release History
## 18.0.0 (2024-09-25)
### Features Added
- Client `BatchManagementClient` added operation group `network_security_perimeter`
- Model `Application` added parameter `tags` in method `__init__`
- Model `ApplicationPackage` added parameter `tags` in method `__init__`
- Model `Certificate` added parameter `tags` in method `__init__`
- Model `CertificateCreateOrUpdateParameters` added parameter `tags` in method `__init__`
- Model `DetectorResponse` added parameter `tags` in method `__init__`
- Model `ImageReference` added property `shared_gallery_image_id`
- Model `ImageReference` added property `community_gallery_image_id`
- Model `ManagedDisk` added property `security_profile`
- Model `Pool` added parameter `tags` in method `__init__`
- Model `PrivateEndpointConnection` added parameter `tags` in method `__init__`
- Model `PrivateLinkResource` added parameter `tags` in method `__init__`
- Model `ProxyResource` added property `system_data`
- Model `ProxyResource` added property `additional_properties`
- Enum `PublicNetworkAccessType` added member `SECURED_BY_PERIMETER`
- Model `Resource` added property `system_data`
- Model `TaskContainerSettings` added property `container_host_batch_bind_mounts`
- Added model `AccessRule`
- Added enum `AccessRuleDirection`
- Added model `AccessRuleProperties`
- Added model `AccessRulePropertiesSubscriptionsItem`
- Added model `AzureProxyResource`
- Added model `AzureResource`
- Added model `ContainerHostBatchBindMountEntry`
- Added enum `ContainerHostDataPath`
- Added enum `CreatedByType`
- Added model `ErrorAdditionalInfo`
- Added model `ErrorDetail`
- Added model `ErrorResponse`
- Added enum `IssueType`
- Added model `NetworkSecurityPerimeter`
- Added model `NetworkSecurityPerimeterConfiguration`
- Added model `NetworkSecurityPerimeterConfigurationListResult`
- Added model `NetworkSecurityPerimeterConfigurationProperties`
- Added enum `NetworkSecurityPerimeterConfigurationProvisioningState`
- Added model `NetworkSecurityProfile`
- Added model `ProvisioningIssue`
- Added model `ProvisioningIssueProperties`
- Added model `ResourceAssociation`
- Added enum `ResourceAssociationAccessMode`
- Added enum `SecurityEncryptionTypes`
- Added enum `SecurityTypes`
- Added enum `Severity`
- Added model `SystemData`
- Added model `VMDiskSecurityProfile`
- Added model `NetworkSecurityPerimeterOperations`
### Breaking Changes
- Model `DeploymentConfiguration` deleted or renamed its instance variable `cloud_service_configuration`
- Model `ProxyResource` deleted or renamed its instance variable `etag`
- Model `Resource` deleted or renamed its instance variable `location`
- Model `Resource` deleted or renamed its instance variable `tags`
- Deleted or renamed model `CloudServiceConfiguration`
- Deleted or renamed method `LocationOperations.list_supported_cloud_service_skus`
## 17.3.0 (2024-03-19)
### Features Added

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

@ -1,11 +1,11 @@
{
"commit": "c577d8f27e0c3e5e4885134db19bc8193af7260c",
"commit": "1040c6b9bd69bf414c895f7bef87bfd470e90127",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.7",
"autorest": "3.10.2",
"use": [
"@autorest/python@6.7.1",
"@autorest/modelerfour@4.26.2"
"@autorest/python@6.19.0",
"@autorest/modelerfour@4.27.0"
],
"autorest_command": "autorest specification/batch/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False",
"autorest_command": "autorest specification/batch/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False",
"readme": "specification/batch/resource-manager/readme.md"
}

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

@ -1,6 +0,0 @@
{
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "python",
"TagPrefix": "python/batch/azure-mgmt-batch",
"Tag": "python/batch/azure-mgmt-batch_a0b3bb5717"
}

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

@ -8,9 +8,12 @@
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 BatchManagementClientConfiguration
@ -21,6 +24,7 @@ from .operations import (
BatchAccountOperations,
CertificateOperations,
LocationOperations,
NetworkSecurityPerimeterOperations,
Operations,
PoolOperations,
PrivateEndpointConnectionOperations,
@ -54,6 +58,9 @@ class BatchManagementClient: # pylint: disable=client-accepts-api-version-keywo
azure.mgmt.batch.operations.PrivateEndpointConnectionOperations
:ivar pool: PoolOperations operations
:vartype pool: azure.mgmt.batch.operations.PoolOperations
:ivar network_security_perimeter: NetworkSecurityPerimeterOperations operations
:vartype network_security_perimeter:
azure.mgmt.batch.operations.NetworkSecurityPerimeterOperations
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g.
@ -61,7 +68,7 @@ class BatchManagementClient: # pylint: disable=client-accepts-api-version-keywo
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: Api Version. Default value is "2024-02-01". Note that overriding this
:keyword api_version: Api Version. Default value is "2024-07-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
@ -78,7 +85,25 @@ class BatchManagementClient: # pylint: disable=client-accepts-api-version-keywo
self._config = BatchManagementClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
_policies = kwargs.pop("policies", None)
if _policies is None:
_policies = [
policies.RequestIdPolicy(**kwargs),
self._config.headers_policy,
self._config.user_agent_policy,
self._config.proxy_policy,
policies.ContentDecodePolicy(**kwargs),
ARMAutoResourceProviderRegistrationPolicy(),
self._config.redirect_policy,
self._config.retry_policy,
self._config.authentication_policy,
self._config.custom_hook_policy,
self._config.logging_policy,
policies.DistributedTracingPolicy(**kwargs),
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
self._config.http_logging_policy,
]
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
@ -99,8 +124,11 @@ class BatchManagementClient: # pylint: disable=client-accepts-api-version-keywo
self._client, self._config, self._serialize, self._deserialize
)
self.pool = PoolOperations(self._client, self._config, self._serialize, self._deserialize)
self.network_security_perimeter = NetworkSecurityPerimeterOperations(
self._client, self._config, self._serialize, self._deserialize
)
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
@ -120,12 +148,12 @@ class BatchManagementClient: # pylint: disable=client-accepts-api-version-keywo
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
return self._client.send_request(request_copy, **kwargs)
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
def close(self) -> None:
self._client.close()
def __enter__(self) -> "BatchManagementClient":
def __enter__(self) -> Self:
self._client.__enter__()
return self

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

@ -8,7 +8,6 @@
from typing import Any, TYPE_CHECKING
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
@ -19,7 +18,7 @@ if TYPE_CHECKING:
from azure.core.credentials import TokenCredential
class BatchManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
class BatchManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for BatchManagementClient.
Note that all parameters used to create this instance are saved as instance
@ -30,14 +29,13 @@ class BatchManagementClientConfiguration(Configuration): # pylint: disable=too-
:param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g.
00000000-0000-0000-0000-000000000000). Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2024-02-01". Note that overriding this
:keyword api_version: Api Version. Default value is "2024-07-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:
super(BatchManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2024-02-01")
api_version: str = kwargs.pop("api_version", "2024-07-01")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
@ -49,6 +47,7 @@ class BatchManagementClientConfiguration(Configuration): # pylint: disable=too-
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-batch/{}".format(VERSION))
self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@ -57,9 +56,9 @@ class BatchManagementClientConfiguration(Configuration): # pylint: disable=too-
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = ARMChallengeAuthenticationPolicy(

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

@ -25,6 +25,7 @@
#
# --------------------------------------------------------------------------
# This file is used for handwritten extensions to the generated code. Example:
# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
def patch_sdk():

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

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

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

@ -1,16 +0,0 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from azure.core.pipeline.transport import HttpRequest
def _convert_request(request, files=None):
data = request.content if not files else None
request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data)
if files:
request.set_formdata_body(files)
return request

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

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

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

@ -8,9 +8,12 @@
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
@ -21,6 +24,7 @@ from .operations import (
BatchAccountOperations,
CertificateOperations,
LocationOperations,
NetworkSecurityPerimeterOperations,
Operations,
PoolOperations,
PrivateEndpointConnectionOperations,
@ -54,6 +58,9 @@ class BatchManagementClient: # pylint: disable=client-accepts-api-version-keywo
azure.mgmt.batch.aio.operations.PrivateEndpointConnectionOperations
:ivar pool: PoolOperations operations
:vartype pool: azure.mgmt.batch.aio.operations.PoolOperations
:ivar network_security_perimeter: NetworkSecurityPerimeterOperations operations
:vartype network_security_perimeter:
azure.mgmt.batch.aio.operations.NetworkSecurityPerimeterOperations
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g.
@ -61,7 +68,7 @@ class BatchManagementClient: # pylint: disable=client-accepts-api-version-keywo
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: Api Version. Default value is "2024-02-01". Note that overriding this
:keyword api_version: Api Version. Default value is "2024-07-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
@ -78,7 +85,25 @@ class BatchManagementClient: # pylint: disable=client-accepts-api-version-keywo
self._config = BatchManagementClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
_policies = kwargs.pop("policies", None)
if _policies is None:
_policies = [
policies.RequestIdPolicy(**kwargs),
self._config.headers_policy,
self._config.user_agent_policy,
self._config.proxy_policy,
policies.ContentDecodePolicy(**kwargs),
AsyncARMAutoResourceProviderRegistrationPolicy(),
self._config.redirect_policy,
self._config.retry_policy,
self._config.authentication_policy,
self._config.custom_hook_policy,
self._config.logging_policy,
policies.DistributedTracingPolicy(**kwargs),
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
self._config.http_logging_policy,
]
self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
@ -99,8 +124,13 @@ class BatchManagementClient: # pylint: disable=client-accepts-api-version-keywo
self._client, self._config, self._serialize, self._deserialize
)
self.pool = PoolOperations(self._client, self._config, self._serialize, self._deserialize)
self.network_security_perimeter = NetworkSecurityPerimeterOperations(
self._client, self._config, self._serialize, self._deserialize
)
def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
def _send_request(
self, request: HttpRequest, *, stream: bool = False, **kwargs: Any
) -> Awaitable[AsyncHttpResponse]:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
@ -120,12 +150,12 @@ class BatchManagementClient: # pylint: disable=client-accepts-api-version-keywo
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
return self._client.send_request(request_copy, **kwargs)
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
async def close(self) -> None:
await self._client.close()
async def __aenter__(self) -> "BatchManagementClient":
async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self

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

@ -8,7 +8,6 @@
from typing import Any, TYPE_CHECKING
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy
@ -19,7 +18,7 @@ if TYPE_CHECKING:
from azure.core.credentials_async import AsyncTokenCredential
class BatchManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
class BatchManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for BatchManagementClient.
Note that all parameters used to create this instance are saved as instance
@ -30,14 +29,13 @@ class BatchManagementClientConfiguration(Configuration): # pylint: disable=too-
:param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g.
00000000-0000-0000-0000-000000000000). Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2024-02-01". Note that overriding this
:keyword api_version: Api Version. Default value is "2024-07-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:
super(BatchManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2024-02-01")
api_version: str = kwargs.pop("api_version", "2024-07-01")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
@ -49,6 +47,7 @@ class BatchManagementClientConfiguration(Configuration): # pylint: disable=too-
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-batch/{}".format(VERSION))
self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@ -57,9 +56,9 @@ class BatchManagementClientConfiguration(Configuration): # pylint: disable=too-
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs)
self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(

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

@ -25,6 +25,7 @@
#
# --------------------------------------------------------------------------
# This file is used for handwritten extensions to the generated code. Example:
# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
def patch_sdk():

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

@ -15,6 +15,7 @@ from ._certificate_operations import CertificateOperations
from ._private_link_resource_operations import PrivateLinkResourceOperations
from ._private_endpoint_connection_operations import PrivateEndpointConnectionOperations
from ._pool_operations import PoolOperations
from ._network_security_perimeter_operations import NetworkSecurityPerimeterOperations
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
@ -30,6 +31,7 @@ __all__ = [
"PrivateLinkResourceOperations",
"PrivateEndpointConnectionOperations",
"PoolOperations",
"NetworkSecurityPerimeterOperations",
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()

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

@ -1,4 +1,4 @@
# pylint: disable=too-many-lines
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import sys
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@ -20,15 +21,13 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.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._application_operations import (
build_create_request,
build_delete_request,
@ -37,6 +36,10 @@ from ...operations._application_operations import (
build_update_request,
)
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@ -86,7 +89,6 @@ class ApplicationOperations:
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Application or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Application
:raises ~azure.core.exceptions.HttpResponseError:
@ -98,7 +100,7 @@ class ApplicationOperations:
resource_group_name: str,
account_name: str,
application_name: str,
parameters: Optional[IO] = None,
parameters: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@ -114,11 +116,10 @@ class ApplicationOperations:
Required.
:type application_name: str
:param parameters: The parameters for the request. Default value is None.
:type parameters: IO
:type parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Application or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Application
:raises ~azure.core.exceptions.HttpResponseError:
@ -130,7 +131,7 @@ class ApplicationOperations:
resource_group_name: str,
account_name: str,
application_name: str,
parameters: Optional[Union[_models.Application, IO]] = None,
parameters: Optional[Union[_models.Application, IO[bytes]]] = None,
**kwargs: Any
) -> _models.Application:
"""Adds an application to the specified Batch account.
@ -143,18 +144,14 @@ class ApplicationOperations:
:param application_name: The name of the application. This must be unique within the account.
Required.
:type application_name: str
:param parameters: The parameters for the request. Is either a Application type or a IO type.
Default value is None.
:type parameters: ~azure.mgmt.batch.models.Application or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:param parameters: The parameters for the request. Is either a Application type or a IO[bytes]
type. Default value is None.
:type parameters: ~azure.mgmt.batch.models.Application or IO[bytes]
:return: Application or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Application
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -180,7 +177,7 @@ class ApplicationOperations:
else:
_json = None
request = build_create_request(
_request = build_create_request(
resource_group_name=resource_group_name,
account_name=account_name,
application_name=application_name,
@ -189,16 +186,14 @@ class ApplicationOperations:
content_type=content_type,
json=_json,
content=_content,
template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -207,16 +202,12 @@ class ApplicationOperations:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("Application", pipeline_response)
deserialized = self._deserialize("Application", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
create.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}"
}
return deserialized # type: ignore
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
@ -232,12 +223,11 @@ class ApplicationOperations:
:param application_name: The name of the application. This must be unique within the account.
Required.
:type application_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -251,22 +241,20 @@ class ApplicationOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
_request = build_delete_request(
resource_group_name=resource_group_name,
account_name=account_name,
application_name=application_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -276,11 +264,7 @@ class ApplicationOperations:
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}"
}
return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace_async
async def get(
@ -296,12 +280,11 @@ class ApplicationOperations:
:param application_name: The name of the application. This must be unique within the account.
Required.
:type application_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Application or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Application
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -315,22 +298,20 @@ class ApplicationOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.Application] = kwargs.pop("cls", None)
request = build_get_request(
_request = build_get_request(
resource_group_name=resource_group_name,
account_name=account_name,
application_name=application_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -339,16 +320,12 @@ class ApplicationOperations:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("Application", pipeline_response)
deserialized = self._deserialize("Application", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}"
}
return deserialized # type: ignore
@overload
async def update(
@ -376,7 +353,6 @@ class ApplicationOperations:
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Application or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Application
:raises ~azure.core.exceptions.HttpResponseError:
@ -388,7 +364,7 @@ class ApplicationOperations:
resource_group_name: str,
account_name: str,
application_name: str,
parameters: IO,
parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@ -404,11 +380,10 @@ class ApplicationOperations:
Required.
:type application_name: str
:param parameters: The parameters for the request. Required.
:type parameters: IO
:type parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Application or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Application
:raises ~azure.core.exceptions.HttpResponseError:
@ -420,7 +395,7 @@ class ApplicationOperations:
resource_group_name: str,
account_name: str,
application_name: str,
parameters: Union[_models.Application, IO],
parameters: Union[_models.Application, IO[bytes]],
**kwargs: Any
) -> _models.Application:
"""Updates settings for the specified application.
@ -433,18 +408,14 @@ class ApplicationOperations:
:param application_name: The name of the application. This must be unique within the account.
Required.
:type application_name: str
:param parameters: The parameters for the request. Is either a Application type or a IO type.
Required.
:type parameters: ~azure.mgmt.batch.models.Application or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:param parameters: The parameters for the request. Is either a Application type or a IO[bytes]
type. Required.
:type parameters: ~azure.mgmt.batch.models.Application or IO[bytes]
:return: Application or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Application
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -467,7 +438,7 @@ class ApplicationOperations:
else:
_json = self._serialize.body(parameters, "Application")
request = build_update_request(
_request = build_update_request(
resource_group_name=resource_group_name,
account_name=account_name,
application_name=application_name,
@ -476,16 +447,14 @@ class ApplicationOperations:
content_type=content_type,
json=_json,
content=_content,
template_url=self.update.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -494,16 +463,12 @@ class ApplicationOperations:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("Application", pipeline_response)
deserialized = self._deserialize("Application", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}"
}
return deserialized # type: ignore
@distributed_trace
def list(
@ -519,7 +484,6 @@ class ApplicationOperations:
:param maxresults: The maximum number of items to return in the response. Default value is
None.
:type maxresults: int
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Application or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.Application]
:raises ~azure.core.exceptions.HttpResponseError:
@ -530,7 +494,7 @@ class ApplicationOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ListApplicationsResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -541,18 +505,16 @@ class ApplicationOperations:
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
_request = build_list_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
maxresults=maxresults,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@ -564,13 +526,12 @@ class ApplicationOperations:
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ListApplicationsResult", pipeline_response)
@ -580,11 +541,11 @@ class ApplicationOperations:
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -595,7 +556,3 @@ class ApplicationOperations:
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications"
}

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

@ -1,4 +1,4 @@
# pylint: disable=too-many-lines
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import sys
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@ -20,15 +21,13 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.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._application_package_operations import (
build_activate_request,
build_create_request,
@ -37,6 +36,10 @@ from ...operations._application_package_operations import (
build_list_request,
)
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@ -91,7 +94,6 @@ class ApplicationPackageOperations:
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ApplicationPackage or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.ApplicationPackage
:raises ~azure.core.exceptions.HttpResponseError:
@ -104,7 +106,7 @@ class ApplicationPackageOperations:
account_name: str,
application_name: str,
version_name: str,
parameters: IO,
parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@ -124,11 +126,10 @@ class ApplicationPackageOperations:
:param version_name: The version of the application. Required.
:type version_name: str
:param parameters: The parameters for the request. Required.
:type parameters: IO
:type parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ApplicationPackage or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.ApplicationPackage
:raises ~azure.core.exceptions.HttpResponseError:
@ -141,7 +142,7 @@ class ApplicationPackageOperations:
account_name: str,
application_name: str,
version_name: str,
parameters: Union[_models.ActivateApplicationPackageParameters, IO],
parameters: Union[_models.ActivateApplicationPackageParameters, IO[bytes]],
**kwargs: Any
) -> _models.ApplicationPackage:
"""Activates the specified application package. This should be done after the
@ -159,17 +160,13 @@ class ApplicationPackageOperations:
:param version_name: The version of the application. Required.
:type version_name: str
:param parameters: The parameters for the request. Is either a
ActivateApplicationPackageParameters type or a IO type. Required.
:type parameters: ~azure.mgmt.batch.models.ActivateApplicationPackageParameters or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
ActivateApplicationPackageParameters type or a IO[bytes] type. Required.
:type parameters: ~azure.mgmt.batch.models.ActivateApplicationPackageParameters or IO[bytes]
:return: ApplicationPackage or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.ApplicationPackage
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -192,7 +189,7 @@ class ApplicationPackageOperations:
else:
_json = self._serialize.body(parameters, "ActivateApplicationPackageParameters")
request = build_activate_request(
_request = build_activate_request(
resource_group_name=resource_group_name,
account_name=account_name,
application_name=application_name,
@ -202,16 +199,14 @@ class ApplicationPackageOperations:
content_type=content_type,
json=_json,
content=_content,
template_url=self.activate.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -220,16 +215,12 @@ class ApplicationPackageOperations:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("ApplicationPackage", pipeline_response)
deserialized = self._deserialize("ApplicationPackage", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
activate.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}/activate"
}
return deserialized # type: ignore
@overload
async def create(
@ -263,7 +254,6 @@ class ApplicationPackageOperations:
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ApplicationPackage or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.ApplicationPackage
:raises ~azure.core.exceptions.HttpResponseError:
@ -276,7 +266,7 @@ class ApplicationPackageOperations:
account_name: str,
application_name: str,
version_name: str,
parameters: Optional[IO] = None,
parameters: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@ -297,11 +287,10 @@ class ApplicationPackageOperations:
:param version_name: The version of the application. Required.
:type version_name: str
:param parameters: The parameters for the request. Default value is None.
:type parameters: IO
:type parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ApplicationPackage or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.ApplicationPackage
:raises ~azure.core.exceptions.HttpResponseError:
@ -314,7 +303,7 @@ class ApplicationPackageOperations:
account_name: str,
application_name: str,
version_name: str,
parameters: Optional[Union[_models.ApplicationPackage, IO]] = None,
parameters: Optional[Union[_models.ApplicationPackage, IO[bytes]]] = None,
**kwargs: Any
) -> _models.ApplicationPackage:
"""Creates an application package record. The record contains a storageUrl where the package
@ -332,18 +321,14 @@ class ApplicationPackageOperations:
:type application_name: str
:param version_name: The version of the application. Required.
:type version_name: str
:param parameters: The parameters for the request. Is either a ApplicationPackage type or a IO
type. Default value is None.
:type parameters: ~azure.mgmt.batch.models.ApplicationPackage or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:param parameters: The parameters for the request. Is either a ApplicationPackage type or a
IO[bytes] type. Default value is None.
:type parameters: ~azure.mgmt.batch.models.ApplicationPackage or IO[bytes]
:return: ApplicationPackage or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.ApplicationPackage
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -369,7 +354,7 @@ class ApplicationPackageOperations:
else:
_json = None
request = build_create_request(
_request = build_create_request(
resource_group_name=resource_group_name,
account_name=account_name,
application_name=application_name,
@ -379,16 +364,14 @@ class ApplicationPackageOperations:
content_type=content_type,
json=_json,
content=_content,
template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -397,16 +380,12 @@ class ApplicationPackageOperations:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("ApplicationPackage", pipeline_response)
deserialized = self._deserialize("ApplicationPackage", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
create.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}"
}
return deserialized # type: ignore
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
@ -424,12 +403,11 @@ class ApplicationPackageOperations:
:type application_name: str
:param version_name: The version of the application. Required.
:type version_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -443,23 +421,21 @@ class ApplicationPackageOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
_request = build_delete_request(
resource_group_name=resource_group_name,
account_name=account_name,
application_name=application_name,
version_name=version_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -469,11 +445,7 @@ class ApplicationPackageOperations:
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}"
}
return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace_async
async def get(
@ -491,12 +463,11 @@ class ApplicationPackageOperations:
:type application_name: str
:param version_name: The version of the application. Required.
:type version_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ApplicationPackage or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.ApplicationPackage
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -510,23 +481,21 @@ class ApplicationPackageOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ApplicationPackage] = kwargs.pop("cls", None)
request = build_get_request(
_request = build_get_request(
resource_group_name=resource_group_name,
account_name=account_name,
application_name=application_name,
version_name=version_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -535,16 +504,12 @@ class ApplicationPackageOperations:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("ApplicationPackage", pipeline_response)
deserialized = self._deserialize("ApplicationPackage", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}"
}
return deserialized # type: ignore
@distributed_trace
def list(
@ -568,7 +533,6 @@ class ApplicationPackageOperations:
:param maxresults: The maximum number of items to return in the response. Default value is
None.
:type maxresults: int
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ApplicationPackage or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.ApplicationPackage]
:raises ~azure.core.exceptions.HttpResponseError:
@ -579,7 +543,7 @@ class ApplicationPackageOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ListApplicationPackagesResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -590,19 +554,17 @@ class ApplicationPackageOperations:
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
_request = build_list_request(
resource_group_name=resource_group_name,
account_name=account_name,
application_name=application_name,
subscription_id=self._config.subscription_id,
maxresults=maxresults,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@ -614,13 +576,12 @@ class ApplicationPackageOperations:
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ListApplicationPackagesResult", pipeline_response)
@ -630,11 +591,11 @@ class ApplicationPackageOperations:
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -645,7 +606,3 @@ class ApplicationPackageOperations:
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions"
}

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

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

@ -1,4 +1,4 @@
# pylint: disable=too-many-lines
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import sys
from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@ -17,12 +18,13 @@ from azure.core.exceptions import (
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
StreamClosedError,
StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@ -30,7 +32,6 @@ from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._certificate_operations import (
build_cancel_deletion_request,
build_create_request,
@ -40,6 +41,10 @@ from ...operations._certificate_operations import (
build_update_request,
)
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@ -95,7 +100,6 @@ class CertificateOperations:
"properties/provisioningState", "properties/provisioningStateTransitionTime", "name". Default
value is None.
:type filter: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Certificate or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.Certificate]
:raises ~azure.core.exceptions.HttpResponseError:
@ -106,7 +110,7 @@ class CertificateOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ListCertificatesResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -117,7 +121,7 @@ class CertificateOperations:
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_batch_account_request(
_request = build_list_by_batch_account_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
@ -125,12 +129,10 @@ class CertificateOperations:
select=select,
filter=filter,
api_version=api_version,
template_url=self.list_by_batch_account.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@ -142,13 +144,12 @@ class CertificateOperations:
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ListCertificatesResult", pipeline_response)
@ -158,11 +159,11 @@ class CertificateOperations:
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -174,10 +175,6 @@ class CertificateOperations:
return AsyncItemPaged(get_next, extract_data)
list_by_batch_account.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates"
}
@overload
async def create(
self,
@ -218,7 +215,6 @@ class CertificateOperations:
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Certificate or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Certificate
:raises ~azure.core.exceptions.HttpResponseError:
@ -230,7 +226,7 @@ class CertificateOperations:
resource_group_name: str,
account_name: str,
certificate_name: str,
parameters: IO,
parameters: IO[bytes],
if_match: Optional[str] = None,
if_none_match: Optional[str] = None,
*,
@ -253,7 +249,7 @@ class CertificateOperations:
example SHA1-a3d1c5. Required.
:type certificate_name: str
:param parameters: Additional parameters for certificate creation. Required.
:type parameters: IO
:type parameters: IO[bytes]
:param if_match: The entity state (ETag) version of the certificate to update. A value of "*"
can be used to apply the operation only if the certificate already exists. If omitted, this
operation will always be applied. Default value is None.
@ -264,7 +260,6 @@ class CertificateOperations:
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Certificate or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Certificate
:raises ~azure.core.exceptions.HttpResponseError:
@ -276,7 +271,7 @@ class CertificateOperations:
resource_group_name: str,
account_name: str,
certificate_name: str,
parameters: Union[_models.CertificateCreateOrUpdateParameters, IO],
parameters: Union[_models.CertificateCreateOrUpdateParameters, IO[bytes]],
if_match: Optional[str] = None,
if_none_match: Optional[str] = None,
**kwargs: Any
@ -297,8 +292,8 @@ class CertificateOperations:
example SHA1-a3d1c5. Required.
:type certificate_name: str
:param parameters: Additional parameters for certificate creation. Is either a
CertificateCreateOrUpdateParameters type or a IO type. Required.
:type parameters: ~azure.mgmt.batch.models.CertificateCreateOrUpdateParameters or IO
CertificateCreateOrUpdateParameters type or a IO[bytes] type. Required.
:type parameters: ~azure.mgmt.batch.models.CertificateCreateOrUpdateParameters or IO[bytes]
:param if_match: The entity state (ETag) version of the certificate to update. A value of "*"
can be used to apply the operation only if the certificate already exists. If omitted, this
operation will always be applied. Default value is None.
@ -306,15 +301,11 @@ class CertificateOperations:
:param if_none_match: Set to '*' to allow a new certificate to be created, but to prevent
updating an existing certificate. Other values will be ignored. Default value is None.
:type if_none_match: str
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Certificate or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Certificate
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -337,7 +328,7 @@ class CertificateOperations:
else:
_json = self._serialize.body(parameters, "CertificateCreateOrUpdateParameters")
request = build_create_request(
_request = build_create_request(
resource_group_name=resource_group_name,
account_name=account_name,
certificate_name=certificate_name,
@ -348,16 +339,14 @@ class CertificateOperations:
content_type=content_type,
json=_json,
content=_content,
template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -369,16 +358,12 @@ class CertificateOperations:
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
deserialized = self._deserialize("Certificate", pipeline_response)
deserialized = self._deserialize("Certificate", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers)
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
create.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}"
}
return deserialized # type: ignore
@overload
async def update(
@ -415,7 +400,6 @@ class CertificateOperations:
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Certificate or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Certificate
:raises ~azure.core.exceptions.HttpResponseError:
@ -427,7 +411,7 @@ class CertificateOperations:
resource_group_name: str,
account_name: str,
certificate_name: str,
parameters: IO,
parameters: IO[bytes],
if_match: Optional[str] = None,
*,
content_type: str = "application/json",
@ -449,14 +433,13 @@ class CertificateOperations:
example SHA1-a3d1c5. Required.
:type certificate_name: str
:param parameters: Certificate entity to update. Required.
:type parameters: IO
:type parameters: IO[bytes]
:param if_match: The entity state (ETag) version of the certificate to update. This value can
be omitted or set to "*" to apply the operation unconditionally. Default value is None.
:type if_match: str
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Certificate or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Certificate
:raises ~azure.core.exceptions.HttpResponseError:
@ -468,7 +451,7 @@ class CertificateOperations:
resource_group_name: str,
account_name: str,
certificate_name: str,
parameters: Union[_models.CertificateCreateOrUpdateParameters, IO],
parameters: Union[_models.CertificateCreateOrUpdateParameters, IO[bytes]],
if_match: Optional[str] = None,
**kwargs: Any
) -> _models.Certificate:
@ -488,20 +471,16 @@ class CertificateOperations:
example SHA1-a3d1c5. Required.
:type certificate_name: str
:param parameters: Certificate entity to update. Is either a
CertificateCreateOrUpdateParameters type or a IO type. Required.
:type parameters: ~azure.mgmt.batch.models.CertificateCreateOrUpdateParameters or IO
CertificateCreateOrUpdateParameters type or a IO[bytes] type. Required.
:type parameters: ~azure.mgmt.batch.models.CertificateCreateOrUpdateParameters or IO[bytes]
:param if_match: The entity state (ETag) version of the certificate to update. This value can
be omitted or set to "*" to apply the operation unconditionally. Default value is None.
:type if_match: str
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Certificate or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Certificate
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -524,7 +503,7 @@ class CertificateOperations:
else:
_json = self._serialize.body(parameters, "CertificateCreateOrUpdateParameters")
request = build_update_request(
_request = build_update_request(
resource_group_name=resource_group_name,
account_name=account_name,
certificate_name=certificate_name,
@ -534,16 +513,14 @@ class CertificateOperations:
content_type=content_type,
json=_json,
content=_content,
template_url=self.update.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -555,21 +532,17 @@ class CertificateOperations:
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
deserialized = self._deserialize("Certificate", pipeline_response)
deserialized = self._deserialize("Certificate", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers)
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
return deserialized # type: ignore
update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}"
}
async def _delete_initial( # pylint: disable=inconsistent-return-statements
async def _delete_initial(
self, resource_group_name: str, account_name: str, certificate_name: str, **kwargs: Any
) -> None:
error_map = {
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -581,29 +554,32 @@ class CertificateOperations:
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
request = build_delete_request(
_request = build_delete_request(
resource_group_name=resource_group_name,
account_name=account_name,
certificate_name=certificate_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
try:
await response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@ -612,12 +588,12 @@ class CertificateOperations:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After"))
if cls:
return cls(pipeline_response, None, response_headers)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}"
}
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@ -638,14 +614,6 @@ class CertificateOperations:
and thumbprint separated by a dash, and must match the certificate data in the request. For
example SHA1-a3d1c5. Required.
:type certificate_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
@ -659,7 +627,7 @@ class CertificateOperations:
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_initial( # type: ignore
raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
account_name=account_name,
certificate_name=certificate_name,
@ -669,11 +637,12 @@ class CertificateOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(
@ -684,17 +653,13 @@ class CertificateOperations:
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}"
}
return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace_async
async def get(
@ -715,12 +680,11 @@ class CertificateOperations:
and thumbprint separated by a dash, and must match the certificate data in the request. For
example SHA1-a3d1c5. Required.
:type certificate_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Certificate or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Certificate
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -734,22 +698,20 @@ class CertificateOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.Certificate] = kwargs.pop("cls", None)
request = build_get_request(
_request = build_get_request(
resource_group_name=resource_group_name,
account_name=account_name,
certificate_name=certificate_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -761,16 +723,12 @@ class CertificateOperations:
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
deserialized = self._deserialize("Certificate", pipeline_response)
deserialized = self._deserialize("Certificate", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers)
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}"
}
return deserialized # type: ignore
@distributed_trace_async
async def cancel_deletion(
@ -798,12 +756,11 @@ class CertificateOperations:
and thumbprint separated by a dash, and must match the certificate data in the request. For
example SHA1-a3d1c5. Required.
:type certificate_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Certificate or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Certificate
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -817,22 +774,20 @@ class CertificateOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.Certificate] = kwargs.pop("cls", None)
request = build_cancel_deletion_request(
_request = build_cancel_deletion_request(
resource_group_name=resource_group_name,
account_name=account_name,
certificate_name=certificate_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.cancel_deletion.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -844,13 +799,9 @@ class CertificateOperations:
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
deserialized = self._deserialize("Certificate", pipeline_response)
deserialized = self._deserialize("Certificate", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers)
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
cancel_deletion.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}/cancelDelete"
}
return deserialized # type: ignore

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

@ -1,4 +1,4 @@
# pylint: disable=too-many-lines
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import sys
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@ -20,22 +21,23 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.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._location_operations import (
build_check_name_availability_request,
build_get_quotas_request,
build_list_supported_cloud_service_skus_request,
build_list_supported_virtual_machine_skus_request,
)
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@ -65,12 +67,11 @@ class LocationOperations:
:param location_name: The region for which to retrieve Batch service quotas. Required.
:type location_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: BatchLocationQuota or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.BatchLocationQuota
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -84,20 +85,18 @@ class LocationOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.BatchLocationQuota] = kwargs.pop("cls", None)
request = build_get_quotas_request(
_request = build_get_quotas_request(
location_name=location_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_quotas.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -106,16 +105,12 @@ class LocationOperations:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("BatchLocationQuota", pipeline_response)
deserialized = self._deserialize("BatchLocationQuota", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
get_quotas.metadata = {
"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/quotas"
}
return deserialized # type: ignore
@distributed_trace
def list_supported_virtual_machine_skus(
@ -131,7 +126,6 @@ class LocationOperations:
:param filter: OData filter expression. Valid properties for filtering are "familyName".
Default value is None.
:type filter: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either SupportedSku or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.SupportedSku]
:raises ~azure.core.exceptions.HttpResponseError:
@ -142,7 +136,7 @@ class LocationOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.SupportedSkusResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -153,18 +147,16 @@ class LocationOperations:
def prepare_request(next_link=None):
if not next_link:
request = build_list_supported_virtual_machine_skus_request(
_request = build_list_supported_virtual_machine_skus_request(
location_name=location_name,
subscription_id=self._config.subscription_id,
maxresults=maxresults,
filter=filter,
api_version=api_version,
template_url=self.list_supported_virtual_machine_skus.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@ -176,13 +168,12 @@ class LocationOperations:
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("SupportedSkusResult", pipeline_response)
@ -192,11 +183,11 @@ class LocationOperations:
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -208,105 +199,6 @@ class LocationOperations:
return AsyncItemPaged(get_next, extract_data)
list_supported_virtual_machine_skus.metadata = {
"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/virtualMachineSkus"
}
@distributed_trace
def list_supported_cloud_service_skus(
self, location_name: str, maxresults: Optional[int] = None, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.SupportedSku"]:
"""Gets the list of Batch supported Cloud Service VM sizes available at the given location.
:param location_name: The region for which to retrieve Batch service supported SKUs. Required.
:type location_name: str
:param maxresults: The maximum number of items to return in the response. Default value is
None.
:type maxresults: int
:param filter: OData filter expression. Valid properties for filtering are "familyName".
Default value is None.
:type filter: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either SupportedSku or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.SupportedSku]
: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.SupportedSkusResult] = 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_supported_cloud_service_skus_request(
location_name=location_name,
subscription_id=self._config.subscription_id,
maxresults=maxresults,
filter=filter,
api_version=api_version,
template_url=self.list_supported_cloud_service_skus.metadata["url"],
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("SupportedSkusResult", 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)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list_supported_cloud_service_skus.metadata = {
"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/cloudServiceSkus"
}
@overload
async def check_name_availability(
self,
@ -325,7 +217,6 @@ class LocationOperations:
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: CheckNameAvailabilityResult or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
@ -333,18 +224,17 @@ class LocationOperations:
@overload
async def check_name_availability(
self, location_name: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any
self, location_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _models.CheckNameAvailabilityResult:
"""Checks whether the Batch account name is available in the specified region.
:param location_name: The desired region for the name check. Required.
:type location_name: str
:param parameters: Properties needed to check the availability of a name. Required.
:type parameters: IO
:type parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: CheckNameAvailabilityResult or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
@ -352,24 +242,20 @@ class LocationOperations:
@distributed_trace_async
async def check_name_availability(
self, location_name: str, parameters: Union[_models.CheckNameAvailabilityParameters, IO], **kwargs: Any
self, location_name: str, parameters: Union[_models.CheckNameAvailabilityParameters, IO[bytes]], **kwargs: Any
) -> _models.CheckNameAvailabilityResult:
"""Checks whether the Batch account name is available in the specified region.
:param location_name: The desired region for the name check. Required.
:type location_name: str
:param parameters: Properties needed to check the availability of a name. Is either a
CheckNameAvailabilityParameters type or a IO type. Required.
:type parameters: ~azure.mgmt.batch.models.CheckNameAvailabilityParameters or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
CheckNameAvailabilityParameters type or a IO[bytes] type. Required.
:type parameters: ~azure.mgmt.batch.models.CheckNameAvailabilityParameters or IO[bytes]
:return: CheckNameAvailabilityResult or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -392,23 +278,21 @@ class LocationOperations:
else:
_json = self._serialize.body(parameters, "CheckNameAvailabilityParameters")
request = build_check_name_availability_request(
_request = build_check_name_availability_request(
location_name=location_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self.check_name_availability.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -417,13 +301,9 @@ class LocationOperations:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response)
deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
check_name_availability.metadata = {
"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/checkNameAvailability"
}
return deserialized # type: ignore

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

@ -0,0 +1,340 @@
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import sys
from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
StreamClosedError,
StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ...operations._network_security_perimeter_operations import (
build_get_configuration_request,
build_list_configurations_request,
build_reconcile_configuration_request,
)
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class NetworkSecurityPerimeterOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.batch.aio.BatchManagementClient`'s
:attr:`network_security_perimeter` 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_configurations(
self, resource_group_name: str, account_name: str, **kwargs: Any
) -> AsyncIterable["_models.NetworkSecurityPerimeterConfiguration"]:
"""Lists all of the NSP configurations in the specified account.
:param resource_group_name: The name of the resource group that contains the Batch account.
Required.
:type resource_group_name: str
:param account_name: The name of the Batch account. Required.
:type account_name: str
:return: An iterator like instance of either NetworkSecurityPerimeterConfiguration or the
result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.NetworkSecurityPerimeterConfiguration]
: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.NetworkSecurityPerimeterConfigurationListResult] = kwargs.pop("cls", None)
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_configurations_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("NetworkSecurityPerimeterConfigurationListResult", 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)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
@distributed_trace_async
async def get_configuration(
self,
resource_group_name: str,
account_name: str,
network_security_perimeter_configuration_name: str,
**kwargs: Any
) -> _models.NetworkSecurityPerimeterConfiguration:
"""Gets information about the specified NSP configuration.
:param resource_group_name: The name of the resource group that contains the Batch account.
Required.
:type resource_group_name: str
:param account_name: The name of the Batch account. Required.
:type account_name: str
:param network_security_perimeter_configuration_name: The name for Network Security Perimeter
configuration. Required.
:type network_security_perimeter_configuration_name: str
:return: NetworkSecurityPerimeterConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.NetworkSecurityPerimeterConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
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.NetworkSecurityPerimeterConfiguration] = kwargs.pop("cls", None)
_request = build_get_configuration_request(
resource_group_name=resource_group_name,
account_name=account_name,
network_security_perimeter_configuration_name=network_security_perimeter_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_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)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("NetworkSecurityPerimeterConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
async def _reconcile_configuration_initial(
self,
resource_group_name: str,
account_name: str,
network_security_perimeter_configuration_name: str,
**kwargs: Any
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = 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[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_reconcile_configuration_request(
resource_group_name=resource_group_name,
account_name=account_name,
network_security_perimeter_configuration_name=network_security_perimeter_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202]:
try:
await response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
response_headers = {}
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace_async
async def begin_reconcile_configuration(
self,
resource_group_name: str,
account_name: str,
network_security_perimeter_configuration_name: str,
**kwargs: Any
) -> AsyncLROPoller[None]:
"""Reconciles the specified NSP configuration.
:param resource_group_name: The name of the resource group that contains the Batch account.
Required.
:type resource_group_name: str
:param account_name: The name of the Batch account. Required.
:type account_name: str
:param network_security_perimeter_configuration_name: The name for Network Security Perimeter
configuration. Required.
:type network_security_perimeter_configuration_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._reconcile_configuration_initial(
resource_group_name=resource_group_name,
account_name=account_name,
network_security_perimeter_configuration_name=network_security_perimeter_configuration_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(
AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
)
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore

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

@ -1,4 +1,4 @@
# pylint: disable=too-many-lines
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@ -19,16 +20,18 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._operations import build_list_request
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@ -56,7 +59,6 @@ class Operations:
def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]:
"""Lists available operations for the Microsoft.Batch provider.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Operation or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.Operation]
:raises ~azure.core.exceptions.HttpResponseError:
@ -67,7 +69,7 @@ class Operations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -78,14 +80,12 @@ class Operations:
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
_request = build_list_request(
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@ -97,13 +97,12 @@ class Operations:
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("OperationListResult", pipeline_response)
@ -113,11 +112,11 @@ class Operations:
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -128,5 +127,3 @@ class Operations:
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {"url": "/providers/Microsoft.Batch/operations"}

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

@ -1,4 +1,4 @@
# pylint: disable=too-many-lines
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import sys
from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@ -17,12 +18,13 @@ from azure.core.exceptions import (
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
StreamClosedError,
StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@ -30,7 +32,6 @@ from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._pool_operations import (
build_create_request,
build_delete_request,
@ -41,6 +42,10 @@ from ...operations._pool_operations import (
build_update_request,
)
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@ -102,7 +107,6 @@ class PoolOperations:
properties/scaleSettings/autoScale
properties/scaleSettings/fixedScale. Default value is None.
:type filter: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Pool or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.Pool]
:raises ~azure.core.exceptions.HttpResponseError:
@ -113,7 +117,7 @@ class PoolOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ListPoolsResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -124,7 +128,7 @@ class PoolOperations:
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_batch_account_request(
_request = build_list_by_batch_account_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
@ -132,12 +136,10 @@ class PoolOperations:
select=select,
filter=filter,
api_version=api_version,
template_url=self.list_by_batch_account.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@ -149,13 +151,12 @@ class PoolOperations:
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ListPoolsResult", pipeline_response)
@ -165,11 +166,11 @@ class PoolOperations:
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -181,10 +182,6 @@ class PoolOperations:
return AsyncItemPaged(get_next, extract_data)
list_by_batch_account.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools"
}
@overload
async def create(
self,
@ -219,7 +216,6 @@ class PoolOperations:
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Pool or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Pool
:raises ~azure.core.exceptions.HttpResponseError:
@ -231,7 +227,7 @@ class PoolOperations:
resource_group_name: str,
account_name: str,
pool_name: str,
parameters: IO,
parameters: IO[bytes],
if_match: Optional[str] = None,
if_none_match: Optional[str] = None,
*,
@ -248,7 +244,7 @@ class PoolOperations:
:param pool_name: The pool name. This must be unique within the account. Required.
:type pool_name: str
:param parameters: Additional parameters for pool creation. Required.
:type parameters: IO
:type parameters: IO[bytes]
:param if_match: The entity state (ETag) version of the pool to update. A value of "*" can be
used to apply the operation only if the pool already exists. If omitted, this operation will
always be applied. Default value is None.
@ -259,7 +255,6 @@ class PoolOperations:
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Pool or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Pool
:raises ~azure.core.exceptions.HttpResponseError:
@ -271,7 +266,7 @@ class PoolOperations:
resource_group_name: str,
account_name: str,
pool_name: str,
parameters: Union[_models.Pool, IO],
parameters: Union[_models.Pool, IO[bytes]],
if_match: Optional[str] = None,
if_none_match: Optional[str] = None,
**kwargs: Any
@ -285,9 +280,9 @@ class PoolOperations:
:type account_name: str
:param pool_name: The pool name. This must be unique within the account. Required.
:type pool_name: str
:param parameters: Additional parameters for pool creation. Is either a Pool type or a IO type.
Required.
:type parameters: ~azure.mgmt.batch.models.Pool or IO
:param parameters: Additional parameters for pool creation. Is either a Pool type or a
IO[bytes] type. Required.
:type parameters: ~azure.mgmt.batch.models.Pool or IO[bytes]
:param if_match: The entity state (ETag) version of the pool to update. A value of "*" can be
used to apply the operation only if the pool already exists. If omitted, this operation will
always be applied. Default value is None.
@ -295,15 +290,11 @@ class PoolOperations:
:param if_none_match: Set to '*' to allow a new pool to be created, but to prevent updating an
existing pool. Other values will be ignored. Default value is None.
:type if_none_match: str
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Pool or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Pool
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -326,7 +317,7 @@ class PoolOperations:
else:
_json = self._serialize.body(parameters, "Pool")
request = build_create_request(
_request = build_create_request(
resource_group_name=resource_group_name,
account_name=account_name,
pool_name=pool_name,
@ -337,16 +328,14 @@ class PoolOperations:
content_type=content_type,
json=_json,
content=_content,
template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -358,16 +347,12 @@ class PoolOperations:
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
deserialized = self._deserialize("Pool", pipeline_response)
deserialized = self._deserialize("Pool", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers)
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
create.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}"
}
return deserialized # type: ignore
@overload
async def update(
@ -399,7 +384,6 @@ class PoolOperations:
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Pool or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Pool
:raises ~azure.core.exceptions.HttpResponseError:
@ -411,7 +395,7 @@ class PoolOperations:
resource_group_name: str,
account_name: str,
pool_name: str,
parameters: IO,
parameters: IO[bytes],
if_match: Optional[str] = None,
*,
content_type: str = "application/json",
@ -428,14 +412,13 @@ class PoolOperations:
:type pool_name: str
:param parameters: Pool properties that should be updated. Properties that are supplied will be
updated, any property not supplied will be unchanged. Required.
:type parameters: IO
:type parameters: IO[bytes]
:param if_match: The entity state (ETag) version of the pool to update. This value can be
omitted or set to "*" to apply the operation unconditionally. Default value is None.
:type if_match: str
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Pool or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Pool
:raises ~azure.core.exceptions.HttpResponseError:
@ -447,7 +430,7 @@ class PoolOperations:
resource_group_name: str,
account_name: str,
pool_name: str,
parameters: Union[_models.Pool, IO],
parameters: Union[_models.Pool, IO[bytes]],
if_match: Optional[str] = None,
**kwargs: Any
) -> _models.Pool:
@ -461,21 +444,17 @@ class PoolOperations:
:param pool_name: The pool name. This must be unique within the account. Required.
:type pool_name: str
:param parameters: Pool properties that should be updated. Properties that are supplied will be
updated, any property not supplied will be unchanged. Is either a Pool type or a IO type.
Required.
:type parameters: ~azure.mgmt.batch.models.Pool or IO
updated, any property not supplied will be unchanged. Is either a Pool type or a IO[bytes]
type. Required.
:type parameters: ~azure.mgmt.batch.models.Pool or IO[bytes]
:param if_match: The entity state (ETag) version of the pool to update. This value can be
omitted or set to "*" to apply the operation unconditionally. Default value is None.
:type if_match: str
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Pool or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Pool
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -498,7 +477,7 @@ class PoolOperations:
else:
_json = self._serialize.body(parameters, "Pool")
request = build_update_request(
_request = build_update_request(
resource_group_name=resource_group_name,
account_name=account_name,
pool_name=pool_name,
@ -508,16 +487,14 @@ class PoolOperations:
content_type=content_type,
json=_json,
content=_content,
template_url=self.update.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -529,21 +506,17 @@ class PoolOperations:
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
deserialized = self._deserialize("Pool", pipeline_response)
deserialized = self._deserialize("Pool", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers)
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
return deserialized # type: ignore
update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}"
}
async def _delete_initial( # pylint: disable=inconsistent-return-statements
async def _delete_initial(
self, resource_group_name: str, account_name: str, pool_name: str, **kwargs: Any
) -> None:
error_map = {
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -555,29 +528,32 @@ class PoolOperations:
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
request = build_delete_request(
_request = build_delete_request(
resource_group_name=resource_group_name,
account_name=account_name,
pool_name=pool_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
try:
await response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@ -586,12 +562,12 @@ class PoolOperations:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After"))
if cls:
return cls(pipeline_response, None, response_headers)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}"
}
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@ -606,14 +582,6 @@ class PoolOperations:
:type account_name: str
:param pool_name: The pool name. This must be unique within the account. Required.
:type pool_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
@ -627,7 +595,7 @@ class PoolOperations:
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_initial( # type: ignore
raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
account_name=account_name,
pool_name=pool_name,
@ -637,11 +605,12 @@ class PoolOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(
@ -652,17 +621,13 @@ class PoolOperations:
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}"
}
return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace_async
async def get(self, resource_group_name: str, account_name: str, pool_name: str, **kwargs: Any) -> _models.Pool:
@ -675,12 +640,11 @@ class PoolOperations:
:type account_name: str
:param pool_name: The pool name. This must be unique within the account. Required.
:type pool_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Pool or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Pool
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -694,22 +658,20 @@ class PoolOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.Pool] = kwargs.pop("cls", None)
request = build_get_request(
_request = build_get_request(
resource_group_name=resource_group_name,
account_name=account_name,
pool_name=pool_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -721,16 +683,12 @@ class PoolOperations:
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
deserialized = self._deserialize("Pool", pipeline_response)
deserialized = self._deserialize("Pool", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers)
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}"
}
return deserialized # type: ignore
@distributed_trace_async
async def disable_auto_scale(
@ -745,12 +703,11 @@ class PoolOperations:
:type account_name: str
:param pool_name: The pool name. This must be unique within the account. Required.
:type pool_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Pool or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Pool
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -764,22 +721,20 @@ class PoolOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.Pool] = kwargs.pop("cls", None)
request = build_disable_auto_scale_request(
_request = build_disable_auto_scale_request(
resource_group_name=resource_group_name,
account_name=account_name,
pool_name=pool_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.disable_auto_scale.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -791,16 +746,12 @@ class PoolOperations:
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
deserialized = self._deserialize("Pool", pipeline_response)
deserialized = self._deserialize("Pool", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers)
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
disable_auto_scale.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/disableAutoScale"
}
return deserialized # type: ignore
@distributed_trace_async
async def stop_resize(
@ -822,12 +773,11 @@ class PoolOperations:
:type account_name: str
:param pool_name: The pool name. This must be unique within the account. Required.
:type pool_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Pool or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Pool
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -841,22 +791,20 @@ class PoolOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.Pool] = kwargs.pop("cls", None)
request = build_stop_resize_request(
_request = build_stop_resize_request(
resource_group_name=resource_group_name,
account_name=account_name,
pool_name=pool_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.stop_resize.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -868,13 +816,9 @@ class PoolOperations:
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
deserialized = self._deserialize("Pool", pipeline_response)
deserialized = self._deserialize("Pool", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers)
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
stop_resize.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/stopResize"
}
return deserialized # type: ignore

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

@ -1,4 +1,4 @@
# pylint: disable=too-many-lines
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import sys
from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@ -17,12 +18,13 @@ from azure.core.exceptions import (
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
StreamClosedError,
StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@ -30,7 +32,6 @@ from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._private_endpoint_connection_operations import (
build_delete_request,
build_get_request,
@ -38,6 +39,10 @@ from ...operations._private_endpoint_connection_operations import (
build_update_request,
)
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@ -75,7 +80,6 @@ class PrivateEndpointConnectionOperations:
:param maxresults: The maximum number of items to return in the response. Default value is
None.
:type maxresults: int
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PrivateEndpointConnection or the result of
cls(response)
:rtype:
@ -88,7 +92,7 @@ class PrivateEndpointConnectionOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ListPrivateEndpointConnectionsResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -99,18 +103,16 @@ class PrivateEndpointConnectionOperations:
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_batch_account_request(
_request = build_list_by_batch_account_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
maxresults=maxresults,
api_version=api_version,
template_url=self.list_by_batch_account.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@ -122,13 +124,12 @@ class PrivateEndpointConnectionOperations:
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ListPrivateEndpointConnectionsResult", pipeline_response)
@ -138,11 +139,11 @@ class PrivateEndpointConnectionOperations:
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -154,10 +155,6 @@ class PrivateEndpointConnectionOperations:
return AsyncItemPaged(get_next, extract_data)
list_by_batch_account.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections"
}
@distributed_trace_async
async def get(
self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any
@ -172,12 +169,11 @@ class PrivateEndpointConnectionOperations:
:param private_endpoint_connection_name: The private endpoint connection name. This must be
unique within the account. Required.
:type private_endpoint_connection_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PrivateEndpointConnection or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -191,22 +187,20 @@ class PrivateEndpointConnectionOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None)
request = build_get_request(
_request = build_get_request(
resource_group_name=resource_group_name,
account_name=account_name,
private_endpoint_connection_name=private_endpoint_connection_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -215,27 +209,23 @@ class PrivateEndpointConnectionOperations:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response)
deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"
}
return deserialized # type: ignore
async def _update_initial(
self,
resource_group_name: str,
account_name: str,
private_endpoint_connection_name: str,
parameters: Union[_models.PrivateEndpointConnection, IO],
parameters: Union[_models.PrivateEndpointConnection, IO[bytes]],
if_match: Optional[str] = None,
**kwargs: Any
) -> Optional[_models.PrivateEndpointConnection]:
error_map = {
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -248,7 +238,7 @@ class PrivateEndpointConnectionOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -258,7 +248,7 @@ class PrivateEndpointConnectionOperations:
else:
_json = self._serialize.body(parameters, "PrivateEndpointConnection")
request = build_update_request(
_request = build_update_request(
resource_group_name=resource_group_name,
account_name=account_name,
private_endpoint_connection_name=private_endpoint_connection_name,
@ -268,41 +258,38 @@ class PrivateEndpointConnectionOperations:
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
await response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = None
response_headers = {}
if response.status_code == 200:
deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response)
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers)
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"
}
return deserialized # type: ignore
@overload
async def begin_update(
@ -336,14 +323,6 @@ class PrivateEndpointConnectionOperations:
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.batch.models.PrivateEndpointConnection]
@ -356,7 +335,7 @@ class PrivateEndpointConnectionOperations:
resource_group_name: str,
account_name: str,
private_endpoint_connection_name: str,
parameters: IO,
parameters: IO[bytes],
if_match: Optional[str] = None,
*,
content_type: str = "application/json",
@ -374,7 +353,7 @@ class PrivateEndpointConnectionOperations:
:type private_endpoint_connection_name: str
:param parameters: PrivateEndpointConnection properties that should be updated. Properties that
are supplied will be updated, any property not supplied will be unchanged. Required.
:type parameters: IO
:type parameters: IO[bytes]
:param if_match: The state (ETag) version of the private endpoint connection to update. This
value can be omitted or set to "*" to apply the operation unconditionally. Default value is
None.
@ -382,14 +361,6 @@ class PrivateEndpointConnectionOperations:
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.batch.models.PrivateEndpointConnection]
@ -402,7 +373,7 @@ class PrivateEndpointConnectionOperations:
resource_group_name: str,
account_name: str,
private_endpoint_connection_name: str,
parameters: Union[_models.PrivateEndpointConnection, IO],
parameters: Union[_models.PrivateEndpointConnection, IO[bytes]],
if_match: Optional[str] = None,
**kwargs: Any
) -> AsyncLROPoller[_models.PrivateEndpointConnection]:
@ -418,23 +389,12 @@ class PrivateEndpointConnectionOperations:
:type private_endpoint_connection_name: str
:param parameters: PrivateEndpointConnection properties that should be updated. Properties that
are supplied will be updated, any property not supplied will be unchanged. Is either a
PrivateEndpointConnection type or a IO type. Required.
:type parameters: ~azure.mgmt.batch.models.PrivateEndpointConnection or IO
PrivateEndpointConnection type or a IO[bytes] type. Required.
:type parameters: ~azure.mgmt.batch.models.PrivateEndpointConnection or IO[bytes]
:param if_match: The state (ETag) version of the private endpoint connection to update. This
value can be omitted or set to "*" to apply the operation unconditionally. Default value is
None.
:type if_match: str
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.batch.models.PrivateEndpointConnection]
@ -463,12 +423,13 @@ class PrivateEndpointConnectionOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response)
deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@ -481,22 +442,20 @@ class PrivateEndpointConnectionOperations:
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
return AsyncLROPoller[_models.PrivateEndpointConnection].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
return AsyncLROPoller[_models.PrivateEndpointConnection](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
begin_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"
}
async def _delete_initial( # pylint: disable=inconsistent-return-statements
async def _delete_initial(
self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any
) -> None:
error_map = {
) -> AsyncIterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -508,29 +467,32 @@ class PrivateEndpointConnectionOperations:
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
request = build_delete_request(
_request = build_delete_request(
resource_group_name=resource_group_name,
account_name=account_name,
private_endpoint_connection_name=private_endpoint_connection_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202, 204]:
try:
await response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@ -539,12 +501,12 @@ class PrivateEndpointConnectionOperations:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After"))
if cls:
return cls(pipeline_response, None, response_headers)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"
}
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@ -560,14 +522,6 @@ class PrivateEndpointConnectionOperations:
:param private_endpoint_connection_name: The private endpoint connection name. This must be
unique within the account. Required.
:type private_endpoint_connection_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
@ -581,7 +535,7 @@ class PrivateEndpointConnectionOperations:
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_initial( # type: ignore
raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
account_name=account_name,
private_endpoint_connection_name=private_endpoint_connection_name,
@ -591,11 +545,12 @@ class PrivateEndpointConnectionOperations:
params=_params,
**kwargs
)
await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(
@ -607,14 +562,10 @@ class PrivateEndpointConnectionOperations:
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"
}
return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore

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

@ -1,4 +1,4 @@
# pylint: disable=too-many-lines
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@ -19,17 +20,19 @@ from azure.core.exceptions import (
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.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._private_link_resource_operations import build_get_request, build_list_by_batch_account_request
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@ -67,7 +70,6 @@ class PrivateLinkResourceOperations:
:param maxresults: The maximum number of items to return in the response. Default value is
None.
:type maxresults: int
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PrivateLinkResource or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.PrivateLinkResource]
:raises ~azure.core.exceptions.HttpResponseError:
@ -78,7 +80,7 @@ class PrivateLinkResourceOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ListPrivateLinkResourcesResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -89,18 +91,16 @@ class PrivateLinkResourceOperations:
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_batch_account_request(
_request = build_list_by_batch_account_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
maxresults=maxresults,
api_version=api_version,
template_url=self.list_by_batch_account.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@ -112,13 +112,12 @@ class PrivateLinkResourceOperations:
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ListPrivateLinkResourcesResult", pipeline_response)
@ -128,11 +127,11 @@ class PrivateLinkResourceOperations:
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -144,10 +143,6 @@ class PrivateLinkResourceOperations:
return AsyncItemPaged(get_next, extract_data)
list_by_batch_account.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateLinkResources"
}
@distributed_trace_async
async def get(
self, resource_group_name: str, account_name: str, private_link_resource_name: str, **kwargs: Any
@ -162,12 +157,11 @@ class PrivateLinkResourceOperations:
:param private_link_resource_name: The private link resource name. This must be unique within
the account. Required.
:type private_link_resource_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PrivateLinkResource or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.PrivateLinkResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -181,22 +175,20 @@ class PrivateLinkResourceOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None)
request = build_get_request(
_request = build_get_request(
resource_group_name=resource_group_name,
account_name=account_name,
private_link_resource_name=private_link_resource_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -205,13 +197,9 @@ class PrivateLinkResourceOperations:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("PrivateLinkResource", pipeline_response)
deserialized = self._deserialize("PrivateLinkResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateLinkResources/{privateLinkResourceName}"
}
return deserialized # type: ignore

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

@ -6,6 +6,9 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from ._models_py3 import AccessRule
from ._models_py3 import AccessRuleProperties
from ._models_py3 import AccessRulePropertiesSubscriptionsItem
from ._models_py3 import ActivateApplicationPackageParameters
from ._models_py3 import Application
from ._models_py3 import ApplicationPackage
@ -19,6 +22,8 @@ from ._models_py3 import AutoUserSpecification
from ._models_py3 import AutomaticOSUpgradePolicy
from ._models_py3 import AzureBlobFileSystemConfiguration
from ._models_py3 import AzureFileShareConfiguration
from ._models_py3 import AzureProxyResource
from ._models_py3 import AzureResource
from ._models_py3 import BatchAccount
from ._models_py3 import BatchAccountCreateParameters
from ._models_py3 import BatchAccountIdentity
@ -38,9 +43,9 @@ from ._models_py3 import CertificateReference
from ._models_py3 import CheckNameAvailabilityParameters
from ._models_py3 import CheckNameAvailabilityResult
from ._models_py3 import CloudErrorBody
from ._models_py3 import CloudServiceConfiguration
from ._models_py3 import ComputeNodeIdentityReference
from ._models_py3 import ContainerConfiguration
from ._models_py3 import ContainerHostBatchBindMountEntry
from ._models_py3 import ContainerRegistry
from ._models_py3 import DataDisk
from ._models_py3 import DeleteCertificateError
@ -54,6 +59,9 @@ from ._models_py3 import EndpointAccessProfile
from ._models_py3 import EndpointDependency
from ._models_py3 import EndpointDetail
from ._models_py3 import EnvironmentSetting
from ._models_py3 import ErrorAdditionalInfo
from ._models_py3 import ErrorDetail
from ._models_py3 import ErrorResponse
from ._models_py3 import FixedScaleSettings
from ._models_py3 import IPRule
from ._models_py3 import ImageReference
@ -74,6 +82,11 @@ from ._models_py3 import NFSMountConfiguration
from ._models_py3 import NetworkConfiguration
from ._models_py3 import NetworkProfile
from ._models_py3 import NetworkSecurityGroupRule
from ._models_py3 import NetworkSecurityPerimeter
from ._models_py3 import NetworkSecurityPerimeterConfiguration
from ._models_py3 import NetworkSecurityPerimeterConfigurationListResult
from ._models_py3 import NetworkSecurityPerimeterConfigurationProperties
from ._models_py3 import NetworkSecurityProfile
from ._models_py3 import NodePlacementConfiguration
from ._models_py3 import OSDisk
from ._models_py3 import Operation
@ -87,11 +100,14 @@ from ._models_py3 import PrivateEndpoint
from ._models_py3 import PrivateEndpointConnection
from ._models_py3 import PrivateLinkResource
from ._models_py3 import PrivateLinkServiceConnectionState
from ._models_py3 import ProvisioningIssue
from ._models_py3 import ProvisioningIssueProperties
from ._models_py3 import ProxyResource
from ._models_py3 import PublicIPAddressConfiguration
from ._models_py3 import ResizeError
from ._models_py3 import ResizeOperationStatus
from ._models_py3 import Resource
from ._models_py3 import ResourceAssociation
from ._models_py3 import ResourceFile
from ._models_py3 import RollingUpgradePolicy
from ._models_py3 import ScaleSettings
@ -101,6 +117,7 @@ from ._models_py3 import SkuCapability
from ._models_py3 import StartTask
from ._models_py3 import SupportedSku
from ._models_py3 import SupportedSkusResult
from ._models_py3 import SystemData
from ._models_py3 import TaskContainerSettings
from ._models_py3 import TaskSchedulingPolicy
from ._models_py3 import UefiSettings
@ -108,12 +125,14 @@ from ._models_py3 import UpgradePolicy
from ._models_py3 import UserAccount
from ._models_py3 import UserAssignedIdentities
from ._models_py3 import UserIdentity
from ._models_py3 import VMDiskSecurityProfile
from ._models_py3 import VMExtension
from ._models_py3 import VirtualMachineConfiguration
from ._models_py3 import VirtualMachineFamilyCoreQuota
from ._models_py3 import WindowsConfiguration
from ._models_py3 import WindowsUserConfiguration
from ._batch_management_client_enums import AccessRuleDirection
from ._batch_management_client_enums import AccountKeyType
from ._batch_management_client_enums import AllocationState
from ._batch_management_client_enums import AuthenticationMode
@ -126,8 +145,10 @@ from ._batch_management_client_enums import CertificateStoreLocation
from ._batch_management_client_enums import CertificateVisibility
from ._batch_management_client_enums import ComputeNodeDeallocationOption
from ._batch_management_client_enums import ComputeNodeFillType
from ._batch_management_client_enums import ContainerHostDataPath
from ._batch_management_client_enums import ContainerType
from ._batch_management_client_enums import ContainerWorkingDirectory
from ._batch_management_client_enums import CreatedByType
from ._batch_management_client_enums import DiskEncryptionTarget
from ._batch_management_client_enums import DynamicVNetAssignmentScope
from ._batch_management_client_enums import ElevationLevel
@ -135,10 +156,12 @@ from ._batch_management_client_enums import EndpointAccessDefaultAction
from ._batch_management_client_enums import IPAddressProvisioningType
from ._batch_management_client_enums import InboundEndpointProtocol
from ._batch_management_client_enums import InterNodeCommunicationState
from ._batch_management_client_enums import IssueType
from ._batch_management_client_enums import KeySource
from ._batch_management_client_enums import LoginMode
from ._batch_management_client_enums import NameAvailabilityReason
from ._batch_management_client_enums import NetworkSecurityGroupRuleAccess
from ._batch_management_client_enums import NetworkSecurityPerimeterConfigurationProvisioningState
from ._batch_management_client_enums import NodeCommunicationMode
from ._batch_management_client_enums import NodePlacementPolicyType
from ._batch_management_client_enums import PackageState
@ -149,7 +172,11 @@ from ._batch_management_client_enums import PrivateEndpointConnectionProvisionin
from ._batch_management_client_enums import PrivateLinkServiceConnectionStatus
from ._batch_management_client_enums import ProvisioningState
from ._batch_management_client_enums import PublicNetworkAccessType
from ._batch_management_client_enums import ResourceAssociationAccessMode
from ._batch_management_client_enums import ResourceIdentityType
from ._batch_management_client_enums import SecurityEncryptionTypes
from ._batch_management_client_enums import SecurityTypes
from ._batch_management_client_enums import Severity
from ._batch_management_client_enums import StorageAccountType
from ._batch_management_client_enums import UpgradeMode
from ._patch import __all__ as _patch_all
@ -157,6 +184,9 @@ from ._patch import * # pylint: disable=unused-wildcard-import
from ._patch import patch_sdk as _patch_sdk
__all__ = [
"AccessRule",
"AccessRuleProperties",
"AccessRulePropertiesSubscriptionsItem",
"ActivateApplicationPackageParameters",
"Application",
"ApplicationPackage",
@ -170,6 +200,8 @@ __all__ = [
"AutomaticOSUpgradePolicy",
"AzureBlobFileSystemConfiguration",
"AzureFileShareConfiguration",
"AzureProxyResource",
"AzureResource",
"BatchAccount",
"BatchAccountCreateParameters",
"BatchAccountIdentity",
@ -189,9 +221,9 @@ __all__ = [
"CheckNameAvailabilityParameters",
"CheckNameAvailabilityResult",
"CloudErrorBody",
"CloudServiceConfiguration",
"ComputeNodeIdentityReference",
"ContainerConfiguration",
"ContainerHostBatchBindMountEntry",
"ContainerRegistry",
"DataDisk",
"DeleteCertificateError",
@ -205,6 +237,9 @@ __all__ = [
"EndpointDependency",
"EndpointDetail",
"EnvironmentSetting",
"ErrorAdditionalInfo",
"ErrorDetail",
"ErrorResponse",
"FixedScaleSettings",
"IPRule",
"ImageReference",
@ -225,6 +260,11 @@ __all__ = [
"NetworkConfiguration",
"NetworkProfile",
"NetworkSecurityGroupRule",
"NetworkSecurityPerimeter",
"NetworkSecurityPerimeterConfiguration",
"NetworkSecurityPerimeterConfigurationListResult",
"NetworkSecurityPerimeterConfigurationProperties",
"NetworkSecurityProfile",
"NodePlacementConfiguration",
"OSDisk",
"Operation",
@ -238,11 +278,14 @@ __all__ = [
"PrivateEndpointConnection",
"PrivateLinkResource",
"PrivateLinkServiceConnectionState",
"ProvisioningIssue",
"ProvisioningIssueProperties",
"ProxyResource",
"PublicIPAddressConfiguration",
"ResizeError",
"ResizeOperationStatus",
"Resource",
"ResourceAssociation",
"ResourceFile",
"RollingUpgradePolicy",
"ScaleSettings",
@ -252,6 +295,7 @@ __all__ = [
"StartTask",
"SupportedSku",
"SupportedSkusResult",
"SystemData",
"TaskContainerSettings",
"TaskSchedulingPolicy",
"UefiSettings",
@ -259,11 +303,13 @@ __all__ = [
"UserAccount",
"UserAssignedIdentities",
"UserIdentity",
"VMDiskSecurityProfile",
"VMExtension",
"VirtualMachineConfiguration",
"VirtualMachineFamilyCoreQuota",
"WindowsConfiguration",
"WindowsUserConfiguration",
"AccessRuleDirection",
"AccountKeyType",
"AllocationState",
"AuthenticationMode",
@ -276,8 +322,10 @@ __all__ = [
"CertificateVisibility",
"ComputeNodeDeallocationOption",
"ComputeNodeFillType",
"ContainerHostDataPath",
"ContainerType",
"ContainerWorkingDirectory",
"CreatedByType",
"DiskEncryptionTarget",
"DynamicVNetAssignmentScope",
"ElevationLevel",
@ -285,10 +333,12 @@ __all__ = [
"IPAddressProvisioningType",
"InboundEndpointProtocol",
"InterNodeCommunicationState",
"IssueType",
"KeySource",
"LoginMode",
"NameAvailabilityReason",
"NetworkSecurityGroupRuleAccess",
"NetworkSecurityPerimeterConfigurationProvisioningState",
"NodeCommunicationMode",
"NodePlacementPolicyType",
"PackageState",
@ -299,7 +349,11 @@ __all__ = [
"PrivateLinkServiceConnectionStatus",
"ProvisioningState",
"PublicNetworkAccessType",
"ResourceAssociationAccessMode",
"ResourceIdentityType",
"SecurityEncryptionTypes",
"SecurityTypes",
"Severity",
"StorageAccountType",
"UpgradeMode",
]

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

@ -10,6 +10,15 @@ from enum import Enum
from azure.core import CaseInsensitiveEnumMeta
class AccessRuleDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Direction of Access Rule."""
INBOUND = "Inbound"
"""Applies to inbound network traffic to the secured resources."""
OUTBOUND = "Outbound"
"""Applies to outbound network traffic from the secured resources"""
class AccountKeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The type of account key to regenerate."""
@ -24,13 +33,13 @@ class AllocationState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
STEADY = "Steady"
"""The pool is not resizing. There are no changes to the number of nodes in the pool in progress.
#: A pool enters this state when it is created and when no operations are being performed on the
#: pool to change the number of nodes."""
A pool enters this state when it is created and when no operations are being performed on the
pool to change the number of nodes."""
RESIZING = "Resizing"
"""The pool is resizing; that is, compute nodes are being added to or removed from the pool."""
STOPPING = "Stopping"
"""The pool was resizing, but the user has requested that the resize be stopped, but the stop
#: request has not yet been completed."""
request has not yet been completed."""
class AuthenticationMode(str, Enum, metaclass=CaseInsensitiveEnumMeta):
@ -51,7 +60,7 @@ class AutoStorageAuthenticationMode(str, Enum, metaclass=CaseInsensitiveEnumMeta
"""The Batch service will authenticate requests to auto-storage using storage account keys."""
BATCH_ACCOUNT_MANAGED_IDENTITY = "BatchAccountManagedIdentity"
"""The Batch service will authenticate requests to auto-storage using the managed identity
#: assigned to the Batch account."""
assigned to the Batch account."""
class AutoUserScope(str, Enum, metaclass=CaseInsensitiveEnumMeta):
@ -65,7 +74,7 @@ class AutoUserScope(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Specifies that the service should create a new user for the task."""
POOL = "Pool"
"""Specifies that the task runs as the common auto user account which is created on every node in
#: a pool."""
a pool."""
class CachingType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
@ -95,24 +104,23 @@ class CertificateProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta)
"""The certificate is available for use in pools."""
DELETING = "Deleting"
"""The user has requested that the certificate be deleted, but the delete operation has not yet
#: completed. You may not reference the certificate when creating or updating pools."""
completed. You may not reference the certificate when creating or updating pools."""
FAILED = "Failed"
"""The user requested that the certificate be deleted, but there are pools that still have
#: references to the certificate, or it is still installed on one or more compute nodes. (The
#: latter can occur if the certificate has been removed from the pool, but the node has not yet
#: restarted. Nodes refresh their certificates only when they restart.) You may use the cancel
#: certificate delete operation to cancel the delete, or the delete certificate operation to retry
#: the delete."""
references to the certificate, or it is still installed on one or more compute nodes. (The
latter can occur if the certificate has been removed from the pool, but the node has not yet
restarted. Nodes refresh their certificates only when they restart.) You may use the cancel
certificate delete operation to cancel the delete, or the delete certificate operation to retry
the delete."""
class CertificateStoreLocation(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The default value is currentUser. This property is applicable only for pools configured with
Windows nodes (that is, created with cloudServiceConfiguration, or with
virtualMachineConfiguration using a Windows image reference). For Linux compute nodes, the
certificates are stored in a directory inside the task working directory and an environment
variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For
certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home
directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory.
Windows compute nodes. For Linux compute nodes, the certificates are stored in a directory
inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is
supplied to the task to query for this location. For certificates with visibility of
'remoteUser', a 'certs' directory is created in the user's home directory (e.g.,
/home/{user-name}/certs) and certificates are placed in that directory.
"""
CURRENT_USER = "CurrentUser"
@ -126,13 +134,13 @@ class CertificateVisibility(str, Enum, metaclass=CaseInsensitiveEnumMeta):
START_TASK = "StartTask"
"""The certificate should be visible to the user account under which the start task is run. Note
#: that if AutoUser Scope is Pool for both the StartTask and a Task, this certificate will be
#: visible to the Task as well."""
that if AutoUser Scope is Pool for both the StartTask and a Task, this certificate will be
visible to the Task as well."""
TASK = "Task"
"""The certificate should be visible to the user accounts under which job tasks are run."""
REMOTE_USER = "RemoteUser"
"""The certificate should be visible to the user accounts under which users remotely access the
#: node."""
node."""
class ComputeNodeDeallocationOption(str, Enum, metaclass=CaseInsensitiveEnumMeta):
@ -142,17 +150,17 @@ class ComputeNodeDeallocationOption(str, Enum, metaclass=CaseInsensitiveEnumMeta
REQUEUE = "Requeue"
"""Terminate running task processes and requeue the tasks. The tasks will run again when a node is
#: available. Remove nodes as soon as tasks have been terminated."""
available. Remove nodes as soon as tasks have been terminated."""
TERMINATE = "Terminate"
"""Terminate running tasks. The tasks will be completed with failureInfo indicating that they were
#: terminated, and will not run again. Remove nodes as soon as tasks have been terminated."""
terminated, and will not run again. Remove nodes as soon as tasks have been terminated."""
TASK_COMPLETION = "TaskCompletion"
"""Allow currently running tasks to complete. Schedule no new tasks while waiting. Remove nodes
#: when all tasks have completed."""
when all tasks have completed."""
RETAINED_DATA = "RetainedData"
"""Allow currently running tasks to complete, then wait for all task data retention periods to
#: expire. Schedule no new tasks while waiting. Remove nodes when all task retention periods have
#: expired."""
expire. Schedule no new tasks while waiting. Remove nodes when all task retention periods have
expired."""
class ComputeNodeFillType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
@ -162,7 +170,24 @@ class ComputeNodeFillType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Tasks should be assigned evenly across all nodes in the pool."""
PACK = "Pack"
"""As many tasks as possible (taskSlotsPerNode) should be assigned to each node in the pool before
#: any tasks are assigned to the next node in the pool."""
any tasks are assigned to the next node in the pool."""
class ContainerHostDataPath(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The paths which will be mounted to container task's container."""
SHARED = "Shared"
"""The path for multi-instances task to shared their files."""
STARTUP = "Startup"
"""The path for start task."""
VFS_MOUNTS = "VfsMounts"
"""The path contains all virtual file systems are mounted on this node."""
TASK = "Task"
"""The task path."""
JOB_PREP = "JobPrep"
"""The job-prep task path."""
APPLICATIONS = "Applications"
"""The applications path."""
class ContainerType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
@ -181,10 +206,19 @@ class ContainerWorkingDirectory(str, Enum, metaclass=CaseInsensitiveEnumMeta):
TASK_WORKING_DIRECTORY = "TaskWorkingDirectory"
"""Use the standard Batch service task working directory, which will contain the Task resource
#: files populated by Batch."""
files populated by Batch."""
CONTAINER_IMAGE_DEFAULT = "ContainerImageDefault"
"""Using container image defined working directory. Beware that this directory will not contain
#: the resource files downloaded by Batch."""
the resource files downloaded by Batch."""
class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The type of identity that created the resource."""
USER = "User"
APPLICATION = "Application"
MANAGED_IDENTITY = "ManagedIdentity"
KEY = "Key"
class DiskEncryptionTarget(str, Enum, metaclass=CaseInsensitiveEnumMeta):
@ -194,7 +228,7 @@ class DiskEncryptionTarget(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The OS Disk on the compute node is encrypted."""
TEMPORARY_DISK = "TemporaryDisk"
"""The temporary disk on the compute node is encrypted. On Linux this encryption applies to other
#: partitions (such as those on mounted data disks) when encryption occurs at boot time."""
partitions (such as those on mounted data disks) when encryption occurs at boot time."""
class DynamicVNetAssignmentScope(str, Enum, metaclass=CaseInsensitiveEnumMeta):
@ -204,7 +238,7 @@ class DynamicVNetAssignmentScope(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""No dynamic VNet assignment is enabled."""
JOB = "job"
"""Dynamic VNet assignment is done per-job. If this value is set, the network configuration subnet
#: ID must also be set. This feature requires approval before use, please contact support"""
ID must also be set. This feature requires approval before use, please contact support"""
class ElevationLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta):
@ -251,13 +285,29 @@ class IPAddressProvisioningType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
BATCH_MANAGED = "BatchManaged"
"""A public IP will be created and managed by Batch. There may be multiple public IPs depending on
#: the size of the Pool."""
the size of the Pool."""
USER_MANAGED = "UserManaged"
"""Public IPs are provided by the user and will be used to provision the Compute Nodes."""
NO_PUBLIC_IP_ADDRESSES = "NoPublicIPAddresses"
"""No public IP Address will be created for the Compute Nodes in the Pool."""
class IssueType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Type of issue."""
UNKNOWN = "Unknown"
"""Unknown issue type"""
CONFIGURATION_PROPAGATION_FAILURE = "ConfigurationPropagationFailure"
"""An error occurred while applying the network security perimeter (NSP) configuration."""
MISSING_PERIMETER_CONFIGURATION = "MissingPerimeterConfiguration"
"""A network connectivity issue is happening on the resource which could be addressed either by
adding new resources to the network security perimeter (NSP) or by modifying access rules."""
MISSING_IDENTITY_CONFIGURATION = "MissingIdentityConfiguration"
"""An managed identity hasn't been associated with the resource. The resource will still be able
to validate inbound traffic from the network security perimeter (NSP) or matching inbound
access rules, but it won't be able to perform outbound access as a member of the NSP."""
class KeySource(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Type of the key source."""
@ -265,22 +315,20 @@ class KeySource(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Batch creates and manages the encryption keys used to protect the account data."""
MICROSOFT_KEY_VAULT = "Microsoft.KeyVault"
"""The encryption keys used to protect the account data are stored in an external key vault. If
#: this is set then the Batch Account identity must be set to ``SystemAssigned`` and a valid Key
#: Identifier must also be supplied under the keyVaultProperties."""
this is set then the Batch Account identity must be set to ``SystemAssigned`` and a valid Key
Identifier must also be supplied under the keyVaultProperties."""
class LoginMode(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Specifies login mode for the user. The default value for VirtualMachineConfiguration pools is
interactive mode and for CloudServiceConfiguration pools is batch mode.
"""
"""Specifies login mode for the user. The default value is Interactive."""
BATCH = "Batch"
"""The LOGON32_LOGON_BATCH Win32 login mode. The batch login mode is recommended for long running
#: parallel processes."""
parallel processes."""
INTERACTIVE = "Interactive"
"""The LOGON32_LOGON_INTERACTIVE Win32 login mode. Some applications require having permissions
#: associated with the interactive login mode. If this is the case for an application used in your
#: task, then this option is recommended."""
associated with the interactive login mode. If this is the case for an application used in your
task, then this option is recommended."""
class NameAvailabilityReason(str, Enum, metaclass=CaseInsensitiveEnumMeta):
@ -303,6 +351,20 @@ class NetworkSecurityGroupRuleAccess(str, Enum, metaclass=CaseInsensitiveEnumMet
"""Deny access."""
class NetworkSecurityPerimeterConfigurationProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Provisioning state of a network security perimeter configuration that is being created or
updated.
"""
SUCCEEDED = "Succeeded"
CREATING = "Creating"
UPDATING = "Updating"
DELETING = "Deleting"
ACCEPTED = "Accepted"
FAILED = "Failed"
CANCELED = "Canceled"
class NodeCommunicationMode(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Determines how a pool communicates with the Batch service."""
@ -310,11 +372,11 @@ class NodeCommunicationMode(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The node communication mode is automatically set by the Batch service."""
CLASSIC = "Classic"
"""Nodes using the Classic communication mode require inbound TCP communication on ports 29876 and
#: 29877 from the "BatchNodeManagement.{region}" service tag and outbound TCP communication on
#: port 443 to the "Storage.region" and "BatchNodeManagement.{region}" service tags."""
29877 from the "BatchNodeManagement.{region}" service tag and outbound TCP communication on
port 443 to the "Storage.region" and "BatchNodeManagement.{region}" service tags."""
SIMPLIFIED = "Simplified"
"""Nodes using the Simplified communication mode require outbound TCP communication on port 443 to
#: the "BatchNodeManagement.{region}" service tag. No open inbound ports are required."""
the "BatchNodeManagement.{region}" service tag. No open inbound ports are required."""
class NodePlacementPolicyType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
@ -351,7 +413,7 @@ class PoolIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Batch pool has user assigned identities with it."""
NONE = "None"
"""Batch pool has no identity associated with it. Setting ``None`` in update pool will remove
#: existing identities."""
existing identities."""
class PoolProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
@ -361,7 +423,7 @@ class PoolProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The pool is available to run tasks subject to the availability of compute nodes."""
DELETING = "Deleting"
"""The user has requested that the pool be deleted, but the delete operation has not yet
#: completed."""
completed."""
class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
@ -371,14 +433,14 @@ class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsens
"""The connection is creating."""
UPDATING = "Updating"
"""The user has requested that the connection status be updated, but the update operation has not
#: yet completed. You may not reference the connection when connecting the Batch account."""
yet completed. You may not reference the connection when connecting the Batch account."""
DELETING = "Deleting"
"""The connection is deleting."""
SUCCEEDED = "Succeeded"
"""The connection status is final and is ready for use if Status is Approved."""
FAILED = "Failed"
"""The user requested that the connection be updated and it failed. You may retry the update
#: operation."""
operation."""
CANCELLED = "Cancelled"
"""The user has cancelled the connection creation."""
@ -420,7 +482,20 @@ class PublicNetworkAccessType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Enables connectivity to Azure Batch through public DNS."""
DISABLED = "Disabled"
"""Disables public connectivity and enables private connectivity to Azure Batch Service through
#: private endpoint resource."""
private endpoint resource."""
SECURED_BY_PERIMETER = "SecuredByPerimeter"
"""Secures connectivity to Azure Batch through NSP configuration."""
class ResourceAssociationAccessMode(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Access mode of the resource association."""
ENFORCED = "Enforced"
"""Enforced access mode - traffic to the resource that failed access checks is blocked"""
LEARNING = "Learning"
"""Learning access mode - traffic to the resource is enabled for analysis but not blocked"""
AUDIT = "Audit"
"""Audit access mode - traffic to the resource that fails access checks is logged but not blocked"""
class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
@ -432,7 +507,39 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Batch account has user assigned identities with it."""
NONE = "None"
"""Batch account has no identity associated with it. Setting ``None`` in update account will
#: remove existing identities."""
remove existing identities."""
class SecurityEncryptionTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Specifies the EncryptionType of the managed disk. It is set to VMGuestStateOnly for encryption
of just the VMGuestState blob, and NonPersistedTPM for not persisting firmware state in the
VMGuestState blob. **Note**\\ : It can be set for only Confidential VMs and required when using
Confidential VMs.
"""
NON_PERSISTED_TPM = "NonPersistedTPM"
VM_GUEST_STATE_ONLY = "VMGuestStateOnly"
class SecurityTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Specifies the SecurityType of the virtual machine. It has to be set to any specified value to
enable UefiSettings.
"""
TRUSTED_LAUNCH = "trustedLaunch"
"""Trusted launch protects against advanced and persistent attack techniques."""
CONFIDENTIAL_VM = "confidentialVM"
"""Azure confidential computing offers confidential VMs are for tenants with high security and
confidentiality requirements. These VMs provide a strong, hardware-enforced boundary to help
meet your security needs. You can use confidential VMs for migrations without making changes to
your code, with the platform protecting your VM's state from being read or modified."""
class Severity(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Severity of the issue."""
WARNING = "Warning"
ERROR = "Error"
class StorageAccountType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
@ -459,8 +566,8 @@ class UpgradeMode(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""All virtual machines in the scale set are automatically updated at the same time."""
MANUAL = "manual"
"""You control the application of updates to virtual machines in the scale set. You do this by
#: using the manualUpgrade action."""
using the manualUpgrade action."""
ROLLING = "rolling"
"""The existing instances in a scale set are brought down in batches to be upgraded. Once the
#: upgraded batch is complete, the instances will begin taking traffic again and the next batch
#: will begin. This continues until all instances brought up-to-date."""
upgraded batch is complete, the instances will begin taking traffic again and the next batch
will begin. This continues until all instances brought up-to-date."""

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

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

@ -15,6 +15,7 @@ from ._certificate_operations import CertificateOperations
from ._private_link_resource_operations import PrivateLinkResourceOperations
from ._private_endpoint_connection_operations import PrivateEndpointConnectionOperations
from ._pool_operations import PoolOperations
from ._network_security_perimeter_operations import NetworkSecurityPerimeterOperations
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
@ -30,6 +31,7 @@ __all__ = [
"PrivateLinkResourceOperations",
"PrivateEndpointConnectionOperations",
"PoolOperations",
"NetworkSecurityPerimeterOperations",
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()

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

@ -1,4 +1,4 @@
# pylint: disable=too-many-lines
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import sys
from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@ -20,16 +21,18 @@ from azure.core.exceptions import (
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.rest import HttpRequest
from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@ -43,7 +46,7 @@ def build_create_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -82,7 +85,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -118,7 +121,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -154,7 +157,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -198,7 +201,7 @@ def build_list_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -272,7 +275,6 @@ class ApplicationOperations:
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Application or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Application
:raises ~azure.core.exceptions.HttpResponseError:
@ -284,7 +286,7 @@ class ApplicationOperations:
resource_group_name: str,
account_name: str,
application_name: str,
parameters: Optional[IO] = None,
parameters: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@ -300,11 +302,10 @@ class ApplicationOperations:
Required.
:type application_name: str
:param parameters: The parameters for the request. Default value is None.
:type parameters: IO
:type parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Application or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Application
:raises ~azure.core.exceptions.HttpResponseError:
@ -316,7 +317,7 @@ class ApplicationOperations:
resource_group_name: str,
account_name: str,
application_name: str,
parameters: Optional[Union[_models.Application, IO]] = None,
parameters: Optional[Union[_models.Application, IO[bytes]]] = None,
**kwargs: Any
) -> _models.Application:
"""Adds an application to the specified Batch account.
@ -329,18 +330,14 @@ class ApplicationOperations:
:param application_name: The name of the application. This must be unique within the account.
Required.
:type application_name: str
:param parameters: The parameters for the request. Is either a Application type or a IO type.
Default value is None.
:type parameters: ~azure.mgmt.batch.models.Application or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:param parameters: The parameters for the request. Is either a Application type or a IO[bytes]
type. Default value is None.
:type parameters: ~azure.mgmt.batch.models.Application or IO[bytes]
:return: Application or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Application
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -366,7 +363,7 @@ class ApplicationOperations:
else:
_json = None
request = build_create_request(
_request = build_create_request(
resource_group_name=resource_group_name,
account_name=account_name,
application_name=application_name,
@ -375,16 +372,14 @@ class ApplicationOperations:
content_type=content_type,
json=_json,
content=_content,
template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -393,16 +388,12 @@ class ApplicationOperations:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("Application", pipeline_response)
deserialized = self._deserialize("Application", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
create.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}"
}
return deserialized # type: ignore
@distributed_trace
def delete( # pylint: disable=inconsistent-return-statements
@ -418,12 +409,11 @@ class ApplicationOperations:
:param application_name: The name of the application. This must be unique within the account.
Required.
:type application_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -437,22 +427,20 @@ class ApplicationOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
_request = build_delete_request(
resource_group_name=resource_group_name,
account_name=account_name,
application_name=application_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -462,11 +450,7 @@ class ApplicationOperations:
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}"
}
return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace
def get(
@ -482,12 +466,11 @@ class ApplicationOperations:
:param application_name: The name of the application. This must be unique within the account.
Required.
:type application_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Application or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Application
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -501,22 +484,20 @@ class ApplicationOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.Application] = kwargs.pop("cls", None)
request = build_get_request(
_request = build_get_request(
resource_group_name=resource_group_name,
account_name=account_name,
application_name=application_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -525,16 +506,12 @@ class ApplicationOperations:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("Application", pipeline_response)
deserialized = self._deserialize("Application", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}"
}
return deserialized # type: ignore
@overload
def update(
@ -562,7 +539,6 @@ class ApplicationOperations:
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Application or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Application
:raises ~azure.core.exceptions.HttpResponseError:
@ -574,7 +550,7 @@ class ApplicationOperations:
resource_group_name: str,
account_name: str,
application_name: str,
parameters: IO,
parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@ -590,11 +566,10 @@ class ApplicationOperations:
Required.
:type application_name: str
:param parameters: The parameters for the request. Required.
:type parameters: IO
:type parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Application or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Application
:raises ~azure.core.exceptions.HttpResponseError:
@ -606,7 +581,7 @@ class ApplicationOperations:
resource_group_name: str,
account_name: str,
application_name: str,
parameters: Union[_models.Application, IO],
parameters: Union[_models.Application, IO[bytes]],
**kwargs: Any
) -> _models.Application:
"""Updates settings for the specified application.
@ -619,18 +594,14 @@ class ApplicationOperations:
:param application_name: The name of the application. This must be unique within the account.
Required.
:type application_name: str
:param parameters: The parameters for the request. Is either a Application type or a IO type.
Required.
:type parameters: ~azure.mgmt.batch.models.Application or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:param parameters: The parameters for the request. Is either a Application type or a IO[bytes]
type. Required.
:type parameters: ~azure.mgmt.batch.models.Application or IO[bytes]
:return: Application or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Application
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -653,7 +624,7 @@ class ApplicationOperations:
else:
_json = self._serialize.body(parameters, "Application")
request = build_update_request(
_request = build_update_request(
resource_group_name=resource_group_name,
account_name=account_name,
application_name=application_name,
@ -662,16 +633,14 @@ class ApplicationOperations:
content_type=content_type,
json=_json,
content=_content,
template_url=self.update.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -680,16 +649,12 @@ class ApplicationOperations:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("Application", pipeline_response)
deserialized = self._deserialize("Application", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}"
}
return deserialized # type: ignore
@distributed_trace
def list(
@ -705,7 +670,6 @@ class ApplicationOperations:
:param maxresults: The maximum number of items to return in the response. Default value is
None.
:type maxresults: int
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Application or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.batch.models.Application]
:raises ~azure.core.exceptions.HttpResponseError:
@ -716,7 +680,7 @@ class ApplicationOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ListApplicationsResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -727,18 +691,16 @@ class ApplicationOperations:
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
_request = build_list_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
maxresults=maxresults,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@ -750,13 +712,12 @@ class ApplicationOperations:
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ListApplicationsResult", pipeline_response)
@ -766,11 +727,11 @@ class ApplicationOperations:
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -781,7 +742,3 @@ class ApplicationOperations:
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications"
}

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

@ -1,4 +1,4 @@
# pylint: disable=too-many-lines
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import sys
from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@ -20,16 +21,18 @@ from azure.core.exceptions import (
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.rest import HttpRequest
from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@ -48,7 +51,7 @@ def build_activate_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -95,7 +98,7 @@ def build_create_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -142,7 +145,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -186,7 +189,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -231,7 +234,7 @@ def build_list_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -313,7 +316,6 @@ class ApplicationPackageOperations:
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ApplicationPackage or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.ApplicationPackage
:raises ~azure.core.exceptions.HttpResponseError:
@ -326,7 +328,7 @@ class ApplicationPackageOperations:
account_name: str,
application_name: str,
version_name: str,
parameters: IO,
parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@ -346,11 +348,10 @@ class ApplicationPackageOperations:
:param version_name: The version of the application. Required.
:type version_name: str
:param parameters: The parameters for the request. Required.
:type parameters: IO
:type parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ApplicationPackage or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.ApplicationPackage
:raises ~azure.core.exceptions.HttpResponseError:
@ -363,7 +364,7 @@ class ApplicationPackageOperations:
account_name: str,
application_name: str,
version_name: str,
parameters: Union[_models.ActivateApplicationPackageParameters, IO],
parameters: Union[_models.ActivateApplicationPackageParameters, IO[bytes]],
**kwargs: Any
) -> _models.ApplicationPackage:
"""Activates the specified application package. This should be done after the
@ -381,17 +382,13 @@ class ApplicationPackageOperations:
:param version_name: The version of the application. Required.
:type version_name: str
:param parameters: The parameters for the request. Is either a
ActivateApplicationPackageParameters type or a IO type. Required.
:type parameters: ~azure.mgmt.batch.models.ActivateApplicationPackageParameters or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
ActivateApplicationPackageParameters type or a IO[bytes] type. Required.
:type parameters: ~azure.mgmt.batch.models.ActivateApplicationPackageParameters or IO[bytes]
:return: ApplicationPackage or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.ApplicationPackage
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -414,7 +411,7 @@ class ApplicationPackageOperations:
else:
_json = self._serialize.body(parameters, "ActivateApplicationPackageParameters")
request = build_activate_request(
_request = build_activate_request(
resource_group_name=resource_group_name,
account_name=account_name,
application_name=application_name,
@ -424,16 +421,14 @@ class ApplicationPackageOperations:
content_type=content_type,
json=_json,
content=_content,
template_url=self.activate.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -442,16 +437,12 @@ class ApplicationPackageOperations:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("ApplicationPackage", pipeline_response)
deserialized = self._deserialize("ApplicationPackage", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
activate.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}/activate"
}
return deserialized # type: ignore
@overload
def create(
@ -485,7 +476,6 @@ class ApplicationPackageOperations:
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ApplicationPackage or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.ApplicationPackage
:raises ~azure.core.exceptions.HttpResponseError:
@ -498,7 +488,7 @@ class ApplicationPackageOperations:
account_name: str,
application_name: str,
version_name: str,
parameters: Optional[IO] = None,
parameters: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@ -519,11 +509,10 @@ class ApplicationPackageOperations:
:param version_name: The version of the application. Required.
:type version_name: str
:param parameters: The parameters for the request. Default value is None.
:type parameters: IO
:type parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ApplicationPackage or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.ApplicationPackage
:raises ~azure.core.exceptions.HttpResponseError:
@ -536,7 +525,7 @@ class ApplicationPackageOperations:
account_name: str,
application_name: str,
version_name: str,
parameters: Optional[Union[_models.ApplicationPackage, IO]] = None,
parameters: Optional[Union[_models.ApplicationPackage, IO[bytes]]] = None,
**kwargs: Any
) -> _models.ApplicationPackage:
"""Creates an application package record. The record contains a storageUrl where the package
@ -554,18 +543,14 @@ class ApplicationPackageOperations:
:type application_name: str
:param version_name: The version of the application. Required.
:type version_name: str
:param parameters: The parameters for the request. Is either a ApplicationPackage type or a IO
type. Default value is None.
:type parameters: ~azure.mgmt.batch.models.ApplicationPackage or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:param parameters: The parameters for the request. Is either a ApplicationPackage type or a
IO[bytes] type. Default value is None.
:type parameters: ~azure.mgmt.batch.models.ApplicationPackage or IO[bytes]
:return: ApplicationPackage or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.ApplicationPackage
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -591,7 +576,7 @@ class ApplicationPackageOperations:
else:
_json = None
request = build_create_request(
_request = build_create_request(
resource_group_name=resource_group_name,
account_name=account_name,
application_name=application_name,
@ -601,16 +586,14 @@ class ApplicationPackageOperations:
content_type=content_type,
json=_json,
content=_content,
template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -619,16 +602,12 @@ class ApplicationPackageOperations:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("ApplicationPackage", pipeline_response)
deserialized = self._deserialize("ApplicationPackage", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
create.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}"
}
return deserialized # type: ignore
@distributed_trace
def delete( # pylint: disable=inconsistent-return-statements
@ -646,12 +625,11 @@ class ApplicationPackageOperations:
:type application_name: str
:param version_name: The version of the application. Required.
:type version_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -665,23 +643,21 @@ class ApplicationPackageOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
_request = build_delete_request(
resource_group_name=resource_group_name,
account_name=account_name,
application_name=application_name,
version_name=version_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -691,11 +667,7 @@ class ApplicationPackageOperations:
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}"
}
return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace
def get(
@ -713,12 +685,11 @@ class ApplicationPackageOperations:
:type application_name: str
:param version_name: The version of the application. Required.
:type version_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ApplicationPackage or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.ApplicationPackage
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -732,23 +703,21 @@ class ApplicationPackageOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ApplicationPackage] = kwargs.pop("cls", None)
request = build_get_request(
_request = build_get_request(
resource_group_name=resource_group_name,
account_name=account_name,
application_name=application_name,
version_name=version_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -757,16 +726,12 @@ class ApplicationPackageOperations:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("ApplicationPackage", pipeline_response)
deserialized = self._deserialize("ApplicationPackage", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}"
}
return deserialized # type: ignore
@distributed_trace
def list(
@ -790,7 +755,6 @@ class ApplicationPackageOperations:
:param maxresults: The maximum number of items to return in the response. Default value is
None.
:type maxresults: int
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ApplicationPackage or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.batch.models.ApplicationPackage]
:raises ~azure.core.exceptions.HttpResponseError:
@ -801,7 +765,7 @@ class ApplicationPackageOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ListApplicationPackagesResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -812,19 +776,17 @@ class ApplicationPackageOperations:
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
_request = build_list_request(
resource_group_name=resource_group_name,
account_name=account_name,
application_name=application_name,
subscription_id=self._config.subscription_id,
maxresults=maxresults,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@ -836,13 +798,12 @@ class ApplicationPackageOperations:
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ListApplicationPackagesResult", pipeline_response)
@ -852,11 +813,11 @@ class ApplicationPackageOperations:
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -867,7 +828,3 @@ class ApplicationPackageOperations:
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions"
}

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

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

@ -1,4 +1,4 @@
# pylint: disable=too-many-lines
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import sys
from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@ -16,13 +17,14 @@ from azure.core.exceptions import (
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
StreamClosedError,
StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.core.rest import HttpRequest
from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@ -30,8 +32,11 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@ -52,7 +57,7 @@ def build_list_by_batch_account_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -98,7 +103,7 @@ def build_create_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -147,7 +152,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -188,7 +193,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -224,7 +229,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -260,7 +265,7 @@ def build_cancel_deletion_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -341,7 +346,6 @@ class CertificateOperations:
"properties/provisioningState", "properties/provisioningStateTransitionTime", "name". Default
value is None.
:type filter: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Certificate or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.batch.models.Certificate]
:raises ~azure.core.exceptions.HttpResponseError:
@ -352,7 +356,7 @@ class CertificateOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ListCertificatesResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -363,7 +367,7 @@ class CertificateOperations:
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_batch_account_request(
_request = build_list_by_batch_account_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
@ -371,12 +375,10 @@ class CertificateOperations:
select=select,
filter=filter,
api_version=api_version,
template_url=self.list_by_batch_account.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@ -388,13 +390,12 @@ class CertificateOperations:
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ListCertificatesResult", pipeline_response)
@ -404,11 +405,11 @@ class CertificateOperations:
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -420,10 +421,6 @@ class CertificateOperations:
return ItemPaged(get_next, extract_data)
list_by_batch_account.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates"
}
@overload
def create(
self,
@ -464,7 +461,6 @@ class CertificateOperations:
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Certificate or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Certificate
:raises ~azure.core.exceptions.HttpResponseError:
@ -476,7 +472,7 @@ class CertificateOperations:
resource_group_name: str,
account_name: str,
certificate_name: str,
parameters: IO,
parameters: IO[bytes],
if_match: Optional[str] = None,
if_none_match: Optional[str] = None,
*,
@ -499,7 +495,7 @@ class CertificateOperations:
example SHA1-a3d1c5. Required.
:type certificate_name: str
:param parameters: Additional parameters for certificate creation. Required.
:type parameters: IO
:type parameters: IO[bytes]
:param if_match: The entity state (ETag) version of the certificate to update. A value of "*"
can be used to apply the operation only if the certificate already exists. If omitted, this
operation will always be applied. Default value is None.
@ -510,7 +506,6 @@ class CertificateOperations:
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Certificate or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Certificate
:raises ~azure.core.exceptions.HttpResponseError:
@ -522,7 +517,7 @@ class CertificateOperations:
resource_group_name: str,
account_name: str,
certificate_name: str,
parameters: Union[_models.CertificateCreateOrUpdateParameters, IO],
parameters: Union[_models.CertificateCreateOrUpdateParameters, IO[bytes]],
if_match: Optional[str] = None,
if_none_match: Optional[str] = None,
**kwargs: Any
@ -543,8 +538,8 @@ class CertificateOperations:
example SHA1-a3d1c5. Required.
:type certificate_name: str
:param parameters: Additional parameters for certificate creation. Is either a
CertificateCreateOrUpdateParameters type or a IO type. Required.
:type parameters: ~azure.mgmt.batch.models.CertificateCreateOrUpdateParameters or IO
CertificateCreateOrUpdateParameters type or a IO[bytes] type. Required.
:type parameters: ~azure.mgmt.batch.models.CertificateCreateOrUpdateParameters or IO[bytes]
:param if_match: The entity state (ETag) version of the certificate to update. A value of "*"
can be used to apply the operation only if the certificate already exists. If omitted, this
operation will always be applied. Default value is None.
@ -552,15 +547,11 @@ class CertificateOperations:
:param if_none_match: Set to '*' to allow a new certificate to be created, but to prevent
updating an existing certificate. Other values will be ignored. Default value is None.
:type if_none_match: str
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Certificate or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Certificate
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -583,7 +574,7 @@ class CertificateOperations:
else:
_json = self._serialize.body(parameters, "CertificateCreateOrUpdateParameters")
request = build_create_request(
_request = build_create_request(
resource_group_name=resource_group_name,
account_name=account_name,
certificate_name=certificate_name,
@ -594,16 +585,14 @@ class CertificateOperations:
content_type=content_type,
json=_json,
content=_content,
template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -615,16 +604,12 @@ class CertificateOperations:
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
deserialized = self._deserialize("Certificate", pipeline_response)
deserialized = self._deserialize("Certificate", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers)
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
create.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}"
}
return deserialized # type: ignore
@overload
def update(
@ -661,7 +646,6 @@ class CertificateOperations:
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Certificate or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Certificate
:raises ~azure.core.exceptions.HttpResponseError:
@ -673,7 +657,7 @@ class CertificateOperations:
resource_group_name: str,
account_name: str,
certificate_name: str,
parameters: IO,
parameters: IO[bytes],
if_match: Optional[str] = None,
*,
content_type: str = "application/json",
@ -695,14 +679,13 @@ class CertificateOperations:
example SHA1-a3d1c5. Required.
:type certificate_name: str
:param parameters: Certificate entity to update. Required.
:type parameters: IO
:type parameters: IO[bytes]
:param if_match: The entity state (ETag) version of the certificate to update. This value can
be omitted or set to "*" to apply the operation unconditionally. Default value is None.
:type if_match: str
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Certificate or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Certificate
:raises ~azure.core.exceptions.HttpResponseError:
@ -714,7 +697,7 @@ class CertificateOperations:
resource_group_name: str,
account_name: str,
certificate_name: str,
parameters: Union[_models.CertificateCreateOrUpdateParameters, IO],
parameters: Union[_models.CertificateCreateOrUpdateParameters, IO[bytes]],
if_match: Optional[str] = None,
**kwargs: Any
) -> _models.Certificate:
@ -734,20 +717,16 @@ class CertificateOperations:
example SHA1-a3d1c5. Required.
:type certificate_name: str
:param parameters: Certificate entity to update. Is either a
CertificateCreateOrUpdateParameters type or a IO type. Required.
:type parameters: ~azure.mgmt.batch.models.CertificateCreateOrUpdateParameters or IO
CertificateCreateOrUpdateParameters type or a IO[bytes] type. Required.
:type parameters: ~azure.mgmt.batch.models.CertificateCreateOrUpdateParameters or IO[bytes]
:param if_match: The entity state (ETag) version of the certificate to update. This value can
be omitted or set to "*" to apply the operation unconditionally. Default value is None.
:type if_match: str
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Certificate or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Certificate
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -770,7 +749,7 @@ class CertificateOperations:
else:
_json = self._serialize.body(parameters, "CertificateCreateOrUpdateParameters")
request = build_update_request(
_request = build_update_request(
resource_group_name=resource_group_name,
account_name=account_name,
certificate_name=certificate_name,
@ -780,16 +759,14 @@ class CertificateOperations:
content_type=content_type,
json=_json,
content=_content,
template_url=self.update.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -801,21 +778,17 @@ class CertificateOperations:
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
deserialized = self._deserialize("Certificate", pipeline_response)
deserialized = self._deserialize("Certificate", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers)
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
return deserialized # type: ignore
update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}"
}
def _delete_initial( # pylint: disable=inconsistent-return-statements
def _delete_initial(
self, resource_group_name: str, account_name: str, certificate_name: str, **kwargs: Any
) -> None:
error_map = {
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -827,29 +800,32 @@ class CertificateOperations:
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
request = build_delete_request(
_request = build_delete_request(
resource_group_name=resource_group_name,
account_name=account_name,
certificate_name=certificate_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@ -858,12 +834,12 @@ class CertificateOperations:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After"))
if cls:
return cls(pipeline_response, None, response_headers)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}"
}
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_delete(
@ -884,14 +860,6 @@ class CertificateOperations:
and thumbprint separated by a dash, and must match the certificate data in the request. For
example SHA1-a3d1c5. Required.
:type certificate_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
@ -905,7 +873,7 @@ class CertificateOperations:
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_initial( # type: ignore
raw_result = self._delete_initial(
resource_group_name=resource_group_name,
account_name=account_name,
certificate_name=certificate_name,
@ -915,11 +883,12 @@ class CertificateOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(
@ -930,17 +899,13 @@ class CertificateOperations:
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}"
}
return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def get(
@ -961,12 +926,11 @@ class CertificateOperations:
and thumbprint separated by a dash, and must match the certificate data in the request. For
example SHA1-a3d1c5. Required.
:type certificate_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Certificate or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Certificate
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -980,22 +944,20 @@ class CertificateOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.Certificate] = kwargs.pop("cls", None)
request = build_get_request(
_request = build_get_request(
resource_group_name=resource_group_name,
account_name=account_name,
certificate_name=certificate_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -1007,16 +969,12 @@ class CertificateOperations:
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
deserialized = self._deserialize("Certificate", pipeline_response)
deserialized = self._deserialize("Certificate", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers)
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}"
}
return deserialized # type: ignore
@distributed_trace
def cancel_deletion(
@ -1044,12 +1002,11 @@ class CertificateOperations:
and thumbprint separated by a dash, and must match the certificate data in the request. For
example SHA1-a3d1c5. Required.
:type certificate_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Certificate or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Certificate
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -1063,22 +1020,20 @@ class CertificateOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.Certificate] = kwargs.pop("cls", None)
request = build_cancel_deletion_request(
_request = build_cancel_deletion_request(
resource_group_name=resource_group_name,
account_name=account_name,
certificate_name=certificate_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.cancel_deletion.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -1090,13 +1045,9 @@ class CertificateOperations:
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
deserialized = self._deserialize("Certificate", pipeline_response)
deserialized = self._deserialize("Certificate", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers)
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
cancel_deletion.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}/cancelDelete"
}
return deserialized # type: ignore

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

@ -1,4 +1,4 @@
# pylint: disable=too-many-lines
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import sys
from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@ -20,16 +21,18 @@ from azure.core.exceptions import (
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.rest import HttpRequest
from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@ -41,7 +44,7 @@ def build_get_quotas_request(location_name: str, subscription_id: str, **kwargs:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -64,7 +67,7 @@ def build_get_quotas_request(location_name: str, subscription_id: str, **kwargs:
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_list_supported_virtual_machine_skus_request(
def build_list_supported_virtual_machine_skus_request( # pylint: disable=name-too-long
location_name: str,
subscription_id: str,
*,
@ -75,7 +78,7 @@ def build_list_supported_virtual_machine_skus_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -103,50 +106,11 @@ def build_list_supported_virtual_machine_skus_request(
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_list_supported_cloud_service_skus_request(
location_name: str,
subscription_id: str,
*,
maxresults: Optional[int] = None,
filter: Optional[str] = None,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/cloudServiceSkus",
) # pylint: disable=line-too-long
path_format_arguments = {
"locationName": _SERIALIZER.url("location_name", location_name, "str"),
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if maxresults is not None:
_params["maxresults"] = _SERIALIZER.query("maxresults", maxresults, "int")
if filter is not None:
_params["$filter"] = _SERIALIZER.query("filter", filter, "str")
_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_check_name_availability_request(location_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -198,12 +162,11 @@ class LocationOperations:
:param location_name: The region for which to retrieve Batch service quotas. Required.
:type location_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: BatchLocationQuota or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.BatchLocationQuota
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -217,20 +180,18 @@ class LocationOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.BatchLocationQuota] = kwargs.pop("cls", None)
request = build_get_quotas_request(
_request = build_get_quotas_request(
location_name=location_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_quotas.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -239,16 +200,12 @@ class LocationOperations:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("BatchLocationQuota", pipeline_response)
deserialized = self._deserialize("BatchLocationQuota", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
get_quotas.metadata = {
"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/quotas"
}
return deserialized # type: ignore
@distributed_trace
def list_supported_virtual_machine_skus(
@ -264,7 +221,6 @@ class LocationOperations:
:param filter: OData filter expression. Valid properties for filtering are "familyName".
Default value is None.
:type filter: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either SupportedSku or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.batch.models.SupportedSku]
:raises ~azure.core.exceptions.HttpResponseError:
@ -275,7 +231,7 @@ class LocationOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.SupportedSkusResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -286,18 +242,16 @@ class LocationOperations:
def prepare_request(next_link=None):
if not next_link:
request = build_list_supported_virtual_machine_skus_request(
_request = build_list_supported_virtual_machine_skus_request(
location_name=location_name,
subscription_id=self._config.subscription_id,
maxresults=maxresults,
filter=filter,
api_version=api_version,
template_url=self.list_supported_virtual_machine_skus.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@ -309,13 +263,12 @@ class LocationOperations:
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("SupportedSkusResult", pipeline_response)
@ -325,11 +278,11 @@ class LocationOperations:
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -341,105 +294,6 @@ class LocationOperations:
return ItemPaged(get_next, extract_data)
list_supported_virtual_machine_skus.metadata = {
"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/virtualMachineSkus"
}
@distributed_trace
def list_supported_cloud_service_skus(
self, location_name: str, maxresults: Optional[int] = None, filter: Optional[str] = None, **kwargs: Any
) -> Iterable["_models.SupportedSku"]:
"""Gets the list of Batch supported Cloud Service VM sizes available at the given location.
:param location_name: The region for which to retrieve Batch service supported SKUs. Required.
:type location_name: str
:param maxresults: The maximum number of items to return in the response. Default value is
None.
:type maxresults: int
:param filter: OData filter expression. Valid properties for filtering are "familyName".
Default value is None.
:type filter: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either SupportedSku or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.batch.models.SupportedSku]
: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.SupportedSkusResult] = 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_supported_cloud_service_skus_request(
location_name=location_name,
subscription_id=self._config.subscription_id,
maxresults=maxresults,
filter=filter,
api_version=api_version,
template_url=self.list_supported_cloud_service_skus.metadata["url"],
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("SupportedSkusResult", 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)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list_supported_cloud_service_skus.metadata = {
"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/cloudServiceSkus"
}
@overload
def check_name_availability(
self,
@ -458,7 +312,6 @@ class LocationOperations:
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: CheckNameAvailabilityResult or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
@ -466,18 +319,17 @@ class LocationOperations:
@overload
def check_name_availability(
self, location_name: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any
self, location_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _models.CheckNameAvailabilityResult:
"""Checks whether the Batch account name is available in the specified region.
:param location_name: The desired region for the name check. Required.
:type location_name: str
:param parameters: Properties needed to check the availability of a name. Required.
:type parameters: IO
:type parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: CheckNameAvailabilityResult or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
@ -485,24 +337,20 @@ class LocationOperations:
@distributed_trace
def check_name_availability(
self, location_name: str, parameters: Union[_models.CheckNameAvailabilityParameters, IO], **kwargs: Any
self, location_name: str, parameters: Union[_models.CheckNameAvailabilityParameters, IO[bytes]], **kwargs: Any
) -> _models.CheckNameAvailabilityResult:
"""Checks whether the Batch account name is available in the specified region.
:param location_name: The desired region for the name check. Required.
:type location_name: str
:param parameters: Properties needed to check the availability of a name. Is either a
CheckNameAvailabilityParameters type or a IO type. Required.
:type parameters: ~azure.mgmt.batch.models.CheckNameAvailabilityParameters or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
CheckNameAvailabilityParameters type or a IO[bytes] type. Required.
:type parameters: ~azure.mgmt.batch.models.CheckNameAvailabilityParameters or IO[bytes]
:return: CheckNameAvailabilityResult or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -525,23 +373,21 @@ class LocationOperations:
else:
_json = self._serialize.body(parameters, "CheckNameAvailabilityParameters")
request = build_check_name_availability_request(
_request = build_check_name_availability_request(
location_name=location_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self.check_name_availability.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -550,13 +396,9 @@ class LocationOperations:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response)
deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
check_name_availability.metadata = {
"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/checkNameAvailability"
}
return deserialized # type: ignore

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

@ -0,0 +1,457 @@
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import sys
from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
StreamClosedError,
StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.arm_polling import ARMPolling
from .. import models as _models
from .._serialization import Serializer
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_configurations_request(
resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/networkSecurityPerimeterConfigurations",
) # 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"),
"accountName": _SERIALIZER.url(
"account_name", account_name, "str", max_length=24, min_length=3, pattern=r"^[a-zA-Z0-9]+$"
),
}
_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_configuration_request(
resource_group_name: str,
account_name: str,
network_security_perimeter_configuration_name: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/networkSecurityPerimeterConfigurations/{networkSecurityPerimeterConfigurationName}",
) # 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"),
"accountName": _SERIALIZER.url(
"account_name", account_name, "str", max_length=24, min_length=3, pattern=r"^[a-zA-Z0-9]+$"
),
"networkSecurityPerimeterConfigurationName": _SERIALIZER.url(
"network_security_perimeter_configuration_name",
network_security_perimeter_configuration_name,
"str",
pattern=r"^.*$",
),
}
_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_reconcile_configuration_request(
resource_group_name: str,
account_name: str,
network_security_perimeter_configuration_name: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/networkSecurityPerimeterConfigurations/{networkSecurityPerimeterConfigurationName}/reconcile",
) # 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"),
"accountName": _SERIALIZER.url(
"account_name", account_name, "str", max_length=24, min_length=3, pattern=r"^[a-zA-Z0-9]+$"
),
"networkSecurityPerimeterConfigurationName": _SERIALIZER.url(
"network_security_perimeter_configuration_name",
network_security_perimeter_configuration_name,
"str",
pattern=r"^.*$",
),
}
_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="POST", url=_url, params=_params, headers=_headers, **kwargs)
class NetworkSecurityPerimeterOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.batch.BatchManagementClient`'s
:attr:`network_security_perimeter` 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_configurations(
self, resource_group_name: str, account_name: str, **kwargs: Any
) -> Iterable["_models.NetworkSecurityPerimeterConfiguration"]:
"""Lists all of the NSP configurations in the specified account.
:param resource_group_name: The name of the resource group that contains the Batch account.
Required.
:type resource_group_name: str
:param account_name: The name of the Batch account. Required.
:type account_name: str
:return: An iterator like instance of either NetworkSecurityPerimeterConfiguration or the
result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.batch.models.NetworkSecurityPerimeterConfiguration]
: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.NetworkSecurityPerimeterConfigurationListResult] = kwargs.pop("cls", None)
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
_request = build_list_configurations_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("NetworkSecurityPerimeterConfigurationListResult", 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)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
@distributed_trace
def get_configuration(
self,
resource_group_name: str,
account_name: str,
network_security_perimeter_configuration_name: str,
**kwargs: Any
) -> _models.NetworkSecurityPerimeterConfiguration:
"""Gets information about the specified NSP configuration.
:param resource_group_name: The name of the resource group that contains the Batch account.
Required.
:type resource_group_name: str
:param account_name: The name of the Batch account. Required.
:type account_name: str
:param network_security_perimeter_configuration_name: The name for Network Security Perimeter
configuration. Required.
:type network_security_perimeter_configuration_name: str
:return: NetworkSecurityPerimeterConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.NetworkSecurityPerimeterConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
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.NetworkSecurityPerimeterConfiguration] = kwargs.pop("cls", None)
_request = build_get_configuration_request(
resource_group_name=resource_group_name,
account_name=account_name,
network_security_perimeter_configuration_name=network_security_perimeter_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_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)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("NetworkSecurityPerimeterConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
def _reconcile_configuration_initial(
self,
resource_group_name: str,
account_name: str,
network_security_perimeter_configuration_name: str,
**kwargs: Any
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = 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[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_reconcile_configuration_request(
resource_group_name=resource_group_name,
account_name=account_name,
network_security_perimeter_configuration_name=network_security_perimeter_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
response_headers = {}
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_reconcile_configuration(
self,
resource_group_name: str,
account_name: str,
network_security_perimeter_configuration_name: str,
**kwargs: Any
) -> LROPoller[None]:
"""Reconciles the specified NSP configuration.
:param resource_group_name: The name of the resource group that contains the Batch account.
Required.
:type resource_group_name: str
:param account_name: The name of the Batch account. Required.
:type account_name: str
:param network_security_perimeter_configuration_name: The name for Network Security Perimeter
configuration. Required.
:type network_security_perimeter_configuration_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._reconcile_configuration_initial(
resource_group_name=resource_group_name,
account_name=account_name,
network_security_perimeter_configuration_name=network_security_perimeter_configuration_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(
PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
)
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore

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

@ -1,4 +1,4 @@
# pylint: disable=too-many-lines
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import sys
from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
import urllib.parse
from azure.core.exceptions import (
@ -19,16 +20,18 @@ from azure.core.exceptions import (
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.rest import HttpRequest
from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@ -40,7 +43,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -78,7 +81,6 @@ class Operations:
def list(self, **kwargs: Any) -> Iterable["_models.Operation"]:
"""Lists available operations for the Microsoft.Batch provider.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Operation or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.batch.models.Operation]
:raises ~azure.core.exceptions.HttpResponseError:
@ -89,7 +91,7 @@ class Operations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -100,14 +102,12 @@ class Operations:
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
_request = build_list_request(
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@ -119,13 +119,12 @@ class Operations:
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("OperationListResult", pipeline_response)
@ -135,11 +134,11 @@ class Operations:
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -150,5 +149,3 @@ class Operations:
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {"url": "/providers/Microsoft.Batch/operations"}

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

@ -1,4 +1,4 @@
# pylint: disable=too-many-lines
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import sys
from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@ -16,13 +17,14 @@ from azure.core.exceptions import (
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
StreamClosedError,
StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.core.rest import HttpRequest
from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@ -30,8 +32,11 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@ -52,7 +57,7 @@ def build_list_by_batch_account_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -98,7 +103,7 @@ def build_create_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -147,7 +152,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -188,7 +193,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -224,7 +229,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -260,7 +265,7 @@ def build_disable_auto_scale_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -296,7 +301,7 @@ def build_stop_resize_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -383,7 +388,6 @@ class PoolOperations:
properties/scaleSettings/autoScale
properties/scaleSettings/fixedScale. Default value is None.
:type filter: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Pool or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.batch.models.Pool]
:raises ~azure.core.exceptions.HttpResponseError:
@ -394,7 +398,7 @@ class PoolOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ListPoolsResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -405,7 +409,7 @@ class PoolOperations:
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_batch_account_request(
_request = build_list_by_batch_account_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
@ -413,12 +417,10 @@ class PoolOperations:
select=select,
filter=filter,
api_version=api_version,
template_url=self.list_by_batch_account.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@ -430,13 +432,12 @@ class PoolOperations:
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ListPoolsResult", pipeline_response)
@ -446,11 +447,11 @@ class PoolOperations:
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -462,10 +463,6 @@ class PoolOperations:
return ItemPaged(get_next, extract_data)
list_by_batch_account.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools"
}
@overload
def create(
self,
@ -500,7 +497,6 @@ class PoolOperations:
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Pool or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Pool
:raises ~azure.core.exceptions.HttpResponseError:
@ -512,7 +508,7 @@ class PoolOperations:
resource_group_name: str,
account_name: str,
pool_name: str,
parameters: IO,
parameters: IO[bytes],
if_match: Optional[str] = None,
if_none_match: Optional[str] = None,
*,
@ -529,7 +525,7 @@ class PoolOperations:
:param pool_name: The pool name. This must be unique within the account. Required.
:type pool_name: str
:param parameters: Additional parameters for pool creation. Required.
:type parameters: IO
:type parameters: IO[bytes]
:param if_match: The entity state (ETag) version of the pool to update. A value of "*" can be
used to apply the operation only if the pool already exists. If omitted, this operation will
always be applied. Default value is None.
@ -540,7 +536,6 @@ class PoolOperations:
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Pool or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Pool
:raises ~azure.core.exceptions.HttpResponseError:
@ -552,7 +547,7 @@ class PoolOperations:
resource_group_name: str,
account_name: str,
pool_name: str,
parameters: Union[_models.Pool, IO],
parameters: Union[_models.Pool, IO[bytes]],
if_match: Optional[str] = None,
if_none_match: Optional[str] = None,
**kwargs: Any
@ -566,9 +561,9 @@ class PoolOperations:
:type account_name: str
:param pool_name: The pool name. This must be unique within the account. Required.
:type pool_name: str
:param parameters: Additional parameters for pool creation. Is either a Pool type or a IO type.
Required.
:type parameters: ~azure.mgmt.batch.models.Pool or IO
:param parameters: Additional parameters for pool creation. Is either a Pool type or a
IO[bytes] type. Required.
:type parameters: ~azure.mgmt.batch.models.Pool or IO[bytes]
:param if_match: The entity state (ETag) version of the pool to update. A value of "*" can be
used to apply the operation only if the pool already exists. If omitted, this operation will
always be applied. Default value is None.
@ -576,15 +571,11 @@ class PoolOperations:
:param if_none_match: Set to '*' to allow a new pool to be created, but to prevent updating an
existing pool. Other values will be ignored. Default value is None.
:type if_none_match: str
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Pool or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Pool
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -607,7 +598,7 @@ class PoolOperations:
else:
_json = self._serialize.body(parameters, "Pool")
request = build_create_request(
_request = build_create_request(
resource_group_name=resource_group_name,
account_name=account_name,
pool_name=pool_name,
@ -618,16 +609,14 @@ class PoolOperations:
content_type=content_type,
json=_json,
content=_content,
template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -639,16 +628,12 @@ class PoolOperations:
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
deserialized = self._deserialize("Pool", pipeline_response)
deserialized = self._deserialize("Pool", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers)
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
create.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}"
}
return deserialized # type: ignore
@overload
def update(
@ -680,7 +665,6 @@ class PoolOperations:
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Pool or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Pool
:raises ~azure.core.exceptions.HttpResponseError:
@ -692,7 +676,7 @@ class PoolOperations:
resource_group_name: str,
account_name: str,
pool_name: str,
parameters: IO,
parameters: IO[bytes],
if_match: Optional[str] = None,
*,
content_type: str = "application/json",
@ -709,14 +693,13 @@ class PoolOperations:
:type pool_name: str
:param parameters: Pool properties that should be updated. Properties that are supplied will be
updated, any property not supplied will be unchanged. Required.
:type parameters: IO
:type parameters: IO[bytes]
:param if_match: The entity state (ETag) version of the pool to update. This value can be
omitted or set to "*" to apply the operation unconditionally. Default value is None.
:type if_match: str
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Pool or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Pool
:raises ~azure.core.exceptions.HttpResponseError:
@ -728,7 +711,7 @@ class PoolOperations:
resource_group_name: str,
account_name: str,
pool_name: str,
parameters: Union[_models.Pool, IO],
parameters: Union[_models.Pool, IO[bytes]],
if_match: Optional[str] = None,
**kwargs: Any
) -> _models.Pool:
@ -742,21 +725,17 @@ class PoolOperations:
:param pool_name: The pool name. This must be unique within the account. Required.
:type pool_name: str
:param parameters: Pool properties that should be updated. Properties that are supplied will be
updated, any property not supplied will be unchanged. Is either a Pool type or a IO type.
Required.
:type parameters: ~azure.mgmt.batch.models.Pool or IO
updated, any property not supplied will be unchanged. Is either a Pool type or a IO[bytes]
type. Required.
:type parameters: ~azure.mgmt.batch.models.Pool or IO[bytes]
:param if_match: The entity state (ETag) version of the pool to update. This value can be
omitted or set to "*" to apply the operation unconditionally. Default value is None.
:type if_match: str
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Pool or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Pool
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -779,7 +758,7 @@ class PoolOperations:
else:
_json = self._serialize.body(parameters, "Pool")
request = build_update_request(
_request = build_update_request(
resource_group_name=resource_group_name,
account_name=account_name,
pool_name=pool_name,
@ -789,16 +768,14 @@ class PoolOperations:
content_type=content_type,
json=_json,
content=_content,
template_url=self.update.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -810,21 +787,17 @@ class PoolOperations:
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
deserialized = self._deserialize("Pool", pipeline_response)
deserialized = self._deserialize("Pool", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers)
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
return deserialized # type: ignore
update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}"
}
def _delete_initial( # pylint: disable=inconsistent-return-statements
def _delete_initial(
self, resource_group_name: str, account_name: str, pool_name: str, **kwargs: Any
) -> None:
error_map = {
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -836,29 +809,32 @@ class PoolOperations:
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
request = build_delete_request(
_request = build_delete_request(
resource_group_name=resource_group_name,
account_name=account_name,
pool_name=pool_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@ -867,12 +843,12 @@ class PoolOperations:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After"))
if cls:
return cls(pipeline_response, None, response_headers)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}"
}
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_delete(
@ -887,14 +863,6 @@ class PoolOperations:
:type account_name: str
:param pool_name: The pool name. This must be unique within the account. Required.
:type pool_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
@ -908,7 +876,7 @@ class PoolOperations:
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_initial( # type: ignore
raw_result = self._delete_initial(
resource_group_name=resource_group_name,
account_name=account_name,
pool_name=pool_name,
@ -918,11 +886,12 @@ class PoolOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(
@ -933,17 +902,13 @@ class PoolOperations:
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}"
}
return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def get(self, resource_group_name: str, account_name: str, pool_name: str, **kwargs: Any) -> _models.Pool:
@ -956,12 +921,11 @@ class PoolOperations:
:type account_name: str
:param pool_name: The pool name. This must be unique within the account. Required.
:type pool_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Pool or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Pool
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -975,22 +939,20 @@ class PoolOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.Pool] = kwargs.pop("cls", None)
request = build_get_request(
_request = build_get_request(
resource_group_name=resource_group_name,
account_name=account_name,
pool_name=pool_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -1002,16 +964,12 @@ class PoolOperations:
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
deserialized = self._deserialize("Pool", pipeline_response)
deserialized = self._deserialize("Pool", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers)
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}"
}
return deserialized # type: ignore
@distributed_trace
def disable_auto_scale(
@ -1026,12 +984,11 @@ class PoolOperations:
:type account_name: str
:param pool_name: The pool name. This must be unique within the account. Required.
:type pool_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Pool or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Pool
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -1045,22 +1002,20 @@ class PoolOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.Pool] = kwargs.pop("cls", None)
request = build_disable_auto_scale_request(
_request = build_disable_auto_scale_request(
resource_group_name=resource_group_name,
account_name=account_name,
pool_name=pool_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.disable_auto_scale.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -1072,16 +1027,12 @@ class PoolOperations:
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
deserialized = self._deserialize("Pool", pipeline_response)
deserialized = self._deserialize("Pool", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers)
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
disable_auto_scale.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/disableAutoScale"
}
return deserialized # type: ignore
@distributed_trace
def stop_resize(self, resource_group_name: str, account_name: str, pool_name: str, **kwargs: Any) -> _models.Pool:
@ -1101,12 +1052,11 @@ class PoolOperations:
:type account_name: str
:param pool_name: The pool name. This must be unique within the account. Required.
:type pool_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Pool or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.Pool
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -1120,22 +1070,20 @@ class PoolOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.Pool] = kwargs.pop("cls", None)
request = build_stop_resize_request(
_request = build_stop_resize_request(
resource_group_name=resource_group_name,
account_name=account_name,
pool_name=pool_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.stop_resize.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -1147,13 +1095,9 @@ class PoolOperations:
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
deserialized = self._deserialize("Pool", pipeline_response)
deserialized = self._deserialize("Pool", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers)
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
stop_resize.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/stopResize"
}
return deserialized # type: ignore

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

@ -1,4 +1,4 @@
# pylint: disable=too-many-lines
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import sys
from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@ -16,13 +17,14 @@ from azure.core.exceptions import (
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
StreamClosedError,
StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.core.rest import HttpRequest
from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@ -30,8 +32,11 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@ -50,7 +55,7 @@ def build_list_by_batch_account_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -89,7 +94,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -136,7 +141,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@ -186,7 +191,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -254,7 +259,6 @@ class PrivateEndpointConnectionOperations:
:param maxresults: The maximum number of items to return in the response. Default value is
None.
:type maxresults: int
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PrivateEndpointConnection or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.batch.models.PrivateEndpointConnection]
@ -266,7 +270,7 @@ class PrivateEndpointConnectionOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ListPrivateEndpointConnectionsResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -277,18 +281,16 @@ class PrivateEndpointConnectionOperations:
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_batch_account_request(
_request = build_list_by_batch_account_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
maxresults=maxresults,
api_version=api_version,
template_url=self.list_by_batch_account.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@ -300,13 +302,12 @@ class PrivateEndpointConnectionOperations:
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ListPrivateEndpointConnectionsResult", pipeline_response)
@ -316,11 +317,11 @@ class PrivateEndpointConnectionOperations:
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -332,10 +333,6 @@ class PrivateEndpointConnectionOperations:
return ItemPaged(get_next, extract_data)
list_by_batch_account.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections"
}
@distributed_trace
def get(
self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any
@ -350,12 +347,11 @@ class PrivateEndpointConnectionOperations:
:param private_endpoint_connection_name: The private endpoint connection name. This must be
unique within the account. Required.
:type private_endpoint_connection_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PrivateEndpointConnection or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -369,22 +365,20 @@ class PrivateEndpointConnectionOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None)
request = build_get_request(
_request = build_get_request(
resource_group_name=resource_group_name,
account_name=account_name,
private_endpoint_connection_name=private_endpoint_connection_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -393,27 +387,23 @@ class PrivateEndpointConnectionOperations:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response)
deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"
}
return deserialized # type: ignore
def _update_initial(
self,
resource_group_name: str,
account_name: str,
private_endpoint_connection_name: str,
parameters: Union[_models.PrivateEndpointConnection, IO],
parameters: Union[_models.PrivateEndpointConnection, IO[bytes]],
if_match: Optional[str] = None,
**kwargs: Any
) -> Optional[_models.PrivateEndpointConnection]:
error_map = {
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -426,7 +416,7 @@ class PrivateEndpointConnectionOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@ -436,7 +426,7 @@ class PrivateEndpointConnectionOperations:
else:
_json = self._serialize.body(parameters, "PrivateEndpointConnection")
request = build_update_request(
_request = build_update_request(
resource_group_name=resource_group_name,
account_name=account_name,
private_endpoint_connection_name=private_endpoint_connection_name,
@ -446,41 +436,38 @@ class PrivateEndpointConnectionOperations:
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = None
response_headers = {}
if response.status_code == 200:
deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response)
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After"))
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers)
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"
}
return deserialized # type: ignore
@overload
def begin_update(
@ -514,14 +501,6 @@ class PrivateEndpointConnectionOperations:
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either PrivateEndpointConnection or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.batch.models.PrivateEndpointConnection]
@ -534,7 +513,7 @@ class PrivateEndpointConnectionOperations:
resource_group_name: str,
account_name: str,
private_endpoint_connection_name: str,
parameters: IO,
parameters: IO[bytes],
if_match: Optional[str] = None,
*,
content_type: str = "application/json",
@ -552,7 +531,7 @@ class PrivateEndpointConnectionOperations:
:type private_endpoint_connection_name: str
:param parameters: PrivateEndpointConnection properties that should be updated. Properties that
are supplied will be updated, any property not supplied will be unchanged. Required.
:type parameters: IO
:type parameters: IO[bytes]
:param if_match: The state (ETag) version of the private endpoint connection to update. This
value can be omitted or set to "*" to apply the operation unconditionally. Default value is
None.
@ -560,14 +539,6 @@ class PrivateEndpointConnectionOperations:
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either PrivateEndpointConnection or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.batch.models.PrivateEndpointConnection]
@ -580,7 +551,7 @@ class PrivateEndpointConnectionOperations:
resource_group_name: str,
account_name: str,
private_endpoint_connection_name: str,
parameters: Union[_models.PrivateEndpointConnection, IO],
parameters: Union[_models.PrivateEndpointConnection, IO[bytes]],
if_match: Optional[str] = None,
**kwargs: Any
) -> LROPoller[_models.PrivateEndpointConnection]:
@ -596,23 +567,12 @@ class PrivateEndpointConnectionOperations:
:type private_endpoint_connection_name: str
:param parameters: PrivateEndpointConnection properties that should be updated. Properties that
are supplied will be updated, any property not supplied will be unchanged. Is either a
PrivateEndpointConnection type or a IO type. Required.
:type parameters: ~azure.mgmt.batch.models.PrivateEndpointConnection or IO
PrivateEndpointConnection type or a IO[bytes] type. Required.
:type parameters: ~azure.mgmt.batch.models.PrivateEndpointConnection or IO[bytes]
:param if_match: The state (ETag) version of the private endpoint connection to update. This
value can be omitted or set to "*" to apply the operation unconditionally. Default value is
None.
:type if_match: str
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either PrivateEndpointConnection or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.batch.models.PrivateEndpointConnection]
@ -641,12 +601,13 @@ class PrivateEndpointConnectionOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response)
deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@ -658,22 +619,20 @@ class PrivateEndpointConnectionOperations:
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
return LROPoller[_models.PrivateEndpointConnection].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
return LROPoller[_models.PrivateEndpointConnection](
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
begin_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"
}
def _delete_initial( # pylint: disable=inconsistent-return-statements
def _delete_initial(
self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any
) -> None:
error_map = {
) -> Iterator[bytes]:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -685,29 +644,32 @@ class PrivateEndpointConnectionOperations:
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
request = build_delete_request(
_request = build_delete_request(
resource_group_name=resource_group_name,
account_name=account_name,
private_endpoint_connection_name=private_endpoint_connection_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
_decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202, 204]:
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@ -716,12 +678,12 @@ class PrivateEndpointConnectionOperations:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After"))
if cls:
return cls(pipeline_response, None, response_headers)
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"
}
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@distributed_trace
def begin_delete(
@ -737,14 +699,6 @@ class PrivateEndpointConnectionOperations:
:param private_endpoint_connection_name: The private endpoint connection name. This must be
unique within the account. Required.
:type private_endpoint_connection_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
@ -758,7 +712,7 @@ class PrivateEndpointConnectionOperations:
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_initial( # type: ignore
raw_result = self._delete_initial(
resource_group_name=resource_group_name,
account_name=account_name,
private_endpoint_connection_name=private_endpoint_connection_name,
@ -768,11 +722,12 @@ class PrivateEndpointConnectionOperations:
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(
@ -783,14 +738,10 @@ class PrivateEndpointConnectionOperations:
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"
}
return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore

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

@ -1,4 +1,4 @@
# pylint: disable=too-many-lines
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import sys
from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
import urllib.parse
from azure.core.exceptions import (
@ -19,16 +20,18 @@ from azure.core.exceptions import (
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.rest import HttpRequest
from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@ -47,7 +50,7 @@ def build_list_by_batch_account_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -82,7 +85,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@ -150,7 +153,6 @@ class PrivateLinkResourceOperations:
:param maxresults: The maximum number of items to return in the response. Default value is
None.
:type maxresults: int
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PrivateLinkResource or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.batch.models.PrivateLinkResource]
:raises ~azure.core.exceptions.HttpResponseError:
@ -161,7 +163,7 @@ class PrivateLinkResourceOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ListPrivateLinkResourcesResult] = kwargs.pop("cls", None)
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -172,18 +174,16 @@ class PrivateLinkResourceOperations:
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_batch_account_request(
_request = build_list_by_batch_account_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
maxresults=maxresults,
api_version=api_version,
template_url=self.list_by_batch_account.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@ -195,13 +195,12 @@ class PrivateLinkResourceOperations:
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ListPrivateLinkResourcesResult", pipeline_response)
@ -211,11 +210,11 @@ class PrivateLinkResourceOperations:
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -227,10 +226,6 @@ class PrivateLinkResourceOperations:
return ItemPaged(get_next, extract_data)
list_by_batch_account.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateLinkResources"
}
@distributed_trace
def get(
self, resource_group_name: str, account_name: str, private_link_resource_name: str, **kwargs: Any
@ -245,12 +240,11 @@ class PrivateLinkResourceOperations:
:param private_link_resource_name: The private link resource name. This must be unique within
the account. Required.
:type private_link_resource_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PrivateLinkResource or the result of cls(response)
:rtype: ~azure.mgmt.batch.models.PrivateLinkResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@ -264,22 +258,20 @@ class PrivateLinkResourceOperations:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None)
request = build_get_request(
_request = build_get_request(
resource_group_name=resource_group_name,
account_name=account_name,
private_link_resource_name=private_link_resource_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@ -288,13 +280,9 @@ class PrivateLinkResourceOperations:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("PrivateLinkResource", pipeline_response)
deserialized = self._deserialize("PrivateLinkResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateLinkResources/{privateLinkResourceName}"
}
return deserialized # type: ignore

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

@ -3,4 +3,5 @@ azure-mgmt-keyvault<9.0.0
azure-mgmt-network<19.0.0
-e ../../resources/azure-mgmt-resource
-e ../../storage/azure-mgmt-storage
../../identity/azure-identity
../../identity/azure-identity
aiohttp

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -37,6 +38,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/ApplicationCreate.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/ApplicationCreate.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -36,6 +37,6 @@ def main():
)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/ApplicationDelete.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/ApplicationDelete.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -37,6 +38,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/ApplicationGet.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/ApplicationGet.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -37,6 +38,6 @@ def main():
print(item)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/ApplicationList.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/ApplicationList.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -39,6 +40,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/ApplicationPackageActivate.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/ApplicationPackageActivate.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -38,6 +39,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/ApplicationPackageCreate.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/ApplicationPackageCreate.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -37,6 +38,6 @@ def main():
)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/ApplicationPackageDelete.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/ApplicationPackageDelete.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -38,6 +39,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/ApplicationPackageGet.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/ApplicationPackageGet.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -38,6 +39,6 @@ def main():
print(item)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/ApplicationPackageList.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/ApplicationPackageList.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -38,6 +39,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/ApplicationUpdate.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/ApplicationUpdate.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -49,6 +50,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/BatchAccountCreate_BYOS.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/BatchAccountCreate_BYOS.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -44,6 +45,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/BatchAccountCreate_Default.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/BatchAccountCreate_Default.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -45,6 +46,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/BatchAccountCreate_SystemAssignedIdentity.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/BatchAccountCreate_SystemAssignedIdentity.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -50,6 +51,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/BatchAccountCreate_UserAssignedIdentity.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/BatchAccountCreate_UserAssignedIdentity.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -35,6 +36,6 @@ def main():
).result()
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/BatchAccountDelete.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/BatchAccountDelete.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -36,6 +37,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/BatchAccountGet.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/BatchAccountGet.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -36,6 +37,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/BatchAccountGetKeys.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/BatchAccountGetKeys.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -34,6 +35,6 @@ def main():
print(item)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/BatchAccountList.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/BatchAccountList.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -36,6 +37,6 @@ def main():
print(item)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/BatchAccountListByResourceGroup.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/BatchAccountListByResourceGroup.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -37,6 +38,6 @@ def main():
print(item)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/BatchAccountListOutboundNetworkDependenciesEndpoints.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/BatchAccountListOutboundNetworkDependenciesEndpoints.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -37,6 +38,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/BatchAccountRegenerateKey.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/BatchAccountRegenerateKey.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -35,6 +36,6 @@ def main():
)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/BatchAccountSynchronizeAutoStorageKeys.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/BatchAccountSynchronizeAutoStorageKeys.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -43,6 +44,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/BatchAccountUpdate.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/BatchAccountUpdate.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -37,6 +38,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/CertificateCancelDeletion.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/CertificateCancelDeletion.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -46,6 +47,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/CertificateCreate_Full.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/CertificateCreate_Full.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -38,6 +39,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/CertificateCreate_Minimal.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/CertificateCreate_Minimal.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -38,6 +39,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/CertificateCreate_MinimalCer.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/CertificateCreate_MinimalCer.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -36,6 +37,6 @@ def main():
).result()
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/CertificateDelete.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/CertificateDelete.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -37,6 +38,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/CertificateGet.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/CertificateGet.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -37,6 +38,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/CertificateGetWithDeletionError.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/CertificateGetWithDeletionError.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -37,6 +38,6 @@ def main():
print(item)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/CertificateList.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/CertificateList.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -37,6 +38,6 @@ def main():
print(item)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/CertificateListWithFilter.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/CertificateListWithFilter.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -38,6 +39,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/CertificateUpdate.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/CertificateUpdate.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -37,6 +38,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/DetectorGet.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/DetectorGet.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -37,6 +38,6 @@ def main():
print(item)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/DetectorList.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/DetectorList.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -36,6 +37,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/LocationCheckNameAvailability_AlreadyExists.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/LocationCheckNameAvailability_AlreadyExists.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -36,6 +37,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/LocationCheckNameAvailability_Available.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/LocationCheckNameAvailability_Available.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -35,6 +36,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/LocationGetQuotas.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/LocationGetQuotas.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -36,6 +37,6 @@ def main():
print(item)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/LocationListVirtualMachineSkus.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/LocationListVirtualMachineSkus.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -14,7 +15,7 @@ from azure.mgmt.batch import BatchManagementClient
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python pool_create_minimal_cloud_service_configuration.py
python nsp_configuration_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,
@ -29,21 +30,14 @@ def main():
subscription_id="subid",
)
response = client.pool.create(
response = client.network_security_perimeter.get_configuration(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
pool_name="testpool",
parameters={
"properties": {
"deploymentConfiguration": {"cloudServiceConfiguration": {"osFamily": "5"}},
"scaleSettings": {"fixedScale": {"targetDedicatedNodes": 3}},
"vmSize": "STANDARD_D4",
}
},
network_security_perimeter_configuration_name="00000000-0000-0000-0000-000000000000.sampleassociation",
)
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_MinimalCloudServiceConfiguration.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/NspConfigurationGet.json
if __name__ == "__main__":
main()

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

@ -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) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python nsp_configuration_reconcile.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 = BatchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
client.network_security_perimeter.begin_reconcile_configuration(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
network_security_perimeter_configuration_name="00000000-0000-0000-0000-000000000000.sampleassociation",
).result()
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/NspConfigurationReconcile.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -14,7 +15,7 @@ from azure.mgmt.batch import BatchManagementClient
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python location_list_cloud_service_skus.py
python nsp_configurations_list.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,
@ -29,13 +30,14 @@ def main():
subscription_id="subid",
)
response = client.location.list_supported_cloud_service_skus(
location_name="japaneast",
response = client.network_security_perimeter.list_configurations(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
)
for item in response:
print(item)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/LocationListCloudServiceSkus.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/NspConfigurationsList.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -34,6 +35,6 @@ def main():
print(item)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/OperationsList.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/OperationsList.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -58,6 +59,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_AcceleratedNetworking.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/PoolCreate_AcceleratedNetworking.json
if __name__ == "__main__":
main()

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

@ -1,110 +0,0 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python pool_create_cloud_service_configuration.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 = BatchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.pool.create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
pool_name="testpool",
parameters={
"properties": {
"applicationLicenses": ["app-license0", "app-license1"],
"applicationPackages": [
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/applications/app_1234",
"version": "asdf",
}
],
"certificates": [
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/certificates/sha1-1234567",
"storeLocation": "LocalMachine",
"storeName": "MY",
"visibility": ["RemoteUser"],
}
],
"deploymentConfiguration": {
"cloudServiceConfiguration": {"osFamily": "4", "osVersion": "WA-GUEST-OS-4.45_201708-01"}
},
"displayName": "my-pool-name",
"interNodeCommunication": "Enabled",
"metadata": [{"name": "metadata-1", "value": "value-1"}, {"name": "metadata-2", "value": "value-2"}],
"networkConfiguration": {
"publicIPAddressConfiguration": {
"ipAddressIds": [
"/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135",
"/subscriptions/subid2/resourceGroups/rg24/providers/Microsoft.Network/publicIPAddresses/ip268",
],
"provision": "UserManaged",
},
"subnetId": "/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123",
},
"scaleSettings": {
"fixedScale": {
"nodeDeallocationOption": "TaskCompletion",
"resizeTimeout": "PT8M",
"targetDedicatedNodes": 6,
"targetLowPriorityNodes": 28,
}
},
"startTask": {
"commandLine": "cmd /c SET",
"environmentSettings": [{"name": "MYSET", "value": "1234"}],
"maxTaskRetryCount": 6,
"resourceFiles": [
{
"fileMode": "777",
"filePath": "c:\\temp\\gohere",
"httpUrl": "https://testaccount.blob.core.windows.net/example-blob-file",
}
],
"userIdentity": {"autoUser": {"elevationLevel": "Admin", "scope": "Pool"}},
"waitForSuccess": True,
},
"taskSchedulingPolicy": {"nodeFillType": "Pack"},
"taskSlotsPerNode": 13,
"userAccounts": [
{
"elevationLevel": "Admin",
"linuxUserConfiguration": {"gid": 4567, "sshPrivateKey": "sshprivatekeyvalue", "uid": 1234},
"name": "username1",
"password": "<ExamplePassword>",
}
],
"vmSize": "STANDARD_D4",
}
},
)
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_CloudServiceConfiguration.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -54,6 +55,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_MinimalVirtualMachineConfiguration.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/PoolCreate_MinimalVirtualMachineConfiguration.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -54,6 +55,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_NoPublicIPAddresses.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/PoolCreate_NoPublicIPAddresses.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -59,6 +60,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_PublicIPs.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/PoolCreate_PublicIPs.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -55,6 +56,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_ResourceTags.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/PoolCreate_ResourceTags.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -59,6 +60,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_SecurityProfile.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/PoolCreate_SecurityProfile.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -50,6 +51,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_SharedImageGallery.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/PoolCreate_SharedImageGallery.json
if __name__ == "__main__":
main()

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

@ -0,0 +1,61 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python pool_create_tags.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 = BatchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.pool.create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
pool_name="testpool",
parameters={
"properties": {
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"offer": "0001-com-ubuntu-server-jammy",
"publisher": "Canonical",
"sku": "22_04-lts",
"version": "latest",
},
"nodeAgentSkuId": "batch.node.ubuntu 22.04",
}
},
"scaleSettings": {"fixedScale": {"targetDedicatedNodes": 1, "targetLowPriorityNodes": 0}},
"vmSize": "Standard_d4s_v3",
},
"tags": {"TagName1": "TagValue1", "TagName2": "TagValue2"},
},
)
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/PoolCreate_Tags.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -74,6 +75,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_UpgradePolicy.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/PoolCreate_UpgradePolicy.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -61,6 +62,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_UserAssignedIdentities.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/PoolCreate_UserAssignedIdentities.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -90,6 +91,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_VirtualMachineConfiguration.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/PoolCreate_VirtualMachineConfiguration.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -68,6 +69,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_VirtualMachineConfiguration_Extensions.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/PoolCreate_VirtualMachineConfiguration_Extensions.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -59,6 +60,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_VirtualMachineConfiguration_ManagedOSDisk.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/PoolCreate_VirtualMachineConfiguration_ManagedOSDisk.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -59,6 +60,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_VirtualMachineConfiguration_ServiceArtifactReference.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/PoolCreate_VirtualMachineConfiguration_ServiceArtifactReference.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -36,6 +37,6 @@ def main():
).result()
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolDelete.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/PoolDelete.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -37,6 +38,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolDisableAutoScale.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/PoolDisableAutoScale.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -37,6 +38,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolGet.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/PoolGet.json
if __name__ == "__main__":
main()

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

@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
@ -37,6 +38,6 @@ def main():
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolGet_AcceleratedNetworking.json
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/PoolGet_AcceleratedNetworking.json
if __name__ == "__main__":
main()

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