From ae8e2534307e3288d4caf661aed35f9b4a7d7ea0 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 6 May 2021 01:53:49 +0000 Subject: [PATCH] CodeGen from PR 13970 in Azure/azure-rest-api-specs StoragePool RP New Preview API (#13970) * No changes -- new version directory with old specs * New API version Changes * Validation errors * revisions * Fixes * Revisions * Revisions * Revisions * Updates * Annotating required property * Availability zone is not required during Disk Pool Creation * Fixing swagger route typo * Fixes Avocado errors due to swagger file not being referenced * Updated python readme * [python] Update readme.md (#14184) * Update readme.md * Update readme.python.md * Fix merge conflicts * Swagger linting errors Co-authored-by: Harshitha Akkaraju Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com> --- .../azure-mgmt-storagepool/CHANGELOG.md | 5 + .../azure-mgmt-storagepool/MANIFEST.in | 6 + .../azure-mgmt-storagepool/README.md | 27 + .../azure-mgmt-storagepool/_meta.json | 8 + .../azure-mgmt-storagepool/azure/__init__.py | 1 + .../azure/mgmt/__init__.py | 1 + .../azure/mgmt/storagepool/__init__.py | 19 + .../azure/mgmt/storagepool/_configuration.py | 71 + .../azure/mgmt/storagepool/_metadata.json | 106 ++ .../storagepool/_storage_pool_management.py | 104 ++ .../azure/mgmt/storagepool/_version.py | 9 + .../azure/mgmt/storagepool/aio/__init__.py | 10 + .../mgmt/storagepool/aio/_configuration.py | 67 + .../aio/_storage_pool_management.py | 97 ++ .../storagepool/aio/operations/__init__.py | 19 + .../operations/_disk_pool_zones_operations.py | 113 ++ .../aio/operations/_disk_pools_operations.py | 900 +++++++++++++ .../operations/_iscsi_targets_operations.py | 568 ++++++++ .../storagepool/aio/operations/_operations.py | 105 ++ .../azure/mgmt/storagepool/models/__init__.py | 110 ++ .../azure/mgmt/storagepool/models/_models.py | 1079 +++++++++++++++ .../mgmt/storagepool/models/_models_py3.py | 1182 +++++++++++++++++ .../models/_storage_pool_management_enums.py | 77 ++ .../mgmt/storagepool/operations/__init__.py | 19 + .../operations/_disk_pool_zones_operations.py | 118 ++ .../operations/_disk_pools_operations.py | 918 +++++++++++++ .../operations/_iscsi_targets_operations.py | 580 ++++++++ .../storagepool/operations/_operations.py | 110 ++ .../azure/mgmt/storagepool/py.typed | 1 + .../azure-mgmt-storagepool/sdk_packaging.toml | 9 + .../azure-mgmt-storagepool/setup.cfg | 2 + .../azure-mgmt-storagepool/setup.py | 91 ++ sdk/storagepool/ci.yml | 35 + 33 files changed, 6567 insertions(+) create mode 100644 sdk/storagepool/azure-mgmt-storagepool/CHANGELOG.md create mode 100644 sdk/storagepool/azure-mgmt-storagepool/MANIFEST.in create mode 100644 sdk/storagepool/azure-mgmt-storagepool/README.md create mode 100644 sdk/storagepool/azure-mgmt-storagepool/_meta.json create mode 100644 sdk/storagepool/azure-mgmt-storagepool/azure/__init__.py create mode 100644 sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/__init__.py create mode 100644 sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/__init__.py create mode 100644 sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/_configuration.py create mode 100644 sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/_metadata.json create mode 100644 sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/_storage_pool_management.py create mode 100644 sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/_version.py create mode 100644 sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/aio/__init__.py create mode 100644 sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/aio/_configuration.py create mode 100644 sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/aio/_storage_pool_management.py create mode 100644 sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/aio/operations/__init__.py create mode 100644 sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/aio/operations/_disk_pool_zones_operations.py create mode 100644 sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/aio/operations/_disk_pools_operations.py create mode 100644 sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/aio/operations/_iscsi_targets_operations.py create mode 100644 sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/aio/operations/_operations.py create mode 100644 sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/models/__init__.py create mode 100644 sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/models/_models.py create mode 100644 sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/models/_models_py3.py create mode 100644 sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/models/_storage_pool_management_enums.py create mode 100644 sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/operations/__init__.py create mode 100644 sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/operations/_disk_pool_zones_operations.py create mode 100644 sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/operations/_disk_pools_operations.py create mode 100644 sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/operations/_iscsi_targets_operations.py create mode 100644 sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/operations/_operations.py create mode 100644 sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/py.typed create mode 100644 sdk/storagepool/azure-mgmt-storagepool/sdk_packaging.toml create mode 100644 sdk/storagepool/azure-mgmt-storagepool/setup.cfg create mode 100644 sdk/storagepool/azure-mgmt-storagepool/setup.py create mode 100644 sdk/storagepool/ci.yml diff --git a/sdk/storagepool/azure-mgmt-storagepool/CHANGELOG.md b/sdk/storagepool/azure-mgmt-storagepool/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/storagepool/azure-mgmt-storagepool/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/storagepool/azure-mgmt-storagepool/MANIFEST.in b/sdk/storagepool/azure-mgmt-storagepool/MANIFEST.in new file mode 100644 index 000000000000..3a9b6517412b --- /dev/null +++ b/sdk/storagepool/azure-mgmt-storagepool/MANIFEST.in @@ -0,0 +1,6 @@ +include _meta.json +recursive-include tests *.py *.yaml +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py + diff --git a/sdk/storagepool/azure-mgmt-storagepool/README.md b/sdk/storagepool/azure-mgmt-storagepool/README.md new file mode 100644 index 000000000000..0ace6300666d --- /dev/null +++ b/sdk/storagepool/azure-mgmt-storagepool/README.md @@ -0,0 +1,27 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure MyService Management Client Library. +This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + + +# Usage + + +To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) + + + +For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) +Code samples for this package can be found at [MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-storagepool%2FREADME.png) diff --git a/sdk/storagepool/azure-mgmt-storagepool/_meta.json b/sdk/storagepool/azure-mgmt-storagepool/_meta.json new file mode 100644 index 000000000000..ca43aad7727f --- /dev/null +++ b/sdk/storagepool/azure-mgmt-storagepool/_meta.json @@ -0,0 +1,8 @@ +{ + "autorest": "3.3.0", + "use": "@autorest/python@5.6.6", + "commit": "3ae16652e8bea04884a273329d6dead5e9205794", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/storagepool/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.6.6 --version=3.3.0", + "readme": "specification/storagepool/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/storagepool/azure-mgmt-storagepool/azure/__init__.py b/sdk/storagepool/azure-mgmt-storagepool/azure/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/storagepool/azure-mgmt-storagepool/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/__init__.py b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/__init__.py b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/__init__.py new file mode 100644 index 000000000000..1524ba479e9d --- /dev/null +++ b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/__init__.py @@ -0,0 +1,19 @@ +# 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 ._storage_pool_management import StoragePoolManagement +from ._version import VERSION + +__version__ = VERSION +__all__ = ['StoragePoolManagement'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/_configuration.py b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/_configuration.py new file mode 100644 index 000000000000..d59d40ee6f16 --- /dev/null +++ b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/_configuration.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class StoragePoolManagementConfiguration(Configuration): + """Configuration for StoragePoolManagement. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(StoragePoolManagementConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-04-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-storagepool/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + 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.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/_metadata.json b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/_metadata.json new file mode 100644 index 000000000000..122ae08cb64c --- /dev/null +++ b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/_metadata.json @@ -0,0 +1,106 @@ +{ + "chosen_version": "2021-04-01-preview", + "total_api_version_list": ["2021-04-01-preview"], + "client": { + "name": "StoragePoolManagement", + "filename": "_storage_pool_management", + "description": "StoragePoolManagement.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"StoragePoolManagementConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"StoragePoolManagementConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "operations": "Operations", + "disk_pools": "DiskPoolsOperations", + "disk_pool_zones": "DiskPoolZonesOperations", + "iscsi_targets": "IscsiTargetsOperations" + } +} \ No newline at end of file diff --git a/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/_storage_pool_management.py b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/_storage_pool_management.py new file mode 100644 index 000000000000..8247b570df21 --- /dev/null +++ b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/_storage_pool_management.py @@ -0,0 +1,104 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import StoragePoolManagementConfiguration +from .operations import Operations +from .operations import DiskPoolsOperations +from .operations import DiskPoolZonesOperations +from .operations import IscsiTargetsOperations +from . import models + + +class StoragePoolManagement(object): + """StoragePoolManagement. + + :ivar operations: Operations operations + :vartype operations: storage_pool_management.operations.Operations + :ivar disk_pools: DiskPoolsOperations operations + :vartype disk_pools: storage_pool_management.operations.DiskPoolsOperations + :ivar disk_pool_zones: DiskPoolZonesOperations operations + :vartype disk_pool_zones: storage_pool_management.operations.DiskPoolZonesOperations + :ivar iscsi_targets: IscsiTargetsOperations operations + :vartype iscsi_targets: storage_pool_management.operations.IscsiTargetsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = StoragePoolManagementConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.disk_pools = DiskPoolsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.disk_pool_zones = DiskPoolZonesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.iscsi_targets = IscsiTargetsOperations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> StoragePoolManagement + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/_version.py b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/_version.py @@ -0,0 +1,9 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/aio/__init__.py b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/aio/__init__.py new file mode 100644 index 000000000000..9eb7de1efa2e --- /dev/null +++ b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/aio/__init__.py @@ -0,0 +1,10 @@ +# 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 ._storage_pool_management import StoragePoolManagement +__all__ = ['StoragePoolManagement'] diff --git a/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/aio/_configuration.py b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/aio/_configuration.py new file mode 100644 index 000000000000..9df6047d7d8a --- /dev/null +++ b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/aio/_configuration.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class StoragePoolManagementConfiguration(Configuration): + """Configuration for StoragePoolManagement. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(StoragePoolManagementConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-04-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-storagepool/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + 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.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/aio/_storage_pool_management.py b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/aio/_storage_pool_management.py new file mode 100644 index 000000000000..cabe44f08198 --- /dev/null +++ b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/aio/_storage_pool_management.py @@ -0,0 +1,97 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import StoragePoolManagementConfiguration +from .operations import Operations +from .operations import DiskPoolsOperations +from .operations import DiskPoolZonesOperations +from .operations import IscsiTargetsOperations +from .. import models + + +class StoragePoolManagement(object): + """StoragePoolManagement. + + :ivar operations: Operations operations + :vartype operations: storage_pool_management.aio.operations.Operations + :ivar disk_pools: DiskPoolsOperations operations + :vartype disk_pools: storage_pool_management.aio.operations.DiskPoolsOperations + :ivar disk_pool_zones: DiskPoolZonesOperations operations + :vartype disk_pool_zones: storage_pool_management.aio.operations.DiskPoolZonesOperations + :ivar iscsi_targets: IscsiTargetsOperations operations + :vartype iscsi_targets: storage_pool_management.aio.operations.IscsiTargetsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = StoragePoolManagementConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.disk_pools = DiskPoolsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.disk_pool_zones = DiskPoolZonesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.iscsi_targets = IscsiTargetsOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "StoragePoolManagement": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/aio/operations/__init__.py b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/aio/operations/__init__.py new file mode 100644 index 000000000000..1620075f15e8 --- /dev/null +++ b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/aio/operations/__init__.py @@ -0,0 +1,19 @@ +# 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 ._operations import Operations +from ._disk_pools_operations import DiskPoolsOperations +from ._disk_pool_zones_operations import DiskPoolZonesOperations +from ._iscsi_targets_operations import IscsiTargetsOperations + +__all__ = [ + 'Operations', + 'DiskPoolsOperations', + 'DiskPoolZonesOperations', + 'IscsiTargetsOperations', +] diff --git a/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/aio/operations/_disk_pool_zones_operations.py b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/aio/operations/_disk_pool_zones_operations.py new file mode 100644 index 000000000000..88a22dbb19b0 --- /dev/null +++ b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/aio/operations/_disk_pool_zones_operations.py @@ -0,0 +1,113 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DiskPoolZonesOperations: + """DiskPoolZonesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~storage_pool_management.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + location: str, + **kwargs + ) -> AsyncIterable["_models.DiskPoolZoneListResult"]: + """Lists available Disk Pool Skus in an Azure location. + + :param location: The location of the resource. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiskPoolZoneListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~storage_pool_management.models.DiskPoolZoneListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskPoolZoneListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'location': self._serialize.url("location", location, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DiskPoolZoneListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.Error, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StoragePool/locations/{location}/diskPoolZones'} # type: ignore diff --git a/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/aio/operations/_disk_pools_operations.py b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/aio/operations/_disk_pools_operations.py new file mode 100644 index 000000000000..c48b610a16c7 --- /dev/null +++ b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/aio/operations/_disk_pools_operations.py @@ -0,0 +1,900 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DiskPoolsOperations: + """DiskPoolsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~storage_pool_management.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_subscription( + self, + **kwargs + ) -> AsyncIterable["_models.DiskPoolListResult"]: + """Gets a list of Disk Pools in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiskPoolListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~storage_pool_management.models.DiskPoolListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskPoolListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DiskPoolListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.Error, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StoragePool/diskPools'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["_models.DiskPoolListResult"]: + """Gets a list of DiskPools in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiskPoolListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~storage_pool_management.models.DiskPoolListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskPoolListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DiskPoolListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.Error, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + disk_pool_name: str, + disk_pool_create_payload: "_models.DiskPoolCreate", + **kwargs + ) -> "_models.DiskPool": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskPool"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(disk_pool_create_payload, 'DiskPoolCreate') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DiskPool', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DiskPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + disk_pool_name: str, + disk_pool_create_payload: "_models.DiskPoolCreate", + **kwargs + ) -> AsyncLROPoller["_models.DiskPool"]: + """Create or Update Disk pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param disk_pool_name: The name of the Disk Pool. + :type disk_pool_name: str + :param disk_pool_create_payload: Request payload for Disk Pool create operation. + :type disk_pool_create_payload: ~storage_pool_management.models.DiskPoolCreate + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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 DiskPool or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~storage_pool_management.models.DiskPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskPool"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + disk_pool_name=disk_pool_name, + disk_pool_create_payload=disk_pool_create_payload, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DiskPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + disk_pool_name: str, + disk_pool_update_payload: "_models.DiskPoolUpdate", + **kwargs + ) -> Optional["_models.DiskPool"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DiskPool"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(disk_pool_update_payload, 'DiskPoolUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DiskPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + disk_pool_name: str, + disk_pool_update_payload: "_models.DiskPoolUpdate", + **kwargs + ) -> AsyncLROPoller["_models.DiskPool"]: + """Update a Disk pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param disk_pool_name: The name of the Disk Pool. + :type disk_pool_name: str + :param disk_pool_update_payload: Request payload for Disk Pool update operation. + :type disk_pool_update_payload: ~storage_pool_management.models.DiskPoolUpdate + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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 DiskPool or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~storage_pool_management.models.DiskPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskPool"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + disk_pool_name=disk_pool_name, + disk_pool_update_payload=disk_pool_update_payload, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DiskPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + disk_pool_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + disk_pool_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Delete a Disk pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param disk_pool_name: The name of the Disk Pool. + :type disk_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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + disk_pool_name=disk_pool_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + disk_pool_name: str, + **kwargs + ) -> "_models.DiskPool": + """Get a Disk pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param disk_pool_name: The name of the Disk Pool. + :type disk_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiskPool, or the result of cls(response) + :rtype: ~storage_pool_management.models.DiskPool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskPool"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiskPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}'} # type: ignore + + def list_outbound_network_dependencies_endpoints( + self, + resource_group_name: str, + disk_pool_name: str, + **kwargs + ) -> AsyncIterable["_models.OutboundEnvironmentEndpointList"]: + """Gets the network endpoints of all outbound dependencies of a Disk Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param disk_pool_name: The name of the Disk Pool. + :type disk_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OutboundEnvironmentEndpointList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~storage_pool_management.models.OutboundEnvironmentEndpointList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_outbound_network_dependencies_endpoints.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OutboundEnvironmentEndpointList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.Error, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_outbound_network_dependencies_endpoints.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}/outboundNetworkDependenciesEndpoints'} # type: ignore + + async def _start_initial( + self, + resource_group_name: str, + disk_pool_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + # Construct URL + url = self._start_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}/start'} # type: ignore + + async def begin_start( + self, + resource_group_name: str, + disk_pool_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """The operation to start a Disk Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param disk_pool_name: The name of the Disk Pool. + :type disk_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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._start_initial( + resource_group_name=resource_group_name, + disk_pool_name=disk_pool_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}/start'} # type: ignore + + async def _deallocate_initial( + self, + resource_group_name: str, + disk_pool_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + # Construct URL + url = self._deallocate_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}/deallocate'} # type: ignore + + async def begin_deallocate( + self, + resource_group_name: str, + disk_pool_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Shuts down the Disk Pool and releases the compute resources. You are not billed for the compute + resources that this Disk Pool uses. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param disk_pool_name: The name of the Disk Pool. + :type disk_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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._deallocate_initial( + resource_group_name=resource_group_name, + disk_pool_name=disk_pool_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_deallocate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}/deallocate'} # type: ignore diff --git a/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/aio/operations/_iscsi_targets_operations.py b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/aio/operations/_iscsi_targets_operations.py new file mode 100644 index 000000000000..3a77ce000825 --- /dev/null +++ b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/aio/operations/_iscsi_targets_operations.py @@ -0,0 +1,568 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class IscsiTargetsOperations: + """IscsiTargetsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~storage_pool_management.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_disk_pool( + self, + resource_group_name: str, + disk_pool_name: str, + **kwargs + ) -> AsyncIterable["_models.IscsiTargetList"]: + """Get iSCSI Targets in a Disk pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param disk_pool_name: The name of the Disk Pool. + :type disk_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IscsiTargetList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~storage_pool_management.models.IscsiTargetList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IscsiTargetList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_disk_pool.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('IscsiTargetList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.Error, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_disk_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}/iscsiTargets'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + disk_pool_name: str, + iscsi_target_name: str, + iscsi_target_create_payload: "_models.IscsiTargetCreate", + **kwargs + ) -> "_models.IscsiTarget": + cls = kwargs.pop('cls', None) # type: ClsType["_models.IscsiTarget"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + 'iscsiTargetName': self._serialize.url("iscsi_target_name", iscsi_target_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(iscsi_target_create_payload, 'IscsiTargetCreate') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('IscsiTarget', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('IscsiTarget', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}/iscsiTargets/{iscsiTargetName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + disk_pool_name: str, + iscsi_target_name: str, + iscsi_target_create_payload: "_models.IscsiTargetCreate", + **kwargs + ) -> AsyncLROPoller["_models.IscsiTarget"]: + """Create or Update an iSCSI Target. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param disk_pool_name: The name of the Disk Pool. + :type disk_pool_name: str + :param iscsi_target_name: The name of the iSCSI Target. + :type iscsi_target_name: str + :param iscsi_target_create_payload: Request payload for iSCSI Target create operation. + :type iscsi_target_create_payload: ~storage_pool_management.models.IscsiTargetCreate + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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 IscsiTarget or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~storage_pool_management.models.IscsiTarget] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IscsiTarget"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + disk_pool_name=disk_pool_name, + iscsi_target_name=iscsi_target_name, + iscsi_target_create_payload=iscsi_target_create_payload, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('IscsiTarget', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + 'iscsiTargetName': self._serialize.url("iscsi_target_name", iscsi_target_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}/iscsiTargets/{iscsiTargetName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + disk_pool_name: str, + iscsi_target_name: str, + iscsi_target_update_payload: "_models.IscsiTargetUpdate", + **kwargs + ) -> Optional["_models.IscsiTarget"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.IscsiTarget"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + 'iscsiTargetName': self._serialize.url("iscsi_target_name", iscsi_target_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(iscsi_target_update_payload, 'IscsiTargetUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('IscsiTarget', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}/iscsiTargets/{iscsiTargetName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + disk_pool_name: str, + iscsi_target_name: str, + iscsi_target_update_payload: "_models.IscsiTargetUpdate", + **kwargs + ) -> AsyncLROPoller["_models.IscsiTarget"]: + """Update an iSCSI Target. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param disk_pool_name: The name of the Disk Pool. + :type disk_pool_name: str + :param iscsi_target_name: The name of the iSCSI Target. + :type iscsi_target_name: str + :param iscsi_target_update_payload: Request payload for iSCSI Target update operation. + :type iscsi_target_update_payload: ~storage_pool_management.models.IscsiTargetUpdate + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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 IscsiTarget or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~storage_pool_management.models.IscsiTarget] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IscsiTarget"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + disk_pool_name=disk_pool_name, + iscsi_target_name=iscsi_target_name, + iscsi_target_update_payload=iscsi_target_update_payload, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('IscsiTarget', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + 'iscsiTargetName': self._serialize.url("iscsi_target_name", iscsi_target_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}/iscsiTargets/{iscsiTargetName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + disk_pool_name: str, + iscsi_target_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + 'iscsiTargetName': self._serialize.url("iscsi_target_name", iscsi_target_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}/iscsiTargets/{iscsiTargetName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + disk_pool_name: str, + iscsi_target_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Delete an iSCSI Target. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param disk_pool_name: The name of the Disk Pool. + :type disk_pool_name: str + :param iscsi_target_name: The name of the iSCSI Target. + :type iscsi_target_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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + disk_pool_name=disk_pool_name, + iscsi_target_name=iscsi_target_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + 'iscsiTargetName': self._serialize.url("iscsi_target_name", iscsi_target_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}/iscsiTargets/{iscsiTargetName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + disk_pool_name: str, + iscsi_target_name: str, + **kwargs + ) -> "_models.IscsiTarget": + """Get an iSCSI Target. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param disk_pool_name: The name of the Disk Pool. + :type disk_pool_name: str + :param iscsi_target_name: The name of the iSCSI Target. + :type iscsi_target_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IscsiTarget, or the result of cls(response) + :rtype: ~storage_pool_management.models.IscsiTarget + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IscsiTarget"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + 'iscsiTargetName': self._serialize.url("iscsi_target_name", iscsi_target_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IscsiTarget', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}/iscsiTargets/{iscsiTargetName}'} # type: ignore diff --git a/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/aio/operations/_operations.py b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/aio/operations/_operations.py new file mode 100644 index 000000000000..924f5b26de74 --- /dev/null +++ b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/aio/operations/_operations.py @@ -0,0 +1,105 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~storage_pool_management.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs + ) -> AsyncIterable["_models.StoragePoolOperationListResult"]: + """Gets a list of StoragePool operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StoragePoolOperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~storage_pool_management.models.StoragePoolOperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StoragePoolOperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('StoragePoolOperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.Error, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.StoragePool/operations'} # type: ignore diff --git a/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/models/__init__.py b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/models/__init__.py new file mode 100644 index 000000000000..1bd7f4b2711b --- /dev/null +++ b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/models/__init__.py @@ -0,0 +1,110 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import Acl + from ._models_py3 import Disk + from ._models_py3 import DiskPool + from ._models_py3 import DiskPoolCreate + from ._models_py3 import DiskPoolListResult + from ._models_py3 import DiskPoolUpdate + from ._models_py3 import DiskPoolZoneInfo + from ._models_py3 import DiskPoolZoneListResult + from ._models_py3 import EndpointDependency + from ._models_py3 import EndpointDetail + from ._models_py3 import Error + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorResponse + from ._models_py3 import IscsiLun + from ._models_py3 import IscsiTarget + from ._models_py3 import IscsiTargetCreate + from ._models_py3 import IscsiTargetList + from ._models_py3 import IscsiTargetUpdate + from ._models_py3 import OutboundEnvironmentEndpoint + from ._models_py3 import OutboundEnvironmentEndpointList + from ._models_py3 import ProxyResource + from ._models_py3 import Resource + from ._models_py3 import Sku + from ._models_py3 import StoragePoolOperationDisplay + from ._models_py3 import StoragePoolOperationListResult + from ._models_py3 import StoragePoolRPOperation + from ._models_py3 import SystemMetadata + from ._models_py3 import TrackedResource +except (SyntaxError, ImportError): + from ._models import Acl # type: ignore + from ._models import Disk # type: ignore + from ._models import DiskPool # type: ignore + from ._models import DiskPoolCreate # type: ignore + from ._models import DiskPoolListResult # type: ignore + from ._models import DiskPoolUpdate # type: ignore + from ._models import DiskPoolZoneInfo # type: ignore + from ._models import DiskPoolZoneListResult # type: ignore + from ._models import EndpointDependency # type: ignore + from ._models import EndpointDetail # type: ignore + from ._models import Error # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import IscsiLun # type: ignore + from ._models import IscsiTarget # type: ignore + from ._models import IscsiTargetCreate # type: ignore + from ._models import IscsiTargetList # type: ignore + from ._models import IscsiTargetUpdate # type: ignore + from ._models import OutboundEnvironmentEndpoint # type: ignore + from ._models import OutboundEnvironmentEndpointList # type: ignore + from ._models import ProxyResource # type: ignore + from ._models import Resource # type: ignore + from ._models import Sku # type: ignore + from ._models import StoragePoolOperationDisplay # type: ignore + from ._models import StoragePoolOperationListResult # type: ignore + from ._models import StoragePoolRPOperation # type: ignore + from ._models import SystemMetadata # type: ignore + from ._models import TrackedResource # type: ignore + +from ._storage_pool_management_enums import ( + CreatedByType, + DiskPoolTier, + IscsiTargetAclMode, + OperationalStatus, + ProvisioningStates, +) + +__all__ = [ + 'Acl', + 'Disk', + 'DiskPool', + 'DiskPoolCreate', + 'DiskPoolListResult', + 'DiskPoolUpdate', + 'DiskPoolZoneInfo', + 'DiskPoolZoneListResult', + 'EndpointDependency', + 'EndpointDetail', + 'Error', + 'ErrorAdditionalInfo', + 'ErrorResponse', + 'IscsiLun', + 'IscsiTarget', + 'IscsiTargetCreate', + 'IscsiTargetList', + 'IscsiTargetUpdate', + 'OutboundEnvironmentEndpoint', + 'OutboundEnvironmentEndpointList', + 'ProxyResource', + 'Resource', + 'Sku', + 'StoragePoolOperationDisplay', + 'StoragePoolOperationListResult', + 'StoragePoolRPOperation', + 'SystemMetadata', + 'TrackedResource', + 'CreatedByType', + 'DiskPoolTier', + 'IscsiTargetAclMode', + 'OperationalStatus', + 'ProvisioningStates', +] diff --git a/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/models/_models.py b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/models/_models.py new file mode 100644 index 000000000000..ac42dece1c9e --- /dev/null +++ b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/models/_models.py @@ -0,0 +1,1079 @@ +# 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.core.exceptions import HttpResponseError +import msrest.serialization + + +class Acl(msrest.serialization.Model): + """Access Control List (ACL) for an iSCSI Target; defines LUN masking policy. + + All required parameters must be populated in order to send to Azure. + + :param initiator_iqn: Required. iSCSI initiator IQN (iSCSI Qualified Name); example: + "iqn.2005-03.org.iscsi:client". + :type initiator_iqn: str + :param mapped_luns: Required. List of LUN names mapped to the ACL. + :type mapped_luns: list[str] + """ + + _validation = { + 'initiator_iqn': {'required': True}, + 'mapped_luns': {'required': True}, + } + + _attribute_map = { + 'initiator_iqn': {'key': 'initiatorIqn', 'type': 'str'}, + 'mapped_luns': {'key': 'mappedLuns', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(Acl, self).__init__(**kwargs) + self.initiator_iqn = kwargs['initiator_iqn'] + self.mapped_luns = kwargs['mapped_luns'] + + +class Disk(msrest.serialization.Model): + """Azure Managed Disk to attach to the Disk Pool. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique Azure Resource ID of the Managed Disk. + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Disk, self).__init__(**kwargs) + self.id = kwargs['id'] + + +class Resource(msrest.serialization.Model): + """ARM resource model definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class TrackedResource(Resource): + """The resource model definition for a ARM tracked top level resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.location = kwargs['location'] + + +class DiskPool(TrackedResource): + """Response for Disk Pool request. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + :ivar system_data: Resource metadata required by ARM RPC. + :vartype system_data: ~storage_pool_management.models.SystemMetadata + :ivar provisioning_state: Required. State of the operation on the resource. Possible values + include: "Invalid", "Succeeded", "Failed", "Canceled", "Pending", "Creating", "Updating", + "Deleting". + :vartype provisioning_state: str or ~storage_pool_management.models.ProvisioningStates + :param availability_zones: Required. Logical zone for Disk Pool resource; example: ["1"]. + :type availability_zones: list[str] + :param status: Required. Operational status of the Disk Pool. Possible values include: + "Invalid", "Unknown", "Healthy", "Unhealthy", "Updating", "Running", "Stopped", "Stopped + (deallocated)". + :type status: str or ~storage_pool_management.models.OperationalStatus + :param disks: List of Azure Managed Disks to attach to a Disk Pool. + :type disks: list[~storage_pool_management.models.Disk] + :param subnet_id: Required. Azure Resource ID of a Subnet for the Disk Pool. + :type subnet_id: str + :param additional_capabilities: List of additional capabilities for Disk Pool. + :type additional_capabilities: list[str] + :param name_sku_name: Sku name. + :type name_sku_name: str + :param tier: Sku tier. + :type tier: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'required': True, 'readonly': True}, + 'availability_zones': {'required': True}, + 'status': {'required': True}, + 'subnet_id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemMetadata'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'disks': {'key': 'properties.disks', 'type': '[Disk]'}, + 'subnet_id': {'key': 'properties.subnetId', 'type': 'str'}, + 'additional_capabilities': {'key': 'properties.additionalCapabilities', 'type': '[str]'}, + 'name_sku_name': {'key': 'sku.name', 'type': 'str'}, + 'tier': {'key': 'sku.tier', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DiskPool, self).__init__(**kwargs) + self.system_data = None + self.provisioning_state = None + self.availability_zones = kwargs['availability_zones'] + self.status = kwargs['status'] + self.disks = kwargs.get('disks', None) + self.subnet_id = kwargs['subnet_id'] + self.additional_capabilities = kwargs.get('additional_capabilities', None) + self.name_sku_name = kwargs.get('name_sku_name', None) + self.tier = kwargs.get('tier', None) + + +class DiskPoolCreate(msrest.serialization.Model): + """Request payload for create or update Disk Pool request. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param sku: Required. Determines the SKU of the Disk Pool. + :type sku: ~storage_pool_management.models.Sku + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param availability_zones: Logical zone for Disk Pool resource; example: ["1"]. + :type availability_zones: list[str] + :param disks: List of Azure Managed Disks to attach to a Disk Pool. + :type disks: list[~storage_pool_management.models.Disk] + :param subnet_id: Required. Azure Resource ID of a Subnet for the Disk Pool. + :type subnet_id: str + :param additional_capabilities: List of additional capabilities for a Disk Pool. + :type additional_capabilities: list[str] + """ + + _validation = { + 'sku': {'required': True}, + 'location': {'required': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'subnet_id': {'required': True}, + } + + _attribute_map = { + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, + 'disks': {'key': 'properties.disks', 'type': '[Disk]'}, + 'subnet_id': {'key': 'properties.subnetId', 'type': 'str'}, + 'additional_capabilities': {'key': 'properties.additionalCapabilities', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(DiskPoolCreate, self).__init__(**kwargs) + self.sku = kwargs['sku'] + self.tags = kwargs.get('tags', None) + self.location = kwargs['location'] + self.id = None + self.name = None + self.type = None + self.availability_zones = kwargs.get('availability_zones', None) + self.disks = kwargs.get('disks', None) + self.subnet_id = kwargs['subnet_id'] + self.additional_capabilities = kwargs.get('additional_capabilities', None) + + +class DiskPoolListResult(msrest.serialization.Model): + """List of Disk Pools. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. An array of Disk pool objects. + :type value: list[~storage_pool_management.models.DiskPool] + :ivar next_link: URI to fetch the next section of the paginated response. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DiskPool]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DiskPoolListResult, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class DiskPoolUpdate(msrest.serialization.Model): + """Request payload for Update Disk Pool request. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param disks: List of Azure Managed Disks to attach to a Disk Pool. + :type disks: list[~storage_pool_management.models.Disk] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'disks': {'key': 'properties.disks', 'type': '[Disk]'}, + } + + def __init__( + self, + **kwargs + ): + super(DiskPoolUpdate, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.disks = kwargs.get('disks', None) + + +class DiskPoolZoneInfo(msrest.serialization.Model): + """Disk Pool Sku Details. + + :param availability_zones: Logical zone for Disk Pool resource; example: ["1"]. + :type availability_zones: list[str] + :param additional_capabilities: List of additional capabilities for Disk Pool. + :type additional_capabilities: list[str] + :param sku: Determines the SKU of VM deployed for Disk Pool. + :type sku: ~storage_pool_management.models.Sku + """ + + _attribute_map = { + 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, + 'additional_capabilities': {'key': 'additionalCapabilities', 'type': '[str]'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + } + + def __init__( + self, + **kwargs + ): + super(DiskPoolZoneInfo, self).__init__(**kwargs) + self.availability_zones = kwargs.get('availability_zones', None) + self.additional_capabilities = kwargs.get('additional_capabilities', None) + self.sku = kwargs.get('sku', None) + + +class DiskPoolZoneListResult(msrest.serialization.Model): + """List Disk Pool skus operation response. + + :param value: The list of Disk Pool Skus. + :type value: list[~storage_pool_management.models.DiskPoolZoneInfo] + :param next_link: URI to fetch the next section of the paginated response. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DiskPoolZoneInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DiskPoolZoneListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class EndpointDependency(msrest.serialization.Model): + """A domain name that a service is reached at, including details of the current connection status. + + :param domain_name: The domain name of the dependency. + :type domain_name: str + :param endpoint_details: The IP Addresses and Ports used when connecting to DomainName. + :type endpoint_details: list[~storage_pool_management.models.EndpointDetail] + """ + + _attribute_map = { + 'domain_name': {'key': 'domainName', 'type': 'str'}, + 'endpoint_details': {'key': 'endpointDetails', 'type': '[EndpointDetail]'}, + } + + def __init__( + self, + **kwargs + ): + super(EndpointDependency, self).__init__(**kwargs) + self.domain_name = kwargs.get('domain_name', None) + self.endpoint_details = kwargs.get('endpoint_details', None) + + +class EndpointDetail(msrest.serialization.Model): + """Current TCP connectivity information from the App Service Environment to a single endpoint. + + :param ip_address: An IP Address that Domain Name currently resolves to. + :type ip_address: str + :param port: The port an endpoint is connected to. + :type port: int + :param latency: The time in milliseconds it takes for a TCP connection to be created from the + App Service Environment to this IpAddress at this Port. + :type latency: float + :param is_accessible: Whether it is possible to create a TCP connection from the App Service + Environment to this IpAddress at this Port. + :type is_accessible: bool + """ + + _attribute_map = { + 'ip_address': {'key': 'ipAddress', 'type': 'str'}, + 'port': {'key': 'port', 'type': 'int'}, + 'latency': {'key': 'latency', 'type': 'float'}, + 'is_accessible': {'key': 'isAccessible', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(EndpointDetail, self).__init__(**kwargs) + self.ip_address = kwargs.get('ip_address', None) + self.port = kwargs.get('port', None) + self.latency = kwargs.get('latency', None) + self.is_accessible = kwargs.get('is_accessible', None) + + +class Error(msrest.serialization.Model): + """The resource management error response. + + :param error: RP error response. + :type error: ~storage_pool_management.models.ErrorResponse + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__( + self, + **kwargs + ): + super(Error, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: str + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorResponse(msrest.serialization.Model): + """The resource management error response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~storage_pool_management.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~storage_pool_management.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class IscsiLun(msrest.serialization.Model): + """LUN to expose the Azure Managed Disk. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. User defined name for iSCSI LUN; example: "lun0". + :type name: str + :param managed_disk_azure_resource_id: Required. Azure Resource ID of the Managed Disk. + :type managed_disk_azure_resource_id: str + """ + + _validation = { + 'name': {'required': True}, + 'managed_disk_azure_resource_id': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'managed_disk_azure_resource_id': {'key': 'managedDiskAzureResourceId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IscsiLun, self).__init__(**kwargs) + self.name = kwargs['name'] + self.managed_disk_azure_resource_id = kwargs['managed_disk_azure_resource_id'] + + +class ProxyResource(Resource): + """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProxyResource, self).__init__(**kwargs) + + +class IscsiTarget(ProxyResource): + """Response for iSCSI Target requests. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :ivar system_data: Resource metadata required by ARM RPC. + :vartype system_data: ~storage_pool_management.models.SystemMetadata + :param acl_mode: Required. Mode for Target connectivity. Possible values include: "Dynamic", + "Static". + :type acl_mode: str or ~storage_pool_management.models.IscsiTargetAclMode + :param static_acls: Access Control List (ACL) for an iSCSI Target; defines LUN masking policy. + :type static_acls: list[~storage_pool_management.models.Acl] + :param luns: List of LUNs to be exposed through iSCSI Target. + :type luns: list[~storage_pool_management.models.IscsiLun] + :param target_iqn: Required. iSCSI Target IQN (iSCSI Qualified Name); example: + "iqn.2005-03.org.iscsi:server". + :type target_iqn: str + :ivar provisioning_state: Required. State of the operation on the resource. Possible values + include: "Invalid", "Succeeded", "Failed", "Canceled", "Pending", "Creating", "Updating", + "Deleting". + :vartype provisioning_state: str or ~storage_pool_management.models.ProvisioningStates + :param status: Required. Operational status of the iSCSI Target. Possible values include: + "Invalid", "Unknown", "Healthy", "Unhealthy", "Updating", "Running", "Stopped", "Stopped + (deallocated)". + :type status: str or ~storage_pool_management.models.OperationalStatus + :param endpoints: List of private IPv4 addresses to connect to the iSCSI Target. + :type endpoints: list[str] + :param port: The port used by iSCSI Target portal group. + :type port: int + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'acl_mode': {'required': True}, + 'target_iqn': {'required': True}, + 'provisioning_state': {'required': True, 'readonly': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemMetadata'}, + 'acl_mode': {'key': 'properties.aclMode', 'type': 'str'}, + 'static_acls': {'key': 'properties.staticAcls', 'type': '[Acl]'}, + 'luns': {'key': 'properties.luns', 'type': '[IscsiLun]'}, + 'target_iqn': {'key': 'properties.targetIqn', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'endpoints': {'key': 'properties.endpoints', 'type': '[str]'}, + 'port': {'key': 'properties.port', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(IscsiTarget, self).__init__(**kwargs) + self.system_data = None + self.acl_mode = kwargs['acl_mode'] + self.static_acls = kwargs.get('static_acls', None) + self.luns = kwargs.get('luns', None) + self.target_iqn = kwargs['target_iqn'] + self.provisioning_state = None + self.status = kwargs['status'] + self.endpoints = kwargs.get('endpoints', None) + self.port = kwargs.get('port', None) + + +class IscsiTargetCreate(ProxyResource): + """Payload for iSCSI Target create or update requests. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param acl_mode: Required. Mode for Target connectivity. Possible values include: "Dynamic", + "Static". + :type acl_mode: str or ~storage_pool_management.models.IscsiTargetAclMode + :param target_iqn: iSCSI Target IQN (iSCSI Qualified Name); example: + "iqn.2005-03.org.iscsi:server". + :type target_iqn: str + :param static_acls: Access Control List (ACL) for an iSCSI Target; defines LUN masking policy. + :type static_acls: list[~storage_pool_management.models.Acl] + :param luns: List of LUNs to be exposed through iSCSI Target. + :type luns: list[~storage_pool_management.models.IscsiLun] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'acl_mode': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'acl_mode': {'key': 'properties.aclMode', 'type': 'str'}, + 'target_iqn': {'key': 'properties.targetIqn', 'type': 'str'}, + 'static_acls': {'key': 'properties.staticAcls', 'type': '[Acl]'}, + 'luns': {'key': 'properties.luns', 'type': '[IscsiLun]'}, + } + + def __init__( + self, + **kwargs + ): + super(IscsiTargetCreate, self).__init__(**kwargs) + self.acl_mode = kwargs['acl_mode'] + self.target_iqn = kwargs.get('target_iqn', None) + self.static_acls = kwargs.get('static_acls', None) + self.luns = kwargs.get('luns', None) + + +class IscsiTargetList(msrest.serialization.Model): + """List of iSCSI Targets. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. An array of iSCSI Targets in a Disk Pool. + :type value: list[~storage_pool_management.models.IscsiTarget] + :ivar next_link: URI to fetch the next section of the paginated response. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[IscsiTarget]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IscsiTargetList, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class IscsiTargetUpdate(ProxyResource): + """Payload for iSCSI Target update requests. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param static_acls: Access Control List (ACL) for an iSCSI Target; defines LUN masking policy. + :type static_acls: list[~storage_pool_management.models.Acl] + :param luns: List of LUNs to be exposed through iSCSI Target. + :type luns: list[~storage_pool_management.models.IscsiLun] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'static_acls': {'key': 'properties.staticAcls', 'type': '[Acl]'}, + 'luns': {'key': 'properties.luns', 'type': '[IscsiLun]'}, + } + + def __init__( + self, + **kwargs + ): + super(IscsiTargetUpdate, self).__init__(**kwargs) + self.static_acls = kwargs.get('static_acls', None) + self.luns = kwargs.get('luns', None) + + +class OutboundEnvironmentEndpoint(msrest.serialization.Model): + """Endpoints accessed for a common purpose that the App Service Environment requires outbound network access to. + + :param category: The type of service accessed by the App Service Environment, e.g., Azure + Storage, Azure SQL Database, and Azure Active Directory. + :type category: str + :param endpoints: The endpoints that the App Service Environment reaches the service at. + :type endpoints: list[~storage_pool_management.models.EndpointDependency] + """ + + _attribute_map = { + 'category': {'key': 'category', 'type': 'str'}, + 'endpoints': {'key': 'endpoints', 'type': '[EndpointDependency]'}, + } + + def __init__( + self, + **kwargs + ): + super(OutboundEnvironmentEndpoint, self).__init__(**kwargs) + self.category = kwargs.get('category', None) + self.endpoints = kwargs.get('endpoints', None) + + +class OutboundEnvironmentEndpointList(msrest.serialization.Model): + """Collection of Outbound Environment Endpoints. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~storage_pool_management.models.OutboundEnvironmentEndpoint] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OutboundEnvironmentEndpoint]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OutboundEnvironmentEndpointList, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class Sku(msrest.serialization.Model): + """Sku for ARM resource. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Sku name. + :type name: str + :param tier: Sku tier. + :type tier: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.name = kwargs['name'] + self.tier = kwargs.get('tier', None) + + +class StoragePoolOperationDisplay(msrest.serialization.Model): + """Metadata about an operation. + + All required parameters must be populated in order to send to Azure. + + :param provider: Required. Localized friendly form of the resource provider name. + :type provider: str + :param resource: Required. Localized friendly form of the resource type related to this + action/operation. + :type resource: str + :param operation: Required. Localized friendly name for the operation, as it should be shown to + the user. + :type operation: str + :param description: Required. Localized friendly description for the operation, as it should be + shown to the user. + :type description: str + """ + + _validation = { + 'provider': {'required': True}, + 'resource': {'required': True}, + 'operation': {'required': True}, + 'description': {'required': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(StoragePoolOperationDisplay, self).__init__(**kwargs) + self.provider = kwargs['provider'] + self.resource = kwargs['resource'] + self.operation = kwargs['operation'] + self.description = kwargs['description'] + + +class StoragePoolOperationListResult(msrest.serialization.Model): + """List of operations supported by the RP. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. An array of operations supported by the StoragePool RP. + :type value: list[~storage_pool_management.models.StoragePoolRPOperation] + :param next_link: URI to fetch the next section of the paginated response. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[StoragePoolRPOperation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(StoragePoolOperationListResult, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = kwargs.get('next_link', None) + + +class StoragePoolRPOperation(msrest.serialization.Model): + """Description of a StoragePool RP Operation. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the operation being performed on this particular object. + :type name: str + :param is_data_action: Required. Indicates whether the operation applies to data-plane. + :type is_data_action: bool + :param action_type: Indicates the action type. + :type action_type: str + :param display: Required. Additional metadata about RP operation. + :type display: ~storage_pool_management.models.StoragePoolOperationDisplay + :param origin: The intended executor of the operation; governs the display of the operation in + the RBAC UX and the audit logs UX. + :type origin: str + """ + + _validation = { + 'name': {'required': True}, + 'is_data_action': {'required': True}, + 'display': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'StoragePoolOperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(StoragePoolRPOperation, self).__init__(**kwargs) + self.name = kwargs['name'] + self.is_data_action = kwargs['is_data_action'] + self.action_type = kwargs.get('action_type', None) + self.display = kwargs['display'] + self.origin = kwargs.get('origin', None) + + +class SystemMetadata(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~storage_pool_management.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~storage_pool_management.models.CreatedByType + :param last_modified_at: The type of identity that last modified the resource. + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(SystemMetadata, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) diff --git a/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/models/_models_py3.py b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/models/_models_py3.py new file mode 100644 index 000000000000..687d0d401a3b --- /dev/null +++ b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/models/_models_py3.py @@ -0,0 +1,1182 @@ +# 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 datetime +from typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._storage_pool_management_enums import * + + +class Acl(msrest.serialization.Model): + """Access Control List (ACL) for an iSCSI Target; defines LUN masking policy. + + All required parameters must be populated in order to send to Azure. + + :param initiator_iqn: Required. iSCSI initiator IQN (iSCSI Qualified Name); example: + "iqn.2005-03.org.iscsi:client". + :type initiator_iqn: str + :param mapped_luns: Required. List of LUN names mapped to the ACL. + :type mapped_luns: list[str] + """ + + _validation = { + 'initiator_iqn': {'required': True}, + 'mapped_luns': {'required': True}, + } + + _attribute_map = { + 'initiator_iqn': {'key': 'initiatorIqn', 'type': 'str'}, + 'mapped_luns': {'key': 'mappedLuns', 'type': '[str]'}, + } + + def __init__( + self, + *, + initiator_iqn: str, + mapped_luns: List[str], + **kwargs + ): + super(Acl, self).__init__(**kwargs) + self.initiator_iqn = initiator_iqn + self.mapped_luns = mapped_luns + + +class Disk(msrest.serialization.Model): + """Azure Managed Disk to attach to the Disk Pool. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique Azure Resource ID of the Managed Disk. + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: str, + **kwargs + ): + super(Disk, self).__init__(**kwargs) + self.id = id + + +class Resource(msrest.serialization.Model): + """ARM resource model definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class TrackedResource(Resource): + """The resource model definition for a ARM tracked top level resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.tags = tags + self.location = location + + +class DiskPool(TrackedResource): + """Response for Disk Pool request. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + :ivar system_data: Resource metadata required by ARM RPC. + :vartype system_data: ~storage_pool_management.models.SystemMetadata + :ivar provisioning_state: Required. State of the operation on the resource. Possible values + include: "Invalid", "Succeeded", "Failed", "Canceled", "Pending", "Creating", "Updating", + "Deleting". + :vartype provisioning_state: str or ~storage_pool_management.models.ProvisioningStates + :param availability_zones: Required. Logical zone for Disk Pool resource; example: ["1"]. + :type availability_zones: list[str] + :param status: Required. Operational status of the Disk Pool. Possible values include: + "Invalid", "Unknown", "Healthy", "Unhealthy", "Updating", "Running", "Stopped", "Stopped + (deallocated)". + :type status: str or ~storage_pool_management.models.OperationalStatus + :param disks: List of Azure Managed Disks to attach to a Disk Pool. + :type disks: list[~storage_pool_management.models.Disk] + :param subnet_id: Required. Azure Resource ID of a Subnet for the Disk Pool. + :type subnet_id: str + :param additional_capabilities: List of additional capabilities for Disk Pool. + :type additional_capabilities: list[str] + :param name_sku_name: Sku name. + :type name_sku_name: str + :param tier: Sku tier. + :type tier: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'required': True, 'readonly': True}, + 'availability_zones': {'required': True}, + 'status': {'required': True}, + 'subnet_id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemMetadata'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'disks': {'key': 'properties.disks', 'type': '[Disk]'}, + 'subnet_id': {'key': 'properties.subnetId', 'type': 'str'}, + 'additional_capabilities': {'key': 'properties.additionalCapabilities', 'type': '[str]'}, + 'name_sku_name': {'key': 'sku.name', 'type': 'str'}, + 'tier': {'key': 'sku.tier', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + availability_zones: List[str], + status: Union[str, "OperationalStatus"], + subnet_id: str, + tags: Optional[Dict[str, str]] = None, + disks: Optional[List["Disk"]] = None, + additional_capabilities: Optional[List[str]] = None, + name_sku_name: Optional[str] = None, + tier: Optional[str] = None, + **kwargs + ): + super(DiskPool, self).__init__(tags=tags, location=location, **kwargs) + self.system_data = None + self.provisioning_state = None + self.availability_zones = availability_zones + self.status = status + self.disks = disks + self.subnet_id = subnet_id + self.additional_capabilities = additional_capabilities + self.name_sku_name = name_sku_name + self.tier = tier + + +class DiskPoolCreate(msrest.serialization.Model): + """Request payload for create or update Disk Pool request. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param sku: Required. Determines the SKU of the Disk Pool. + :type sku: ~storage_pool_management.models.Sku + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param availability_zones: Logical zone for Disk Pool resource; example: ["1"]. + :type availability_zones: list[str] + :param disks: List of Azure Managed Disks to attach to a Disk Pool. + :type disks: list[~storage_pool_management.models.Disk] + :param subnet_id: Required. Azure Resource ID of a Subnet for the Disk Pool. + :type subnet_id: str + :param additional_capabilities: List of additional capabilities for a Disk Pool. + :type additional_capabilities: list[str] + """ + + _validation = { + 'sku': {'required': True}, + 'location': {'required': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'subnet_id': {'required': True}, + } + + _attribute_map = { + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, + 'disks': {'key': 'properties.disks', 'type': '[Disk]'}, + 'subnet_id': {'key': 'properties.subnetId', 'type': 'str'}, + 'additional_capabilities': {'key': 'properties.additionalCapabilities', 'type': '[str]'}, + } + + def __init__( + self, + *, + sku: "Sku", + location: str, + subnet_id: str, + tags: Optional[Dict[str, str]] = None, + availability_zones: Optional[List[str]] = None, + disks: Optional[List["Disk"]] = None, + additional_capabilities: Optional[List[str]] = None, + **kwargs + ): + super(DiskPoolCreate, self).__init__(**kwargs) + self.sku = sku + self.tags = tags + self.location = location + self.id = None + self.name = None + self.type = None + self.availability_zones = availability_zones + self.disks = disks + self.subnet_id = subnet_id + self.additional_capabilities = additional_capabilities + + +class DiskPoolListResult(msrest.serialization.Model): + """List of Disk Pools. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. An array of Disk pool objects. + :type value: list[~storage_pool_management.models.DiskPool] + :ivar next_link: URI to fetch the next section of the paginated response. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DiskPool]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["DiskPool"], + **kwargs + ): + super(DiskPoolListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class DiskPoolUpdate(msrest.serialization.Model): + """Request payload for Update Disk Pool request. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param disks: List of Azure Managed Disks to attach to a Disk Pool. + :type disks: list[~storage_pool_management.models.Disk] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'disks': {'key': 'properties.disks', 'type': '[Disk]'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + disks: Optional[List["Disk"]] = None, + **kwargs + ): + super(DiskPoolUpdate, self).__init__(**kwargs) + self.tags = tags + self.disks = disks + + +class DiskPoolZoneInfo(msrest.serialization.Model): + """Disk Pool Sku Details. + + :param availability_zones: Logical zone for Disk Pool resource; example: ["1"]. + :type availability_zones: list[str] + :param additional_capabilities: List of additional capabilities for Disk Pool. + :type additional_capabilities: list[str] + :param sku: Determines the SKU of VM deployed for Disk Pool. + :type sku: ~storage_pool_management.models.Sku + """ + + _attribute_map = { + 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, + 'additional_capabilities': {'key': 'additionalCapabilities', 'type': '[str]'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + } + + def __init__( + self, + *, + availability_zones: Optional[List[str]] = None, + additional_capabilities: Optional[List[str]] = None, + sku: Optional["Sku"] = None, + **kwargs + ): + super(DiskPoolZoneInfo, self).__init__(**kwargs) + self.availability_zones = availability_zones + self.additional_capabilities = additional_capabilities + self.sku = sku + + +class DiskPoolZoneListResult(msrest.serialization.Model): + """List Disk Pool skus operation response. + + :param value: The list of Disk Pool Skus. + :type value: list[~storage_pool_management.models.DiskPoolZoneInfo] + :param next_link: URI to fetch the next section of the paginated response. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DiskPoolZoneInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["DiskPoolZoneInfo"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(DiskPoolZoneListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class EndpointDependency(msrest.serialization.Model): + """A domain name that a service is reached at, including details of the current connection status. + + :param domain_name: The domain name of the dependency. + :type domain_name: str + :param endpoint_details: The IP Addresses and Ports used when connecting to DomainName. + :type endpoint_details: list[~storage_pool_management.models.EndpointDetail] + """ + + _attribute_map = { + 'domain_name': {'key': 'domainName', 'type': 'str'}, + 'endpoint_details': {'key': 'endpointDetails', 'type': '[EndpointDetail]'}, + } + + def __init__( + self, + *, + domain_name: Optional[str] = None, + endpoint_details: Optional[List["EndpointDetail"]] = None, + **kwargs + ): + super(EndpointDependency, self).__init__(**kwargs) + self.domain_name = domain_name + self.endpoint_details = endpoint_details + + +class EndpointDetail(msrest.serialization.Model): + """Current TCP connectivity information from the App Service Environment to a single endpoint. + + :param ip_address: An IP Address that Domain Name currently resolves to. + :type ip_address: str + :param port: The port an endpoint is connected to. + :type port: int + :param latency: The time in milliseconds it takes for a TCP connection to be created from the + App Service Environment to this IpAddress at this Port. + :type latency: float + :param is_accessible: Whether it is possible to create a TCP connection from the App Service + Environment to this IpAddress at this Port. + :type is_accessible: bool + """ + + _attribute_map = { + 'ip_address': {'key': 'ipAddress', 'type': 'str'}, + 'port': {'key': 'port', 'type': 'int'}, + 'latency': {'key': 'latency', 'type': 'float'}, + 'is_accessible': {'key': 'isAccessible', 'type': 'bool'}, + } + + def __init__( + self, + *, + ip_address: Optional[str] = None, + port: Optional[int] = None, + latency: Optional[float] = None, + is_accessible: Optional[bool] = None, + **kwargs + ): + super(EndpointDetail, self).__init__(**kwargs) + self.ip_address = ip_address + self.port = port + self.latency = latency + self.is_accessible = is_accessible + + +class Error(msrest.serialization.Model): + """The resource management error response. + + :param error: RP error response. + :type error: ~storage_pool_management.models.ErrorResponse + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__( + self, + *, + error: Optional["ErrorResponse"] = None, + **kwargs + ): + super(Error, self).__init__(**kwargs) + self.error = error + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: str + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorResponse(msrest.serialization.Model): + """The resource management error response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~storage_pool_management.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~storage_pool_management.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class IscsiLun(msrest.serialization.Model): + """LUN to expose the Azure Managed Disk. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. User defined name for iSCSI LUN; example: "lun0". + :type name: str + :param managed_disk_azure_resource_id: Required. Azure Resource ID of the Managed Disk. + :type managed_disk_azure_resource_id: str + """ + + _validation = { + 'name': {'required': True}, + 'managed_disk_azure_resource_id': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'managed_disk_azure_resource_id': {'key': 'managedDiskAzureResourceId', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + managed_disk_azure_resource_id: str, + **kwargs + ): + super(IscsiLun, self).__init__(**kwargs) + self.name = name + self.managed_disk_azure_resource_id = managed_disk_azure_resource_id + + +class ProxyResource(Resource): + """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProxyResource, self).__init__(**kwargs) + + +class IscsiTarget(ProxyResource): + """Response for iSCSI Target requests. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :ivar system_data: Resource metadata required by ARM RPC. + :vartype system_data: ~storage_pool_management.models.SystemMetadata + :param acl_mode: Required. Mode for Target connectivity. Possible values include: "Dynamic", + "Static". + :type acl_mode: str or ~storage_pool_management.models.IscsiTargetAclMode + :param static_acls: Access Control List (ACL) for an iSCSI Target; defines LUN masking policy. + :type static_acls: list[~storage_pool_management.models.Acl] + :param luns: List of LUNs to be exposed through iSCSI Target. + :type luns: list[~storage_pool_management.models.IscsiLun] + :param target_iqn: Required. iSCSI Target IQN (iSCSI Qualified Name); example: + "iqn.2005-03.org.iscsi:server". + :type target_iqn: str + :ivar provisioning_state: Required. State of the operation on the resource. Possible values + include: "Invalid", "Succeeded", "Failed", "Canceled", "Pending", "Creating", "Updating", + "Deleting". + :vartype provisioning_state: str or ~storage_pool_management.models.ProvisioningStates + :param status: Required. Operational status of the iSCSI Target. Possible values include: + "Invalid", "Unknown", "Healthy", "Unhealthy", "Updating", "Running", "Stopped", "Stopped + (deallocated)". + :type status: str or ~storage_pool_management.models.OperationalStatus + :param endpoints: List of private IPv4 addresses to connect to the iSCSI Target. + :type endpoints: list[str] + :param port: The port used by iSCSI Target portal group. + :type port: int + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'acl_mode': {'required': True}, + 'target_iqn': {'required': True}, + 'provisioning_state': {'required': True, 'readonly': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemMetadata'}, + 'acl_mode': {'key': 'properties.aclMode', 'type': 'str'}, + 'static_acls': {'key': 'properties.staticAcls', 'type': '[Acl]'}, + 'luns': {'key': 'properties.luns', 'type': '[IscsiLun]'}, + 'target_iqn': {'key': 'properties.targetIqn', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'endpoints': {'key': 'properties.endpoints', 'type': '[str]'}, + 'port': {'key': 'properties.port', 'type': 'int'}, + } + + def __init__( + self, + *, + acl_mode: Union[str, "IscsiTargetAclMode"], + target_iqn: str, + status: Union[str, "OperationalStatus"], + static_acls: Optional[List["Acl"]] = None, + luns: Optional[List["IscsiLun"]] = None, + endpoints: Optional[List[str]] = None, + port: Optional[int] = None, + **kwargs + ): + super(IscsiTarget, self).__init__(**kwargs) + self.system_data = None + self.acl_mode = acl_mode + self.static_acls = static_acls + self.luns = luns + self.target_iqn = target_iqn + self.provisioning_state = None + self.status = status + self.endpoints = endpoints + self.port = port + + +class IscsiTargetCreate(ProxyResource): + """Payload for iSCSI Target create or update requests. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param acl_mode: Required. Mode for Target connectivity. Possible values include: "Dynamic", + "Static". + :type acl_mode: str or ~storage_pool_management.models.IscsiTargetAclMode + :param target_iqn: iSCSI Target IQN (iSCSI Qualified Name); example: + "iqn.2005-03.org.iscsi:server". + :type target_iqn: str + :param static_acls: Access Control List (ACL) for an iSCSI Target; defines LUN masking policy. + :type static_acls: list[~storage_pool_management.models.Acl] + :param luns: List of LUNs to be exposed through iSCSI Target. + :type luns: list[~storage_pool_management.models.IscsiLun] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'acl_mode': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'acl_mode': {'key': 'properties.aclMode', 'type': 'str'}, + 'target_iqn': {'key': 'properties.targetIqn', 'type': 'str'}, + 'static_acls': {'key': 'properties.staticAcls', 'type': '[Acl]'}, + 'luns': {'key': 'properties.luns', 'type': '[IscsiLun]'}, + } + + def __init__( + self, + *, + acl_mode: Union[str, "IscsiTargetAclMode"], + target_iqn: Optional[str] = None, + static_acls: Optional[List["Acl"]] = None, + luns: Optional[List["IscsiLun"]] = None, + **kwargs + ): + super(IscsiTargetCreate, self).__init__(**kwargs) + self.acl_mode = acl_mode + self.target_iqn = target_iqn + self.static_acls = static_acls + self.luns = luns + + +class IscsiTargetList(msrest.serialization.Model): + """List of iSCSI Targets. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. An array of iSCSI Targets in a Disk Pool. + :type value: list[~storage_pool_management.models.IscsiTarget] + :ivar next_link: URI to fetch the next section of the paginated response. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[IscsiTarget]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["IscsiTarget"], + **kwargs + ): + super(IscsiTargetList, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class IscsiTargetUpdate(ProxyResource): + """Payload for iSCSI Target update requests. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param static_acls: Access Control List (ACL) for an iSCSI Target; defines LUN masking policy. + :type static_acls: list[~storage_pool_management.models.Acl] + :param luns: List of LUNs to be exposed through iSCSI Target. + :type luns: list[~storage_pool_management.models.IscsiLun] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'static_acls': {'key': 'properties.staticAcls', 'type': '[Acl]'}, + 'luns': {'key': 'properties.luns', 'type': '[IscsiLun]'}, + } + + def __init__( + self, + *, + static_acls: Optional[List["Acl"]] = None, + luns: Optional[List["IscsiLun"]] = None, + **kwargs + ): + super(IscsiTargetUpdate, self).__init__(**kwargs) + self.static_acls = static_acls + self.luns = luns + + +class OutboundEnvironmentEndpoint(msrest.serialization.Model): + """Endpoints accessed for a common purpose that the App Service Environment requires outbound network access to. + + :param category: The type of service accessed by the App Service Environment, e.g., Azure + Storage, Azure SQL Database, and Azure Active Directory. + :type category: str + :param endpoints: The endpoints that the App Service Environment reaches the service at. + :type endpoints: list[~storage_pool_management.models.EndpointDependency] + """ + + _attribute_map = { + 'category': {'key': 'category', 'type': 'str'}, + 'endpoints': {'key': 'endpoints', 'type': '[EndpointDependency]'}, + } + + def __init__( + self, + *, + category: Optional[str] = None, + endpoints: Optional[List["EndpointDependency"]] = None, + **kwargs + ): + super(OutboundEnvironmentEndpoint, self).__init__(**kwargs) + self.category = category + self.endpoints = endpoints + + +class OutboundEnvironmentEndpointList(msrest.serialization.Model): + """Collection of Outbound Environment Endpoints. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. Collection of resources. + :type value: list[~storage_pool_management.models.OutboundEnvironmentEndpoint] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OutboundEnvironmentEndpoint]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["OutboundEnvironmentEndpoint"], + **kwargs + ): + super(OutboundEnvironmentEndpointList, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class Sku(msrest.serialization.Model): + """Sku for ARM resource. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Sku name. + :type name: str + :param tier: Sku tier. + :type tier: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + tier: Optional[str] = None, + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.name = name + self.tier = tier + + +class StoragePoolOperationDisplay(msrest.serialization.Model): + """Metadata about an operation. + + All required parameters must be populated in order to send to Azure. + + :param provider: Required. Localized friendly form of the resource provider name. + :type provider: str + :param resource: Required. Localized friendly form of the resource type related to this + action/operation. + :type resource: str + :param operation: Required. Localized friendly name for the operation, as it should be shown to + the user. + :type operation: str + :param description: Required. Localized friendly description for the operation, as it should be + shown to the user. + :type description: str + """ + + _validation = { + 'provider': {'required': True}, + 'resource': {'required': True}, + 'operation': {'required': True}, + 'description': {'required': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + provider: str, + resource: str, + operation: str, + description: str, + **kwargs + ): + super(StoragePoolOperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class StoragePoolOperationListResult(msrest.serialization.Model): + """List of operations supported by the RP. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. An array of operations supported by the StoragePool RP. + :type value: list[~storage_pool_management.models.StoragePoolRPOperation] + :param next_link: URI to fetch the next section of the paginated response. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[StoragePoolRPOperation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["StoragePoolRPOperation"], + next_link: Optional[str] = None, + **kwargs + ): + super(StoragePoolOperationListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class StoragePoolRPOperation(msrest.serialization.Model): + """Description of a StoragePool RP Operation. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the operation being performed on this particular object. + :type name: str + :param is_data_action: Required. Indicates whether the operation applies to data-plane. + :type is_data_action: bool + :param action_type: Indicates the action type. + :type action_type: str + :param display: Required. Additional metadata about RP operation. + :type display: ~storage_pool_management.models.StoragePoolOperationDisplay + :param origin: The intended executor of the operation; governs the display of the operation in + the RBAC UX and the audit logs UX. + :type origin: str + """ + + _validation = { + 'name': {'required': True}, + 'is_data_action': {'required': True}, + 'display': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'StoragePoolOperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + is_data_action: bool, + display: "StoragePoolOperationDisplay", + action_type: Optional[str] = None, + origin: Optional[str] = None, + **kwargs + ): + super(StoragePoolRPOperation, self).__init__(**kwargs) + self.name = name + self.is_data_action = is_data_action + self.action_type = action_type + self.display = display + self.origin = origin + + +class SystemMetadata(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~storage_pool_management.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~storage_pool_management.models.CreatedByType + :param last_modified_at: The type of identity that last modified the resource. + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + super(SystemMetadata, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at diff --git a/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/models/_storage_pool_management_enums.py b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/models/_storage_pool_management_enums.py new file mode 100644 index 000000000000..e0d37e8e0c09 --- /dev/null +++ b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/models/_storage_pool_management_enums.py @@ -0,0 +1,77 @@ +# 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 enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class DiskPoolTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """SKU of the VM host part of the Disk Pool deployment + """ + + BASIC = "Basic" + STANDARD = "Standard" + PREMIUM = "Premium" + +class IscsiTargetAclMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """ACL mode for iSCSI Target. + """ + + DYNAMIC = "Dynamic" + STATIC = "Static" + +class OperationalStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Operational status of the resource. + """ + + INVALID = "Invalid" + UNKNOWN = "Unknown" + HEALTHY = "Healthy" + UNHEALTHY = "Unhealthy" + UPDATING = "Updating" + RUNNING = "Running" + STOPPED = "Stopped" + STOPPED_DEALLOCATED_ = "Stopped (deallocated)" + +class ProvisioningStates(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the iSCSI Target. + """ + + INVALID = "Invalid" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + PENDING = "Pending" + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" diff --git a/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/operations/__init__.py b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/operations/__init__.py new file mode 100644 index 000000000000..1620075f15e8 --- /dev/null +++ b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/operations/__init__.py @@ -0,0 +1,19 @@ +# 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 ._operations import Operations +from ._disk_pools_operations import DiskPoolsOperations +from ._disk_pool_zones_operations import DiskPoolZonesOperations +from ._iscsi_targets_operations import IscsiTargetsOperations + +__all__ = [ + 'Operations', + 'DiskPoolsOperations', + 'DiskPoolZonesOperations', + 'IscsiTargetsOperations', +] diff --git a/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/operations/_disk_pool_zones_operations.py b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/operations/_disk_pool_zones_operations.py new file mode 100644 index 000000000000..5fe18b0f3bc1 --- /dev/null +++ b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/operations/_disk_pool_zones_operations.py @@ -0,0 +1,118 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class DiskPoolZonesOperations(object): + """DiskPoolZonesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~storage_pool_management.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + location, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DiskPoolZoneListResult"] + """Lists available Disk Pool Skus in an Azure location. + + :param location: The location of the resource. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiskPoolZoneListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~storage_pool_management.models.DiskPoolZoneListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskPoolZoneListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'location': self._serialize.url("location", location, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DiskPoolZoneListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.Error, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StoragePool/locations/{location}/diskPoolZones'} # type: ignore diff --git a/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/operations/_disk_pools_operations.py b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/operations/_disk_pools_operations.py new file mode 100644 index 000000000000..d0f5c4905898 --- /dev/null +++ b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/operations/_disk_pools_operations.py @@ -0,0 +1,918 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class DiskPoolsOperations(object): + """DiskPoolsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~storage_pool_management.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DiskPoolListResult"] + """Gets a list of Disk Pools in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiskPoolListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~storage_pool_management.models.DiskPoolListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskPoolListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DiskPoolListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.Error, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StoragePool/diskPools'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DiskPoolListResult"] + """Gets a list of DiskPools in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiskPoolListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~storage_pool_management.models.DiskPoolListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskPoolListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DiskPoolListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.Error, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + disk_pool_name, # type: str + disk_pool_create_payload, # type: "_models.DiskPoolCreate" + **kwargs # type: Any + ): + # type: (...) -> "_models.DiskPool" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskPool"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(disk_pool_create_payload, 'DiskPoolCreate') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DiskPool', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DiskPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + disk_pool_name, # type: str + disk_pool_create_payload, # type: "_models.DiskPoolCreate" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DiskPool"] + """Create or Update Disk pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param disk_pool_name: The name of the Disk Pool. + :type disk_pool_name: str + :param disk_pool_create_payload: Request payload for Disk Pool create operation. + :type disk_pool_create_payload: ~storage_pool_management.models.DiskPoolCreate + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 DiskPool or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~storage_pool_management.models.DiskPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskPool"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + disk_pool_name=disk_pool_name, + disk_pool_create_payload=disk_pool_create_payload, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DiskPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + disk_pool_name, # type: str + disk_pool_update_payload, # type: "_models.DiskPoolUpdate" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.DiskPool"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DiskPool"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(disk_pool_update_payload, 'DiskPoolUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DiskPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + disk_pool_name, # type: str + disk_pool_update_payload, # type: "_models.DiskPoolUpdate" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DiskPool"] + """Update a Disk pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param disk_pool_name: The name of the Disk Pool. + :type disk_pool_name: str + :param disk_pool_update_payload: Request payload for Disk Pool update operation. + :type disk_pool_update_payload: ~storage_pool_management.models.DiskPoolUpdate + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 DiskPool or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~storage_pool_management.models.DiskPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskPool"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + disk_pool_name=disk_pool_name, + disk_pool_update_payload=disk_pool_update_payload, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DiskPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + disk_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + disk_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Delete a Disk pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param disk_pool_name: The name of the Disk Pool. + :type disk_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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + disk_pool_name=disk_pool_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + disk_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DiskPool" + """Get a Disk pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param disk_pool_name: The name of the Disk Pool. + :type disk_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiskPool, or the result of cls(response) + :rtype: ~storage_pool_management.models.DiskPool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskPool"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiskPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}'} # type: ignore + + def list_outbound_network_dependencies_endpoints( + self, + resource_group_name, # type: str + disk_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.OutboundEnvironmentEndpointList"] + """Gets the network endpoints of all outbound dependencies of a Disk Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param disk_pool_name: The name of the Disk Pool. + :type disk_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OutboundEnvironmentEndpointList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~storage_pool_management.models.OutboundEnvironmentEndpointList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_outbound_network_dependencies_endpoints.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OutboundEnvironmentEndpointList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.Error, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_outbound_network_dependencies_endpoints.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}/outboundNetworkDependenciesEndpoints'} # type: ignore + + def _start_initial( + self, + resource_group_name, # type: str + disk_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + # Construct URL + url = self._start_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}/start'} # type: ignore + + def begin_start( + self, + resource_group_name, # type: str + disk_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """The operation to start a Disk Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param disk_pool_name: The name of the Disk Pool. + :type disk_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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._start_initial( + resource_group_name=resource_group_name, + disk_pool_name=disk_pool_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}/start'} # type: ignore + + def _deallocate_initial( + self, + resource_group_name, # type: str + disk_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + # Construct URL + url = self._deallocate_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}/deallocate'} # type: ignore + + def begin_deallocate( + self, + resource_group_name, # type: str + disk_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Shuts down the Disk Pool and releases the compute resources. You are not billed for the compute + resources that this Disk Pool uses. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param disk_pool_name: The name of the Disk Pool. + :type disk_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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._deallocate_initial( + resource_group_name=resource_group_name, + disk_pool_name=disk_pool_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_deallocate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}/deallocate'} # type: ignore diff --git a/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/operations/_iscsi_targets_operations.py b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/operations/_iscsi_targets_operations.py new file mode 100644 index 000000000000..c6eede43096f --- /dev/null +++ b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/operations/_iscsi_targets_operations.py @@ -0,0 +1,580 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class IscsiTargetsOperations(object): + """IscsiTargetsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~storage_pool_management.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_disk_pool( + self, + resource_group_name, # type: str + disk_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.IscsiTargetList"] + """Get iSCSI Targets in a Disk pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param disk_pool_name: The name of the Disk Pool. + :type disk_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IscsiTargetList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~storage_pool_management.models.IscsiTargetList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IscsiTargetList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_disk_pool.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('IscsiTargetList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.Error, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_disk_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}/iscsiTargets'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + disk_pool_name, # type: str + iscsi_target_name, # type: str + iscsi_target_create_payload, # type: "_models.IscsiTargetCreate" + **kwargs # type: Any + ): + # type: (...) -> "_models.IscsiTarget" + cls = kwargs.pop('cls', None) # type: ClsType["_models.IscsiTarget"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + 'iscsiTargetName': self._serialize.url("iscsi_target_name", iscsi_target_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(iscsi_target_create_payload, 'IscsiTargetCreate') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('IscsiTarget', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('IscsiTarget', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}/iscsiTargets/{iscsiTargetName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + disk_pool_name, # type: str + iscsi_target_name, # type: str + iscsi_target_create_payload, # type: "_models.IscsiTargetCreate" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.IscsiTarget"] + """Create or Update an iSCSI Target. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param disk_pool_name: The name of the Disk Pool. + :type disk_pool_name: str + :param iscsi_target_name: The name of the iSCSI Target. + :type iscsi_target_name: str + :param iscsi_target_create_payload: Request payload for iSCSI Target create operation. + :type iscsi_target_create_payload: ~storage_pool_management.models.IscsiTargetCreate + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 IscsiTarget or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~storage_pool_management.models.IscsiTarget] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IscsiTarget"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + disk_pool_name=disk_pool_name, + iscsi_target_name=iscsi_target_name, + iscsi_target_create_payload=iscsi_target_create_payload, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('IscsiTarget', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + 'iscsiTargetName': self._serialize.url("iscsi_target_name", iscsi_target_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}/iscsiTargets/{iscsiTargetName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + disk_pool_name, # type: str + iscsi_target_name, # type: str + iscsi_target_update_payload, # type: "_models.IscsiTargetUpdate" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.IscsiTarget"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.IscsiTarget"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + 'iscsiTargetName': self._serialize.url("iscsi_target_name", iscsi_target_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(iscsi_target_update_payload, 'IscsiTargetUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('IscsiTarget', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}/iscsiTargets/{iscsiTargetName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + disk_pool_name, # type: str + iscsi_target_name, # type: str + iscsi_target_update_payload, # type: "_models.IscsiTargetUpdate" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.IscsiTarget"] + """Update an iSCSI Target. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param disk_pool_name: The name of the Disk Pool. + :type disk_pool_name: str + :param iscsi_target_name: The name of the iSCSI Target. + :type iscsi_target_name: str + :param iscsi_target_update_payload: Request payload for iSCSI Target update operation. + :type iscsi_target_update_payload: ~storage_pool_management.models.IscsiTargetUpdate + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 IscsiTarget or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~storage_pool_management.models.IscsiTarget] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IscsiTarget"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + disk_pool_name=disk_pool_name, + iscsi_target_name=iscsi_target_name, + iscsi_target_update_payload=iscsi_target_update_payload, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('IscsiTarget', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + 'iscsiTargetName': self._serialize.url("iscsi_target_name", iscsi_target_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}/iscsiTargets/{iscsiTargetName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + disk_pool_name, # type: str + iscsi_target_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + 'iscsiTargetName': self._serialize.url("iscsi_target_name", iscsi_target_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}/iscsiTargets/{iscsiTargetName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + disk_pool_name, # type: str + iscsi_target_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Delete an iSCSI Target. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param disk_pool_name: The name of the Disk Pool. + :type disk_pool_name: str + :param iscsi_target_name: The name of the iSCSI Target. + :type iscsi_target_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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + disk_pool_name=disk_pool_name, + iscsi_target_name=iscsi_target_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + 'iscsiTargetName': self._serialize.url("iscsi_target_name", iscsi_target_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}/iscsiTargets/{iscsiTargetName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + disk_pool_name, # type: str + iscsi_target_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.IscsiTarget" + """Get an iSCSI Target. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param disk_pool_name: The name of the Disk Pool. + :type disk_pool_name: str + :param iscsi_target_name: The name of the iSCSI Target. + :type iscsi_target_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IscsiTarget, or the result of cls(response) + :rtype: ~storage_pool_management.models.IscsiTarget + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IscsiTarget"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]*[0-9A-Za-z]$'), + 'diskPoolName': self._serialize.url("disk_pool_name", disk_pool_name, 'str'), + 'iscsiTargetName': self._serialize.url("iscsi_target_name", iscsi_target_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IscsiTarget', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}/iscsiTargets/{iscsiTargetName}'} # type: ignore diff --git a/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/operations/_operations.py b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/operations/_operations.py new file mode 100644 index 000000000000..1d6fed7ae229 --- /dev/null +++ b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/operations/_operations.py @@ -0,0 +1,110 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class Operations(object): + """Operations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~storage_pool_management.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.StoragePoolOperationListResult"] + """Gets a list of StoragePool operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StoragePoolOperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~storage_pool_management.models.StoragePoolOperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StoragePoolOperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('StoragePoolOperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.Error, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.StoragePool/operations'} # type: ignore diff --git a/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/py.typed b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/storagepool/azure-mgmt-storagepool/azure/mgmt/storagepool/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/storagepool/azure-mgmt-storagepool/sdk_packaging.toml b/sdk/storagepool/azure-mgmt-storagepool/sdk_packaging.toml new file mode 100644 index 000000000000..eaa33c987a74 --- /dev/null +++ b/sdk/storagepool/azure-mgmt-storagepool/sdk_packaging.toml @@ -0,0 +1,9 @@ +[packaging] +package_name = "azure-mgmt-storagepool" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true diff --git a/sdk/storagepool/azure-mgmt-storagepool/setup.cfg b/sdk/storagepool/azure-mgmt-storagepool/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/storagepool/azure-mgmt-storagepool/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/storagepool/azure-mgmt-storagepool/setup.py b/sdk/storagepool/azure-mgmt-storagepool/setup.py new file mode 100644 index 000000000000..3a576a12f822 --- /dev/null +++ b/sdk/storagepool/azure-mgmt-storagepool/setup.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-storagepool" +PACKAGE_PPRINT_NAME = "MyService Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# azure v0.x is not compatible with this package +# azure v0.x used to have a __version__ attribute (newer versions don't) +try: + import azure + try: + ver = azure.__version__ + raise Exception( + 'This package is incompatible with azure=={}. '.format(ver) + + 'Uninstall it with "pip uninstall azure".' + ) + except AttributeError: + pass +except ImportError: + pass + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +with open('README.md', encoding='utf-8') as f: + readme = f.read() +with open('CHANGELOG.md', encoding='utf-8') as f: + changelog = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + '\n\n' + changelog, + long_description_content_type='text/markdown', + license='MIT License', + author='Microsoft Corporation', + author_email='azpysdkhelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python', + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.mgmt', + ]), + install_requires=[ + 'msrest>=0.6.21', + 'azure-common~=1.1', + 'azure-mgmt-core>=1.2.0,<2.0.0', + ], + extras_require={ + ":python_version<'3.0'": ['azure-mgmt-nspkg'], + } +) diff --git a/sdk/storagepool/ci.yml b/sdk/storagepool/ci.yml new file mode 100644 index 000000000000..33799365363f --- /dev/null +++ b/sdk/storagepool/ci.yml @@ -0,0 +1,35 @@ +# DO NOT EDIT THIS FILE +# This file is generated automatically and any changes will be lost. + +trigger: + branches: + include: + - master + - main + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/storagepool/ + +pr: + branches: + include: + - master + - main + - feature/* + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/storagepool/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: storagepool + Artifacts: + - name: azure-mgmt-storagepool + safeName: azuremgmtstoragepool