diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/__init__.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/__init__.py deleted file mode 100644 index 2768cf132e10..000000000000 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/__init__.py +++ /dev/null @@ -1,18 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._managed_service_identity_client import ManagedServiceIdentityClient -from ._version import VERSION - -__version__ = VERSION -__all__ = ['ManagedServiceIdentityClient'] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/_configuration.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/_configuration.py deleted file mode 100644 index c3bab8b89071..000000000000 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/_configuration.py +++ /dev/null @@ -1,68 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class ManagedServiceIdentityClientConfiguration(Configuration): - """Configuration for ManagedServiceIdentityClient. - - 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 Subscription to which the identity belongs. - :type subscription_id: str - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: - super(ManagedServiceIdentityClientConfiguration, self).__init__(**kwargs) - 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.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = "2021-09-30-preview" - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-msi/{}'.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 = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/_managed_service_identity_client.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/_managed_service_identity_client.py deleted file mode 100644 index 2c3279938ef8..000000000000 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/_managed_service_identity_client.py +++ /dev/null @@ -1,99 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING - -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer - -from . import models -from ._configuration import ManagedServiceIdentityClientConfiguration -from .operations import Operations, SystemAssignedIdentitiesOperations, UserAssignedIdentitiesOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - -class ManagedServiceIdentityClient: - """The Managed Service Identity Client. - - :ivar system_assigned_identities: SystemAssignedIdentitiesOperations operations - :vartype system_assigned_identities: - azure.mgmt.msi.v2019_09_01_preview.operations.SystemAssignedIdentitiesOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.msi.v2019_09_01_preview.operations.Operations - :ivar user_assigned_identities: UserAssignedIdentitiesOperations operations - :vartype user_assigned_identities: - azure.mgmt.msi.v2019_09_01_preview.operations.UserAssignedIdentitiesOperations - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Id of the Subscription to which the identity belongs. - :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. - :type base_url: str - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = ManagedServiceIdentityClientConfiguration(credential=credential, subscription_id=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._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.system_assigned_identities = SystemAssignedIdentitiesOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.user_assigned_identities = UserAssignedIdentitiesOperations(self._client, self._config, self._serialize, self._deserialize) - - - def _send_request( - self, - request, # type: HttpRequest - **kwargs: Any - ) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - def close(self): - # type: () -> None - self._client.close() - - def __enter__(self): - # type: () -> ManagedServiceIdentityClient - self._client.__enter__() - return self - - def __exit__(self, *exc_details): - # type: (Any) -> None - self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/_metadata.json b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/_metadata.json deleted file mode 100644 index ea355fdb22af..000000000000 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/_metadata.json +++ /dev/null @@ -1,104 +0,0 @@ -{ - "chosen_version": "2021-09-30-preview", - "total_api_version_list": ["2021-09-30-preview"], - "client": { - "name": "ManagedServiceIdentityClient", - "filename": "_managed_service_identity_client", - "description": "The Managed Service Identity Client.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_lro_operations": false, - "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\": [\"ManagedServiceIdentityClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ManagedServiceIdentityClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" - }, - "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 Subscription to which the identity belongs.", - "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 Subscription to which the identity belongs.", - "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=\"https://management.azure.com\", # type: 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: str = \"https://management.azure.com\",", - "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_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"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\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "system_assigned_identities": "SystemAssignedIdentitiesOperations", - "operations": "Operations", - "user_assigned_identities": "UserAssignedIdentitiesOperations" - } -} \ No newline at end of file diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/_patch.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/_patch.py deleted file mode 100644 index 74e48ecd07cf..000000000000 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/_vendor.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/_vendor.py deleted file mode 100644 index 138f663c53a4..000000000000 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/_vendor.py +++ /dev/null @@ -1,27 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] - template = "/".join(components) diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/_version.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/_version.py deleted file mode 100644 index caf312bd2d0b..000000000000 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -VERSION = "6.0.0" diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/aio/__init__.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/aio/__init__.py deleted file mode 100644 index 7bda71f08efd..000000000000 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/aio/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._managed_service_identity_client import ManagedServiceIdentityClient -__all__ = ['ManagedServiceIdentityClient'] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/aio/_configuration.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/aio/_configuration.py deleted file mode 100644 index 791c398d9fad..000000000000 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/aio/_configuration.py +++ /dev/null @@ -1,67 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class ManagedServiceIdentityClientConfiguration(Configuration): - """Configuration for ManagedServiceIdentityClient. - - 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 Subscription to which the identity belongs. - :type subscription_id: str - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: - super(ManagedServiceIdentityClientConfiguration, self).__init__(**kwargs) - 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.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = "2021-09-30-preview" - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-msi/{}'.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 = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/aio/_managed_service_identity_client.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/aio/_managed_service_identity_client.py deleted file mode 100644 index f8a681e0d857..000000000000 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/aio/_managed_service_identity_client.py +++ /dev/null @@ -1,96 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING - -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer - -from .. import models -from ._configuration import ManagedServiceIdentityClientConfiguration -from .operations import Operations, SystemAssignedIdentitiesOperations, UserAssignedIdentitiesOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - -class ManagedServiceIdentityClient: - """The Managed Service Identity Client. - - :ivar system_assigned_identities: SystemAssignedIdentitiesOperations operations - :vartype system_assigned_identities: - azure.mgmt.msi.v2019_09_01_preview.aio.operations.SystemAssignedIdentitiesOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.msi.v2019_09_01_preview.aio.operations.Operations - :ivar user_assigned_identities: UserAssignedIdentitiesOperations operations - :vartype user_assigned_identities: - azure.mgmt.msi.v2019_09_01_preview.aio.operations.UserAssignedIdentitiesOperations - :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 Subscription to which the identity belongs. - :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. - :type base_url: str - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = ManagedServiceIdentityClientConfiguration(credential=credential, subscription_id=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._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.system_assigned_identities = SystemAssignedIdentitiesOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.user_assigned_identities = UserAssignedIdentitiesOperations(self._client, self._config, self._serialize, self._deserialize) - - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "ManagedServiceIdentityClient": - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/aio/_patch.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/aio/_patch.py deleted file mode 100644 index 74e48ecd07cf..000000000000 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/aio/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/aio/operations/__init__.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/aio/operations/__init__.py deleted file mode 100644 index 3b14b3b27ba4..000000000000 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/aio/operations/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._system_assigned_identities_operations import SystemAssignedIdentitiesOperations -from ._operations import Operations -from ._user_assigned_identities_operations import UserAssignedIdentitiesOperations - -__all__ = [ - 'SystemAssignedIdentitiesOperations', - 'Operations', - 'UserAssignedIdentitiesOperations', -] diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/aio/operations/_operations.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/aio/operations/_operations.py deleted file mode 100644 index c41ac52cbb87..000000000000 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/aio/operations/_operations.py +++ /dev/null @@ -1,109 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._operations import build_list_request -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: ~azure.mgmt.msi.v2019_09_01_preview.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 - - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: - """Lists available operations for the Microsoft.ManagedIdentity provider. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.msi.v2019_09_01_preview.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("OperationListResult", pipeline_response) - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/providers/Microsoft.ManagedIdentity/operations'} # type: ignore diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/aio/operations/_system_assigned_identities_operations.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/aio/operations/_system_assigned_identities_operations.py deleted file mode 100644 index 1411eb5825b5..000000000000 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/aio/operations/_system_assigned_identities_operations.py +++ /dev/null @@ -1,92 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._system_assigned_identities_operations import build_get_by_scope_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class SystemAssignedIdentitiesOperations: - """SystemAssignedIdentitiesOperations 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: ~azure.mgmt.msi.v2019_09_01_preview.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 - - @distributed_trace_async - async def get_by_scope( - self, - scope: str, - **kwargs: Any - ) -> "_models.SystemAssignedIdentity": - """Gets the systemAssignedIdentity available under the specified RP scope. - - :param scope: The resource provider scope of the resource. Parent resource being extended by - Managed Identities. - :type scope: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SystemAssignedIdentity, or the result of cls(response) - :rtype: ~azure.mgmt.msi.v2019_09_01_preview.models.SystemAssignedIdentity - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SystemAssignedIdentity"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - - request = build_get_by_scope_request( - scope=scope, - template_url=self.get_by_scope.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('SystemAssignedIdentity', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.ManagedIdentity/identities/default'} # type: ignore - diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/aio/operations/_user_assigned_identities_operations.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/aio/operations/_user_assigned_identities_operations.py deleted file mode 100644 index 6c7d1acde5ce..000000000000 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/aio/operations/_user_assigned_identities_operations.py +++ /dev/null @@ -1,505 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import functools -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._user_assigned_identities_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_associated_resources_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class UserAssignedIdentitiesOperations: - """UserAssignedIdentitiesOperations 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: ~azure.mgmt.msi.v2019_09_01_preview.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 - - @distributed_trace - def list_by_subscription( - self, - **kwargs: Any - ) -> AsyncIterable["_models.UserAssignedIdentitiesListResult"]: - """Lists all the userAssignedIdentities available under the specified subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either UserAssignedIdentitiesListResult or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.msi.v2019_09_01_preview.models.UserAssignedIdentitiesListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.UserAssignedIdentitiesListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("UserAssignedIdentitiesListResult", 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ManagedIdentity/userAssignedIdentities'} # type: ignore - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.UserAssignedIdentitiesListResult"]: - """Lists all the userAssignedIdentities available under the specified ResourceGroup. - - :param resource_group_name: The name of the Resource Group to which the identity belongs. - :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 UserAssignedIdentitiesListResult or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.msi.v2019_09_01_preview.models.UserAssignedIdentitiesListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.UserAssignedIdentitiesListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=self.list_by_resource_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("UserAssignedIdentitiesListResult", 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities'} # type: ignore - - @distributed_trace - def list_associated_resources( - self, - resource_group_name: str, - resource_name: str, - filter: Optional[str] = None, - orderby: Optional[str] = None, - top: Optional[int] = None, - skip: Optional[int] = None, - skiptoken: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.AssociatedResourcesListResult"]: - """Lists the associated resources for this identity. - - :param resource_group_name: The name of the Resource Group to which the identity belongs. - :type resource_group_name: str - :param resource_name: The name of the identity resource. - :type resource_name: str - :param filter: OData filter expression to apply to the query. - :type filter: str - :param orderby: OData orderBy expression to apply to the query. - :type orderby: str - :param top: Number of records to return. - :type top: int - :param skip: Number of records to skip. - :type skip: int - :param skiptoken: A skip token is used to continue retrieving items after an operation returns - a partial result. If a previous response contains a nextLink element, the value of the nextLink - element will include a skipToken parameter that specifies a starting point to use for - subsequent calls. - :type skiptoken: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AssociatedResourcesListResult or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.msi.v2019_09_01_preview.models.AssociatedResourcesListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AssociatedResourcesListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_associated_resources_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - filter=filter, - orderby=orderby, - top=top, - skip=skip, - skiptoken=skiptoken, - template_url=self.list_associated_resources.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_associated_resources_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - filter=filter, - orderby=orderby, - top=top, - skip=skip, - skiptoken=skiptoken, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("AssociatedResourcesListResult", 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list_associated_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}/listAssociatedResources'} # type: ignore - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - parameters: "_models.Identity", - **kwargs: Any - ) -> "_models.Identity": - """Create or update an identity in the specified subscription and resource group. - - :param resource_group_name: The name of the Resource Group to which the identity belongs. - :type resource_group_name: str - :param resource_name: The name of the identity resource. - :type resource_name: str - :param parameters: Parameters to create or update the identity. - :type parameters: ~azure.mgmt.msi.v2019_09_01_preview.models.Identity - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Identity, or the result of cls(response) - :rtype: ~azure.mgmt.msi.v2019_09_01_preview.models.Identity - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Identity"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(parameters, 'Identity') - - request = build_create_or_update_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.create_or_update.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('Identity', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('Identity', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}'} # type: ignore - - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - resource_name: str, - parameters: "_models.IdentityUpdate", - **kwargs: Any - ) -> "_models.Identity": - """Update an identity in the specified subscription and resource group. - - :param resource_group_name: The name of the Resource Group to which the identity belongs. - :type resource_group_name: str - :param resource_name: The name of the identity resource. - :type resource_name: str - :param parameters: Parameters to update the identity. - :type parameters: ~azure.mgmt.msi.v2019_09_01_preview.models.IdentityUpdate - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Identity, or the result of cls(response) - :rtype: ~azure.mgmt.msi.v2019_09_01_preview.models.Identity - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Identity"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(parameters, 'IdentityUpdate') - - request = build_update_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.update.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Identity', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}'} # type: ignore - - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_models.Identity": - """Gets the identity. - - :param resource_group_name: The name of the Resource Group to which the identity belongs. - :type resource_group_name: str - :param resource_name: The name of the identity resource. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Identity, or the result of cls(response) - :rtype: ~azure.mgmt.msi.v2019_09_01_preview.models.Identity - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Identity"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Identity', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}'} # type: ignore - - - @distributed_trace_async - async def delete( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> None: - """Deletes the identity. - - :param resource_group_name: The name of the Resource Group to which the identity belongs. - :type resource_group_name: str - :param resource_name: The name of the identity resource. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - - request = build_delete_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.delete.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}'} # type: ignore - diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/models/__init__.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/models/__init__.py deleted file mode 100644 index ec960142ee6b..000000000000 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/models/__init__.py +++ /dev/null @@ -1,38 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._models_py3 import AssociatedResourcesListResult -from ._models_py3 import AzureResource -from ._models_py3 import CloudErrorBody -from ._models_py3 import Identity -from ._models_py3 import IdentityUpdate -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import ProxyResource -from ._models_py3 import Resource -from ._models_py3 import SystemAssignedIdentity -from ._models_py3 import TrackedResource -from ._models_py3 import UserAssignedIdentitiesListResult - - -__all__ = [ - 'AssociatedResourcesListResult', - 'AzureResource', - 'CloudErrorBody', - 'Identity', - 'IdentityUpdate', - 'Operation', - 'OperationDisplay', - 'OperationListResult', - 'ProxyResource', - 'Resource', - 'SystemAssignedIdentity', - 'TrackedResource', - 'UserAssignedIdentitiesListResult', -] diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/models/_models_py3.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/models/_models_py3.py deleted file mode 100644 index 33ec753b0c4a..000000000000 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/models/_models_py3.py +++ /dev/null @@ -1,638 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Dict, List, Optional - -import msrest.serialization - - -class AssociatedResourcesListResult(msrest.serialization.Model): - """Azure resources returned by the resource action to get a list of assigned resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar total_count: Total number of Azure resources assigned to the identity. - :vartype total_count: float - :ivar value: The collection of Azure resources returned by the resource action to get a list of - assigned resources. - :vartype value: list[~azure.mgmt.msi.v2019_09_01_preview.models.AzureResource] - :ivar next_link: The url to get the next page of results, if any. - :vartype next_link: str - """ - - _validation = { - 'total_count': {'readonly': True}, - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'total_count': {'key': 'totalCount', 'type': 'float'}, - 'value': {'key': 'value', 'type': '[AzureResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(AssociatedResourcesListResult, self).__init__(**kwargs) - self.total_count = None - self.value = None - self.next_link = None - - -class AzureResource(msrest.serialization.Model): - """Describes an Azure resource that is attached to an identity. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ID of this resource. - :vartype id: str - :ivar name: The name of this resource. - :vartype name: str - :ivar type: The type of this resource. - :vartype type: str - :ivar resource_group: The name of the resource group this resource belongs to. - :vartype resource_group: str - :ivar subscription_id: The ID of the subscription this resource belongs to. - :vartype subscription_id: str - :ivar subscription_display_name: The name of the subscription this resource belongs to. - :vartype subscription_display_name: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'resource_group': {'readonly': True}, - 'subscription_id': {'readonly': True}, - 'subscription_display_name': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, - 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, - 'subscription_display_name': {'key': 'subscriptionDisplayName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(AzureResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.resource_group = None - self.subscription_id = None - self.subscription_display_name = None - - -class CloudErrorBody(msrest.serialization.Model): - """An error response from the ManagedServiceIdentity service. - - :ivar code: An identifier for the error. - :vartype code: str - :ivar message: A message describing the error, intended to be suitable for display in a user - interface. - :vartype message: str - :ivar target: The target of the particular error. For example, the name of the property in - error. - :vartype target: str - :ivar details: A list of additional details about the error. - :vartype details: list[~azure.mgmt.msi.v2019_09_01_preview.models.CloudErrorBody] - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, - **kwargs - ): - """ - :keyword code: An identifier for the error. - :paramtype code: str - :keyword message: A message describing the error, intended to be suitable for display in a user - interface. - :paramtype message: str - :keyword target: The target of the particular error. For example, the name of the property in - error. - :paramtype target: str - :keyword details: A list of additional details about the error. - :paramtype details: list[~azure.mgmt.msi.v2019_09_01_preview.models.CloudErrorBody] - """ - super(CloudErrorBody, self).__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - 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. E.g. "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 an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. - - 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. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar tags: A set of tags. Resource tags. - :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. - :vartype 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 - ): - """ - :keyword tags: A set of tags. Resource tags. - :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. - :paramtype location: str - """ - super(TrackedResource, self).__init__(**kwargs) - self.tags = tags - self.location = location - - -class Identity(TrackedResource): - """Describes an identity 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. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar tags: A set of tags. Resource tags. - :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. - :vartype location: str - :ivar tenant_id: The id of the tenant which the identity belongs to. - :vartype tenant_id: str - :ivar principal_id: The id of the service principal object associated with the created - identity. - :vartype principal_id: str - :ivar client_id: The id of the app associated with the identity. This is a random generated - UUID by MSI. - :vartype client_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'tenant_id': {'readonly': True}, - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': 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'}, - 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, - 'principal_id': {'key': 'properties.principalId', 'type': 'str'}, - 'client_id': {'key': 'properties.clientId', 'type': 'str'}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): - """ - :keyword tags: A set of tags. Resource tags. - :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. - :paramtype location: str - """ - super(Identity, self).__init__(tags=tags, location=location, **kwargs) - self.tenant_id = None - self.principal_id = None - self.client_id = None - - -class IdentityUpdate(Resource): - """Describes an identity resource. - - 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. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar location: The geo-location where the resource lives. - :vartype location: str - :ivar tags: A set of tags. Resource tags. - :vartype tags: dict[str, str] - :ivar tenant_id: The id of the tenant which the identity belongs to. - :vartype tenant_id: str - :ivar principal_id: The id of the service principal object associated with the created - identity. - :vartype principal_id: str - :ivar client_id: The id of the app associated with the identity. This is a random generated - UUID by MSI. - :vartype client_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, - 'principal_id': {'key': 'properties.principalId', 'type': 'str'}, - 'client_id': {'key': 'properties.clientId', 'type': 'str'}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): - """ - :keyword location: The geo-location where the resource lives. - :paramtype location: str - :keyword tags: A set of tags. Resource tags. - :paramtype tags: dict[str, str] - """ - super(IdentityUpdate, self).__init__(**kwargs) - self.location = location - self.tags = tags - self.tenant_id = None - self.principal_id = None - self.client_id = None - - -class Operation(msrest.serialization.Model): - """Operation supported by the Microsoft.ManagedIdentity REST API. - - :ivar name: The name of the REST Operation. This is of the format - {provider}/{resource}/{operation}. - :vartype name: str - :ivar display: The object that describes the operation. - :vartype display: ~azure.mgmt.msi.v2019_09_01_preview.models.OperationDisplay - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - display: Optional["OperationDisplay"] = None, - **kwargs - ): - """ - :keyword name: The name of the REST Operation. This is of the format - {provider}/{resource}/{operation}. - :paramtype name: str - :keyword display: The object that describes the operation. - :paramtype display: ~azure.mgmt.msi.v2019_09_01_preview.models.OperationDisplay - """ - super(Operation, self).__init__(**kwargs) - self.name = name - self.display = display - - -class OperationDisplay(msrest.serialization.Model): - """The object that describes the operation. - - :ivar provider: Friendly name of the resource provider. - :vartype provider: str - :ivar operation: The type of operation. For example: read, write, delete. - :vartype operation: str - :ivar resource: The resource type on which the operation is performed. - :vartype resource: str - :ivar description: A description of the operation. - :vartype description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - *, - provider: Optional[str] = None, - operation: Optional[str] = None, - resource: Optional[str] = None, - description: Optional[str] = None, - **kwargs - ): - """ - :keyword provider: Friendly name of the resource provider. - :paramtype provider: str - :keyword operation: The type of operation. For example: read, write, delete. - :paramtype operation: str - :keyword resource: The resource type on which the operation is performed. - :paramtype resource: str - :keyword description: A description of the operation. - :paramtype description: str - """ - super(OperationDisplay, self).__init__(**kwargs) - self.provider = provider - self.operation = operation - self.resource = resource - self.description = description - - -class OperationListResult(msrest.serialization.Model): - """A list of operations supported by Microsoft.ManagedIdentity Resource Provider. - - :ivar value: A list of operations supported by Microsoft.ManagedIdentity Resource Provider. - :vartype value: list[~azure.mgmt.msi.v2019_09_01_preview.models.Operation] - :ivar next_link: The url to get the next page of results, if any. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["Operation"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: A list of operations supported by Microsoft.ManagedIdentity Resource Provider. - :paramtype value: list[~azure.mgmt.msi.v2019_09_01_preview.models.Operation] - :keyword next_link: The url to get the next page of results, if any. - :paramtype next_link: str - """ - super(OperationListResult, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. - - 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. E.g. "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 SystemAssignedIdentity(ProxyResource): - """Describes a system assigned identity 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. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar location: Required. The geo-location where the resource lives. - :vartype location: str - :ivar tags: A set of tags. Resource tags. - :vartype tags: dict[str, str] - :ivar tenant_id: The id of the tenant which the identity belongs to. - :vartype tenant_id: str - :ivar principal_id: The id of the service principal object associated with the created - identity. - :vartype principal_id: str - :ivar client_id: The id of the app associated with the identity. This is a random generated - UUID by MSI. - :vartype client_id: str - :ivar client_secret_url: The ManagedServiceIdentity DataPlane URL that can be queried to obtain - the identity credentials. - :vartype client_secret_url: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'tenant_id': {'readonly': True}, - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, - 'client_secret_url': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, - 'principal_id': {'key': 'properties.principalId', 'type': 'str'}, - 'client_id': {'key': 'properties.clientId', 'type': 'str'}, - 'client_secret_url': {'key': 'properties.clientSecretUrl', 'type': 'str'}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): - """ - :keyword location: Required. The geo-location where the resource lives. - :paramtype location: str - :keyword tags: A set of tags. Resource tags. - :paramtype tags: dict[str, str] - """ - super(SystemAssignedIdentity, self).__init__(**kwargs) - self.location = location - self.tags = tags - self.tenant_id = None - self.principal_id = None - self.client_id = None - self.client_secret_url = None - - -class UserAssignedIdentitiesListResult(msrest.serialization.Model): - """Values returned by the List operation. - - :ivar value: The collection of userAssignedIdentities returned by the listing operation. - :vartype value: list[~azure.mgmt.msi.v2019_09_01_preview.models.Identity] - :ivar next_link: The url to get the next page of results, if any. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Identity]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["Identity"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: The collection of userAssignedIdentities returned by the listing operation. - :paramtype value: list[~azure.mgmt.msi.v2019_09_01_preview.models.Identity] - :keyword next_link: The url to get the next page of results, if any. - :paramtype next_link: str - """ - super(UserAssignedIdentitiesListResult, self).__init__(**kwargs) - self.value = value - self.next_link = next_link diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/operations/__init__.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/operations/__init__.py deleted file mode 100644 index 3b14b3b27ba4..000000000000 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/operations/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._system_assigned_identities_operations import SystemAssignedIdentitiesOperations -from ._operations import Operations -from ._user_assigned_identities_operations import UserAssignedIdentitiesOperations - -__all__ = [ - 'SystemAssignedIdentitiesOperations', - 'Operations', - 'UserAssignedIdentitiesOperations', -] diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/operations/_operations.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/operations/_operations.py deleted file mode 100644 index 7490f9642e78..000000000000 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/operations/_operations.py +++ /dev/null @@ -1,135 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - **kwargs: Any -) -> HttpRequest: - api_version = "2021-09-30-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.ManagedIdentity/operations') - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - -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: ~azure.mgmt.msi.v2019_09_01_preview.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 - - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: - """Lists available operations for the Microsoft.ManagedIdentity provider. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.msi.v2019_09_01_preview.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("OperationListResult", pipeline_response) - 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/providers/Microsoft.ManagedIdentity/operations'} # type: ignore diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/operations/_system_assigned_identities_operations.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/operations/_system_assigned_identities_operations.py deleted file mode 100644 index 8582c6d619d8..000000000000 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/operations/_system_assigned_identities_operations.py +++ /dev/null @@ -1,125 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_by_scope_request( - scope: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-09-30-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/{scope}/providers/Microsoft.ManagedIdentity/identities/default') - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, 'str', skip_quote=True), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - -class SystemAssignedIdentitiesOperations(object): - """SystemAssignedIdentitiesOperations 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: ~azure.mgmt.msi.v2019_09_01_preview.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 - - @distributed_trace - def get_by_scope( - self, - scope: str, - **kwargs: Any - ) -> "_models.SystemAssignedIdentity": - """Gets the systemAssignedIdentity available under the specified RP scope. - - :param scope: The resource provider scope of the resource. Parent resource being extended by - Managed Identities. - :type scope: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SystemAssignedIdentity, or the result of cls(response) - :rtype: ~azure.mgmt.msi.v2019_09_01_preview.models.SystemAssignedIdentity - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SystemAssignedIdentity"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - - request = build_get_by_scope_request( - scope=scope, - template_url=self.get_by_scope.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('SystemAssignedIdentity', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.ManagedIdentity/identities/default'} # type: ignore - diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/operations/_user_assigned_identities_operations.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/operations/_user_assigned_identities_operations.py deleted file mode 100644 index 8bce412f6473..000000000000 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/operations/_user_assigned_identities_operations.py +++ /dev/null @@ -1,780 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -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 HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_by_subscription_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-09-30-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ManagedIdentity/userAssignedIdentities') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-09-30-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_associated_resources_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - filter: Optional[str] = None, - orderby: Optional[str] = None, - top: Optional[int] = None, - skip: Optional[int] = None, - skiptoken: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-09-30-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}/listAssociatedResources') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') - if orderby is not None: - query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') - if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=1) - if skiptoken is not None: - query_parameters['$skiptoken'] = _SERIALIZER.query("skiptoken", skiptoken, 'str') - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-09-30-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-09-30-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-09-30-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-09-30-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}') - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - -class UserAssignedIdentitiesOperations(object): - """UserAssignedIdentitiesOperations 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: ~azure.mgmt.msi.v2019_09_01_preview.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 - - @distributed_trace - def list_by_subscription( - self, - **kwargs: Any - ) -> Iterable["_models.UserAssignedIdentitiesListResult"]: - """Lists all the userAssignedIdentities available under the specified subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either UserAssignedIdentitiesListResult or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.msi.v2019_09_01_preview.models.UserAssignedIdentitiesListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.UserAssignedIdentitiesListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("UserAssignedIdentitiesListResult", 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ManagedIdentity/userAssignedIdentities'} # type: ignore - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable["_models.UserAssignedIdentitiesListResult"]: - """Lists all the userAssignedIdentities available under the specified ResourceGroup. - - :param resource_group_name: The name of the Resource Group to which the identity belongs. - :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 UserAssignedIdentitiesListResult or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.msi.v2019_09_01_preview.models.UserAssignedIdentitiesListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.UserAssignedIdentitiesListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=self.list_by_resource_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("UserAssignedIdentitiesListResult", 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities'} # type: ignore - - @distributed_trace - def list_associated_resources( - self, - resource_group_name: str, - resource_name: str, - filter: Optional[str] = None, - orderby: Optional[str] = None, - top: Optional[int] = None, - skip: Optional[int] = None, - skiptoken: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.AssociatedResourcesListResult"]: - """Lists the associated resources for this identity. - - :param resource_group_name: The name of the Resource Group to which the identity belongs. - :type resource_group_name: str - :param resource_name: The name of the identity resource. - :type resource_name: str - :param filter: OData filter expression to apply to the query. - :type filter: str - :param orderby: OData orderBy expression to apply to the query. - :type orderby: str - :param top: Number of records to return. - :type top: int - :param skip: Number of records to skip. - :type skip: int - :param skiptoken: A skip token is used to continue retrieving items after an operation returns - a partial result. If a previous response contains a nextLink element, the value of the nextLink - element will include a skipToken parameter that specifies a starting point to use for - subsequent calls. - :type skiptoken: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AssociatedResourcesListResult or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.msi.v2019_09_01_preview.models.AssociatedResourcesListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AssociatedResourcesListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_associated_resources_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - filter=filter, - orderby=orderby, - top=top, - skip=skip, - skiptoken=skiptoken, - template_url=self.list_associated_resources.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_associated_resources_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - filter=filter, - orderby=orderby, - top=top, - skip=skip, - skiptoken=skiptoken, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("AssociatedResourcesListResult", 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list_associated_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}/listAssociatedResources'} # type: ignore - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - parameters: "_models.Identity", - **kwargs: Any - ) -> "_models.Identity": - """Create or update an identity in the specified subscription and resource group. - - :param resource_group_name: The name of the Resource Group to which the identity belongs. - :type resource_group_name: str - :param resource_name: The name of the identity resource. - :type resource_name: str - :param parameters: Parameters to create or update the identity. - :type parameters: ~azure.mgmt.msi.v2019_09_01_preview.models.Identity - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Identity, or the result of cls(response) - :rtype: ~azure.mgmt.msi.v2019_09_01_preview.models.Identity - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Identity"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(parameters, 'Identity') - - request = build_create_or_update_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.create_or_update.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('Identity', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('Identity', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}'} # type: ignore - - - @distributed_trace - def update( - self, - resource_group_name: str, - resource_name: str, - parameters: "_models.IdentityUpdate", - **kwargs: Any - ) -> "_models.Identity": - """Update an identity in the specified subscription and resource group. - - :param resource_group_name: The name of the Resource Group to which the identity belongs. - :type resource_group_name: str - :param resource_name: The name of the identity resource. - :type resource_name: str - :param parameters: Parameters to update the identity. - :type parameters: ~azure.mgmt.msi.v2019_09_01_preview.models.IdentityUpdate - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Identity, or the result of cls(response) - :rtype: ~azure.mgmt.msi.v2019_09_01_preview.models.Identity - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Identity"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(parameters, 'IdentityUpdate') - - request = build_update_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - content_type=content_type, - json=_json, - template_url=self.update.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Identity', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}'} # type: ignore - - - @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> "_models.Identity": - """Gets the identity. - - :param resource_group_name: The name of the Resource Group to which the identity belongs. - :type resource_group_name: str - :param resource_name: The name of the identity resource. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Identity, or the result of cls(response) - :rtype: ~azure.mgmt.msi.v2019_09_01_preview.models.Identity - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Identity"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Identity', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}'} # type: ignore - - - @distributed_trace - def delete( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> None: - """Deletes the identity. - - :param resource_group_name: The name of the Resource Group to which the identity belongs. - :type resource_group_name: str - :param resource_name: The name of the identity resource. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - - request = build_delete_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - template_url=self.delete.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}'} # type: ignore - diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/py.typed b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/v2019_09_01_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file