From 0c72c31d6fd59ad305ce60d0595fb5e13d59c891 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 11 Feb 2022 07:51:21 +0000 Subject: [PATCH] CodeGen from PR 17782 in Azure/azure-rest-api-specs Merge 6093a45550cb83c02a651d29d66ef09b5d455447 into 25a8355d4094595edf9b58b13e8c95b0b0c9c50c --- .../CHANGELOG.md | 5 + .../azure-mgmt-managedapplication/LICENSE | 21 + .../azure-mgmt-managedapplication/MANIFEST.in | 6 + .../azure-mgmt-managedapplication/README.md | 30 + .../azure-mgmt-managedapplication/_meta.json | 11 + .../azure/__init__.py | 1 + .../azure/mgmt/__init__.py | 1 + .../azure/mgmt/managedapplication/__init__.py | 16 + .../managedapplication/_application_client.py | 144 ++ .../mgmt/managedapplication/_configuration.py | 71 + .../managedapplication/_operations_mixin.py | 47 + .../azure/mgmt/managedapplication/_version.py | 8 + .../mgmt/managedapplication/aio/__init__.py | 10 + .../aio/_application_client.py | 143 + .../managedapplication/aio/_configuration.py | 67 + .../aio/_operations_mixin.py | 42 + .../azure/mgmt/managedapplication/models.py | 7 + .../azure/mgmt/managedapplication/py.typed | 1 + .../v2021_07_01/__init__.py | 18 + .../v2021_07_01/_application_client.py | 102 + .../v2021_07_01/_configuration.py | 68 + .../v2021_07_01/_metadata.json | 122 + .../managedapplication/v2021_07_01/_patch.py | 31 + .../managedapplication/v2021_07_01/_vendor.py | 27 + .../v2021_07_01/_version.py | 9 + .../v2021_07_01/aio/__init__.py | 15 + .../v2021_07_01/aio/_application_client.py | 99 + .../v2021_07_01/aio/_configuration.py | 67 + .../v2021_07_01/aio/_patch.py | 31 + .../v2021_07_01/aio/operations/__init__.py | 19 + .../_application_client_operations.py | 90 + .../_application_definitions_operations.py | 517 ++++ .../operations/_applications_operations.py | 665 +++++ .../operations/_jit_requests_operations.py | 420 +++ .../v2021_07_01/models/__init__.py | 127 + .../models/_application_client_enums.py | 145 ++ .../v2021_07_01/models/_models_py3.py | 2295 +++++++++++++++++ .../v2021_07_01/operations/__init__.py | 19 + .../_application_client_operations.py | 116 + .../_application_definitions_operations.py | 741 ++++++ .../operations/_applications_operations.py | 959 +++++++ .../operations/_jit_requests_operations.py | 645 +++++ .../managedapplication/v2021_07_01/py.typed | 1 + .../sdk_packaging.toml | 9 + .../azure-mgmt-managedapplication/setup.py | 73 + sdk/managedapplication/ci.yml | 33 + 46 files changed, 8094 insertions(+) create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/CHANGELOG.md create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/LICENSE create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/MANIFEST.in create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/README.md create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/_meta.json create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/__init__.py create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/__init__.py create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/__init__.py create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/_application_client.py create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/_configuration.py create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/_operations_mixin.py create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/_version.py create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/aio/__init__.py create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/aio/_application_client.py create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/aio/_configuration.py create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/aio/_operations_mixin.py create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/models.py create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/py.typed create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/__init__.py create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/_application_client.py create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/_configuration.py create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/_metadata.json create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/_patch.py create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/_vendor.py create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/_version.py create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/aio/__init__.py create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/aio/_application_client.py create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/aio/_configuration.py create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/aio/_patch.py create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/aio/operations/__init__.py create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/aio/operations/_application_client_operations.py create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/aio/operations/_application_definitions_operations.py create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/aio/operations/_applications_operations.py create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/aio/operations/_jit_requests_operations.py create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/models/__init__.py create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/models/_application_client_enums.py create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/models/_models_py3.py create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/operations/__init__.py create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/operations/_application_client_operations.py create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/operations/_application_definitions_operations.py create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/operations/_applications_operations.py create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/operations/_jit_requests_operations.py create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/py.typed create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/sdk_packaging.toml create mode 100644 sdk/managedapplication/azure-mgmt-managedapplication/setup.py create mode 100644 sdk/managedapplication/ci.yml diff --git a/sdk/managedapplication/azure-mgmt-managedapplication/CHANGELOG.md b/sdk/managedapplication/azure-mgmt-managedapplication/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/managedapplication/azure-mgmt-managedapplication/LICENSE b/sdk/managedapplication/azure-mgmt-managedapplication/LICENSE new file mode 100644 index 000000000000..b2f52a2bad4e --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/LICENSE @@ -0,0 +1,21 @@ +Copyright (c) Microsoft Corporation. + +MIT License + +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. diff --git a/sdk/managedapplication/azure-mgmt-managedapplication/MANIFEST.in b/sdk/managedapplication/azure-mgmt-managedapplication/MANIFEST.in new file mode 100644 index 000000000000..2c31e8da0cb1 --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/MANIFEST.in @@ -0,0 +1,6 @@ +include _meta.json +recursive-include tests *.py *.yaml +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py +include LICENSE diff --git a/sdk/managedapplication/azure-mgmt-managedapplication/README.md b/sdk/managedapplication/azure-mgmt-managedapplication/README.md new file mode 100644 index 000000000000..9880a42e86dc --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/README.md @@ -0,0 +1,30 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure MyService Management Client Library. +This package has been tested with Python 3.7+. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + +## _Disclaimer_ + +_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ + +# Usage + + +To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) + + + +For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) +Code samples for this package can be found at [MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-managedapplication%2FREADME.png) diff --git a/sdk/managedapplication/azure-mgmt-managedapplication/_meta.json b/sdk/managedapplication/azure-mgmt-managedapplication/_meta.json new file mode 100644 index 000000000000..e98a23cb286e --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.7.2", + "use": [ + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" + ], + "commit": "9581557c62d2ed8f469eb72780630cceef281faa", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/solutions/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "readme": "specification/solutions/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/managedapplication/azure-mgmt-managedapplication/azure/__init__.py b/sdk/managedapplication/azure-mgmt-managedapplication/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/__init__.py b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/__init__.py b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/__init__.py new file mode 100644 index 000000000000..ab8aa89a6497 --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/__init__.py @@ -0,0 +1,16 @@ +# 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 ._application_client import ApplicationClient +__all__ = ['ApplicationClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/_application_client.py b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/_application_client.py new file mode 100644 index 000000000000..9717c4b0ff2f --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/_application_client.py @@ -0,0 +1,144 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from azure.profiles import KnownProfiles, ProfileDefinition +from azure.profiles.multiapiclient import MultiApiClientMixin +from msrest import Deserializer, Serializer + +from ._configuration import ApplicationClientConfiguration +from ._operations_mixin import ApplicationClientOperationsMixin + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + +class _SDKClient(object): + def __init__(self, *args, **kwargs): + """This is a fake class to support current implemetation of MultiApiClientMixin." + Will be removed in final version of multiapi azure-core based client + """ + pass + +class ApplicationClient(ApplicationClientOperationsMixin, MultiApiClientMixin, _SDKClient): + """ARM applications. + + This ready contains multiple API versions, to help you deal with all of the Azure clouds + (Azure Stack, Azure Government, Azure China, etc.). + By default, it uses the latest API version available on public Azure. + For production, you should stick to a particular api-version and/or profile. + The profile sets a mapping between an operation group and its API version. + The api-version parameter sets the default API version if the operation + group is not described in the profile. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param api_version: API version to use if no profile is provided, or if missing in profile. + :type api_version: str + :param base_url: Service URL + :type base_url: str + :param profile: A profile definition, from KnownProfiles to dict. + :type profile: azure.profiles.KnownProfiles + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + DEFAULT_API_VERSION = '2021-07-01' + _PROFILE_TAG = "azure.mgmt.managedapplication.ApplicationClient" + LATEST_PROFILE = ProfileDefinition({ + _PROFILE_TAG: { + None: DEFAULT_API_VERSION, + }}, + _PROFILE_TAG + " latest" + ) + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + api_version=None, # type: Optional[str] + base_url="https://management.azure.com", # type: str + profile=KnownProfiles.default, # type: KnownProfiles + **kwargs # type: Any + ): + self._config = ApplicationClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + super(ApplicationClient, self).__init__( + api_version=api_version, + profile=profile + ) + + @classmethod + def _models_dict(cls, api_version): + return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)} + + @classmethod + def models(cls, api_version=DEFAULT_API_VERSION): + """Module depends on the API version: + + * 2021-07-01: :mod:`v2021_07_01.models` + """ + if api_version == '2021-07-01': + from .v2021_07_01 import models + return models + raise ValueError("API version {} is not available".format(api_version)) + + @property + def application_definitions(self): + """Instance depends on the API version: + + * 2021-07-01: :class:`ApplicationDefinitionsOperations` + """ + api_version = self._get_api_version('application_definitions') + if api_version == '2021-07-01': + from .v2021_07_01.operations import ApplicationDefinitionsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'application_definitions'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def applications(self): + """Instance depends on the API version: + + * 2021-07-01: :class:`ApplicationsOperations` + """ + api_version = self._get_api_version('applications') + if api_version == '2021-07-01': + from .v2021_07_01.operations import ApplicationsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'applications'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def jit_requests(self): + """Instance depends on the API version: + + * 2021-07-01: :class:`JitRequestsOperations` + """ + api_version = self._get_api_version('jit_requests') + if api_version == '2021-07-01': + from .v2021_07_01.operations import JitRequestsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'jit_requests'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + def close(self): + self._client.close() + def __enter__(self): + self._client.__enter__() + return self + def __exit__(self, *exc_details): + self._client.__exit__(*exc_details) diff --git a/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/_configuration.py b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/_configuration.py new file mode 100644 index 000000000000..2bab77194439 --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/_configuration.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + +class ApplicationClientConfiguration(Configuration): + """Configuration for ApplicationClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(ApplicationClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'azure-mgmt-managedapplication/{}'.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/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/_operations_mixin.py b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/_operations_mixin.py new file mode 100644 index 000000000000..ef99a1d1fbb0 --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/_operations_mixin.py @@ -0,0 +1,47 @@ +# 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 msrest import Serializer, Deserializer +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Iterable + + from azure.core.paging import ItemPaged + + +class ApplicationClientOperationsMixin(object): + + def list_operations( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.OperationListResult"] + """Lists all of the available Microsoft.Solutions REST API operations. + + :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.managedapplication.v2021_07_01.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('list_operations') + if api_version == '2021-07-01': + from .v2021_07_01.operations import ApplicationClientOperationsMixin as OperationClass + else: + raise ValueError("API version {} does not have operation 'list_operations'".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._serialize.client_side_validation = False + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.list_operations(**kwargs) diff --git a/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/_version.py b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/_version.py new file mode 100644 index 000000000000..a30a458f8b5b --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/_version.py @@ -0,0 +1,8 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "0.1.0" \ No newline at end of file diff --git a/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/aio/__init__.py b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/aio/__init__.py new file mode 100644 index 000000000000..42ac8700d5df --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._application_client import ApplicationClient +__all__ = ['ApplicationClient'] diff --git a/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/aio/_application_client.py b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/aio/_application_client.py new file mode 100644 index 000000000000..8af0585c38f4 --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/aio/_application_client.py @@ -0,0 +1,143 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.mgmt.core import AsyncARMPipelineClient +from azure.profiles import KnownProfiles, ProfileDefinition +from azure.profiles.multiapiclient import MultiApiClientMixin +from msrest import Deserializer, Serializer + +from ._configuration import ApplicationClientConfiguration +from ._operations_mixin import ApplicationClientOperationsMixin + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + from azure.core.credentials_async import AsyncTokenCredential + +class _SDKClient(object): + def __init__(self, *args, **kwargs): + """This is a fake class to support current implemetation of MultiApiClientMixin." + Will be removed in final version of multiapi azure-core based client + """ + pass + +class ApplicationClient(ApplicationClientOperationsMixin, MultiApiClientMixin, _SDKClient): + """ARM applications. + + This ready contains multiple API versions, to help you deal with all of the Azure clouds + (Azure Stack, Azure Government, Azure China, etc.). + By default, it uses the latest API version available on public Azure. + For production, you should stick to a particular api-version and/or profile. + The profile sets a mapping between an operation group and its API version. + The api-version parameter sets the default API version if the operation + group is not described in the profile. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param api_version: API version to use if no profile is provided, or if missing in profile. + :type api_version: str + :param base_url: Service URL + :type base_url: str + :param profile: A profile definition, from KnownProfiles to dict. + :type profile: azure.profiles.KnownProfiles + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + DEFAULT_API_VERSION = '2021-07-01' + _PROFILE_TAG = "azure.mgmt.managedapplication.ApplicationClient" + LATEST_PROFILE = ProfileDefinition({ + _PROFILE_TAG: { + None: DEFAULT_API_VERSION, + }}, + _PROFILE_TAG + " latest" + ) + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + api_version: Optional[str] = None, + base_url: str = "https://management.azure.com", + profile: KnownProfiles = KnownProfiles.default, + **kwargs # type: Any + ) -> None: + self._config = ApplicationClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + super(ApplicationClient, self).__init__( + api_version=api_version, + profile=profile + ) + + @classmethod + def _models_dict(cls, api_version): + return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)} + + @classmethod + def models(cls, api_version=DEFAULT_API_VERSION): + """Module depends on the API version: + + * 2021-07-01: :mod:`v2021_07_01.models` + """ + if api_version == '2021-07-01': + from ..v2021_07_01 import models + return models + raise ValueError("API version {} is not available".format(api_version)) + + @property + def application_definitions(self): + """Instance depends on the API version: + + * 2021-07-01: :class:`ApplicationDefinitionsOperations` + """ + api_version = self._get_api_version('application_definitions') + if api_version == '2021-07-01': + from ..v2021_07_01.aio.operations import ApplicationDefinitionsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'application_definitions'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def applications(self): + """Instance depends on the API version: + + * 2021-07-01: :class:`ApplicationsOperations` + """ + api_version = self._get_api_version('applications') + if api_version == '2021-07-01': + from ..v2021_07_01.aio.operations import ApplicationsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'applications'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def jit_requests(self): + """Instance depends on the API version: + + * 2021-07-01: :class:`JitRequestsOperations` + """ + api_version = self._get_api_version('jit_requests') + if api_version == '2021-07-01': + from ..v2021_07_01.aio.operations import JitRequestsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'jit_requests'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + async def close(self): + await self._client.close() + async def __aenter__(self): + await self._client.__aenter__() + return self + async def __aexit__(self, *exc_details): + await self._client.__aexit__(*exc_details) diff --git a/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/aio/_configuration.py b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/aio/_configuration.py new file mode 100644 index 000000000000..8a5bebe00acd --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/aio/_configuration.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +class ApplicationClientConfiguration(Configuration): + """Configuration for ApplicationClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs # type: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(ApplicationClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'azure-mgmt-managedapplication/{}'.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/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/aio/_operations_mixin.py b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/aio/_operations_mixin.py new file mode 100644 index 000000000000..9968ae7f1618 --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/aio/_operations_mixin.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +from msrest import Serializer, Deserializer +from typing import Any, AsyncIterable + +from azure.core.async_paging import AsyncItemPaged + + +class ApplicationClientOperationsMixin(object): + + def list_operations( + self, + **kwargs: Any + ) -> AsyncIterable["_models.OperationListResult"]: + """Lists all of the available Microsoft.Solutions REST API operations. + + :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.managedapplication.v2021_07_01.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('list_operations') + if api_version == '2021-07-01': + from ..v2021_07_01.aio.operations import ApplicationClientOperationsMixin as OperationClass + else: + raise ValueError("API version {} does not have operation 'list_operations'".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._serialize.client_side_validation = False + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.list_operations(**kwargs) diff --git a/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/models.py b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/models.py new file mode 100644 index 000000000000..059efe06ada8 --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/models.py @@ -0,0 +1,7 @@ +# 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. +# -------------------------------------------------------------------------- +from .v2021_07_01.models import * diff --git a/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/py.typed b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/__init__.py b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/__init__.py new file mode 100644 index 000000000000..624aa2175b55 --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/__init__.py @@ -0,0 +1,18 @@ +# 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 ._application_client import ApplicationClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['ApplicationClient'] + +# `._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/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/_application_client.py b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/_application_client.py new file mode 100644 index 000000000000..597ddb05a910 --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/_application_client.py @@ -0,0 +1,102 @@ +# 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 ApplicationClientConfiguration +from .operations import ApplicationClientOperationsMixin, ApplicationDefinitionsOperations, ApplicationsOperations, JitRequestsOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + +class ApplicationClient(ApplicationClientOperationsMixin): + """ARM applications. + + :ivar applications: ApplicationsOperations operations + :vartype applications: + azure.mgmt.managedapplication.v2021_07_01.operations.ApplicationsOperations + :ivar application_definitions: ApplicationDefinitionsOperations operations + :vartype application_definitions: + azure.mgmt.managedapplication.v2021_07_01.operations.ApplicationDefinitionsOperations + :ivar jit_requests: JitRequestsOperations operations + :vartype jit_requests: + azure.mgmt.managedapplication.v2021_07_01.operations.JitRequestsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ApplicationClientConfiguration(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.applications = ApplicationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.application_definitions = ApplicationDefinitionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.jit_requests = JitRequestsOperations(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: () -> ApplicationClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/_configuration.py b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/_configuration.py new file mode 100644 index 000000000000..468e1033e1cd --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/_configuration.py @@ -0,0 +1,68 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, 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 ApplicationClientConfiguration(Configuration): + """Configuration for ApplicationClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ApplicationClientConfiguration, 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-07-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-managedapplication/{}'.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/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/_metadata.json b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/_metadata.json new file mode 100644 index 000000000000..3808291546f0 --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/_metadata.json @@ -0,0 +1,122 @@ +{ + "chosen_version": "2021-07-01", + "total_api_version_list": ["2021-07-01"], + "client": { + "name": "ApplicationClient", + "filename": "_application_client", + "description": "ARM applications.", + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ApplicationClientConfiguration\"], \"._operations_mixin\": [\"ApplicationClientOperationsMixin\"]}}, \"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\": [\"ApplicationClientConfiguration\"], \"._operations_mixin\": [\"ApplicationClientOperationsMixin\"]}}, \"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 target subscription.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=\"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": { + "applications": "ApplicationsOperations", + "application_definitions": "ApplicationDefinitionsOperations", + "jit_requests": "JitRequestsOperations" + }, + "operation_mixins": { + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\"]}, \"azurecore\": {\"azure.core.paging\": [\"ItemPaged\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\"]}, \"azurecore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}}}", + "operations": { + "list_operations" : { + "sync": { + "signature": "def list_operations(\n self,\n **kwargs # type: Any\n):\n # type: (...) -\u003e Iterable[\"_models.OperationListResult\"]\n", + "doc": "\"\"\"Lists all of the available Microsoft.Solutions REST API operations.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either OperationListResult or the result of cls(response)\n:rtype:\n ~azure.core.paging.ItemPaged[~azure.mgmt.managedapplication.v2021_07_01.models.OperationListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def list_operations(\n self,\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.OperationListResult\"]:\n", + "doc": "\"\"\"Lists all of the available Microsoft.Solutions REST API operations.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either OperationListResult or the result of cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.managedapplication.v2021_07_01.models.OperationListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "" + } + } + } +} \ No newline at end of file diff --git a/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/_patch.py b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/_patch.py @@ -0,0 +1,31 @@ +# 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/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/_vendor.py b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# 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/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/_version.py b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/aio/__init__.py b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/aio/__init__.py new file mode 100644 index 000000000000..45c4790ba3ab --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/aio/__init__.py @@ -0,0 +1,15 @@ +# 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 ._application_client import ApplicationClient +__all__ = ['ApplicationClient'] + +# `._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/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/aio/_application_client.py b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/aio/_application_client.py new file mode 100644 index 000000000000..cbba62e6a0cc --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/aio/_application_client.py @@ -0,0 +1,99 @@ +# 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 ApplicationClientConfiguration +from .operations import ApplicationClientOperationsMixin, ApplicationDefinitionsOperations, ApplicationsOperations, JitRequestsOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +class ApplicationClient(ApplicationClientOperationsMixin): + """ARM applications. + + :ivar applications: ApplicationsOperations operations + :vartype applications: + azure.mgmt.managedapplication.v2021_07_01.aio.operations.ApplicationsOperations + :ivar application_definitions: ApplicationDefinitionsOperations operations + :vartype application_definitions: + azure.mgmt.managedapplication.v2021_07_01.aio.operations.ApplicationDefinitionsOperations + :ivar jit_requests: JitRequestsOperations operations + :vartype jit_requests: + azure.mgmt.managedapplication.v2021_07_01.aio.operations.JitRequestsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ApplicationClientConfiguration(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.applications = ApplicationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.application_definitions = ApplicationDefinitionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.jit_requests = JitRequestsOperations(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) -> "ApplicationClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/aio/_configuration.py b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/aio/_configuration.py new file mode 100644 index 000000000000..03295568aca6 --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/aio/_configuration.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class ApplicationClientConfiguration(Configuration): + """Configuration for ApplicationClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ApplicationClientConfiguration, 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-07-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-managedapplication/{}'.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/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/aio/_patch.py b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/aio/_patch.py @@ -0,0 +1,31 @@ +# 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/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/aio/operations/__init__.py b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/aio/operations/__init__.py new file mode 100644 index 000000000000..dbc1b2f338e0 --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/aio/operations/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._application_client_operations import ApplicationClientOperationsMixin +from ._applications_operations import ApplicationsOperations +from ._application_definitions_operations import ApplicationDefinitionsOperations +from ._jit_requests_operations import JitRequestsOperations + +__all__ = [ + 'ApplicationClientOperationsMixin', + 'ApplicationsOperations', + 'ApplicationDefinitionsOperations', + 'JitRequestsOperations', +] diff --git a/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/aio/operations/_application_client_operations.py b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/aio/operations/_application_client_operations.py new file mode 100644 index 000000000000..3babbba5f762 --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/aio/operations/_application_client_operations.py @@ -0,0 +1,90 @@ +# 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._application_client_operations import build_list_operations_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ApplicationClientOperationsMixin: + + @distributed_trace + def list_operations( + self, + **kwargs: Any + ) -> AsyncIterable["_models.OperationListResult"]: + """Lists all of the available Microsoft.Solutions REST API operations. + + :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.managedapplication.v2021_07_01.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_operations_request( + template_url=self.list_operations.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_operations_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_operations.metadata = {'url': '/providers/Microsoft.Solutions/operations'} # type: ignore diff --git a/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/aio/operations/_application_definitions_operations.py b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/aio/operations/_application_definitions_operations.py new file mode 100644 index 000000000000..174aac87d139 --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/aio/operations/_application_definitions_operations.py @@ -0,0 +1,517 @@ +# 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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._application_definitions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ApplicationDefinitionsOperations: + """ApplicationDefinitionsOperations 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.managedapplication.v2021_07_01.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( + self, + resource_group_name: str, + application_definition_name: str, + **kwargs: Any + ) -> "_models.ApplicationDefinition": + """Gets the managed application definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_definition_name: The name of the managed application definition. + :type application_definition_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationDefinition"] + 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, + application_definition_name=application_definition_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ApplicationDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'} # type: ignore + + + async def _delete_initial( + self, + resource_group_name: str, + application_definition_name: str, + **kwargs: Any + ) -> None: + 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_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_definition_name=application_definition_name, + template_url=self._delete_initial.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, 202, 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_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + application_definition_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the managed application definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_definition_name: The name of the managed application definition. + :type application_definition_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + application_definition_name=application_definition_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + application_definition_name: str, + parameters: "_models.ApplicationDefinition", + **kwargs: Any + ) -> "_models.ApplicationDefinition": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationDefinition"] + 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, 'ApplicationDefinition') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_definition_name=application_definition_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.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('ApplicationDefinition', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ApplicationDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + application_definition_name: str, + parameters: "_models.ApplicationDefinition", + **kwargs: Any + ) -> AsyncLROPoller["_models.ApplicationDefinition"]: + """Creates a new managed application definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_definition_name: The name of the managed application definition. + :type application_definition_name: str + :param parameters: Parameters supplied to the create or update an managed application + definition. + :type parameters: ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationDefinition + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ApplicationDefinition or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationDefinition] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationDefinition"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + application_definition_name=application_definition_name, + parameters=parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ApplicationDefinition', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'} # type: ignore + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + application_definition_name: str, + parameters: "_models.ApplicationDefinitionPatchable", + **kwargs: Any + ) -> "_models.ApplicationDefinition": + """Updates the managed application definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_definition_name: The name of the managed application definition. + :type application_definition_name: str + :param parameters: Parameters supplied to the update a managed application definition. + :type parameters: + ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationDefinitionPatchable + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationDefinition"] + 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, 'ApplicationDefinitionPatchable') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_definition_name=application_definition_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ApplicationDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'} # type: ignore + + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ApplicationDefinitionListResult"]: + """Lists the managed application definitions in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationDefinitionListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationDefinitionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationDefinitionListResult"] + 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("ApplicationDefinitionListResult", 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions'} # type: ignore + + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ApplicationDefinitionListResult"]: + """Gets all the application definitions within a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationDefinitionListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationDefinitionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationDefinitionListResult"] + 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("ApplicationDefinitionListResult", 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Solutions/applicationDefinitions'} # type: ignore diff --git a/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/aio/operations/_applications_operations.py b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/aio/operations/_applications_operations.py new file mode 100644 index 000000000000..82300b652989 --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/aio/operations/_applications_operations.py @@ -0,0 +1,665 @@ +# 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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._applications_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_allowed_upgrade_plans_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_refresh_permissions_request_initial, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ApplicationsOperations: + """ApplicationsOperations 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.managedapplication.v2021_07_01.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( + self, + resource_group_name: str, + application_name: str, + **kwargs: Any + ) -> "_models.Application": + """Gets the managed application. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_name: The name of the managed application. + :type application_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Application, or the result of cls(response) + :rtype: ~azure.mgmt.managedapplication.v2021_07_01.models.Application + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Application"] + 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, + application_name=application_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Application', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}'} # type: ignore + + + async def _delete_initial( + self, + resource_group_name: str, + application_name: str, + **kwargs: Any + ) -> None: + 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_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_name=application_name, + template_url=self._delete_initial.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_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + application_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the managed application. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_name: The name of the managed application. + :type application_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + application_name=application_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + application_name: str, + parameters: "_models.Application", + **kwargs: Any + ) -> "_models.Application": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Application"] + 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, 'Application') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_name=application_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.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('Application', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Application', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + application_name: str, + parameters: "_models.Application", + **kwargs: Any + ) -> AsyncLROPoller["_models.Application"]: + """Creates a new managed application. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_name: The name of the managed application. + :type application_name: str + :param parameters: Parameters supplied to the create or update a managed application. + :type parameters: ~azure.mgmt.managedapplication.v2021_07_01.models.Application + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Application or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managedapplication.v2021_07_01.models.Application] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Application"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + application_name=application_name, + parameters=parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Application', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}'} # type: ignore + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + application_name: str, + parameters: Optional["_models.ApplicationPatchable"] = None, + **kwargs: Any + ) -> Optional["_models.Application"]: + """Updates an existing managed application. The only value that can be updated via PATCH currently + is the tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_name: The name of the managed application. + :type application_name: str + :param parameters: Parameters supplied to update an existing managed application. + :type parameters: ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationPatchable + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Application, or the result of cls(response) + :rtype: ~azure.mgmt.managedapplication.v2021_07_01.models.Application or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Application"]] + 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] + + if parameters is not None: + _json = self._serialize.body(parameters, 'ApplicationPatchable') + else: + _json = None + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_name=application_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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Application', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}'} # type: ignore + + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ApplicationListResult"]: + """Gets all the applications within a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationListResult"] + 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("ApplicationListResult", 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications'} # type: ignore + + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ApplicationListResult"]: + """Gets all the applications within a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationListResult"] + 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("ApplicationListResult", 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Solutions/applications'} # type: ignore + + async def _refresh_permissions_initial( + self, + resource_group_name: str, + application_name: str, + **kwargs: Any + ) -> None: + 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_refresh_permissions_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_name=application_name, + template_url=self._refresh_permissions_initial.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, 202]: + 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, {}) + + _refresh_permissions_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}/refreshPermissions'} # type: ignore + + + @distributed_trace_async + async def begin_refresh_permissions( + self, + resource_group_name: str, + application_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Refresh Permissions for application. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_name: The name of the managed application. + :type application_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._refresh_permissions_initial( + resource_group_name=resource_group_name, + application_name=application_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_refresh_permissions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}/refreshPermissions'} # type: ignore + + @distributed_trace_async + async def list_allowed_upgrade_plans( + self, + resource_group_name: str, + application_name: str, + **kwargs: Any + ) -> None: + """List allowed upgrade plans for application. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_name: The name of the managed application. + :type application_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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_list_allowed_upgrade_plans_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_name=application_name, + template_url=self.list_allowed_upgrade_plans.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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + list_allowed_upgrade_plans.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}/listAllowedUpgradePlans'} # type: ignore + diff --git a/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/aio/operations/_jit_requests_operations.py b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/aio/operations/_jit_requests_operations.py new file mode 100644 index 000000000000..510c30912180 --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/aio/operations/_jit_requests_operations.py @@ -0,0 +1,420 @@ +# 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, Union +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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._jit_requests_operations import build_create_or_update_request_initial, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class JitRequestsOperations: + """JitRequestsOperations 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.managedapplication.v2021_07_01.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( + self, + resource_group_name: str, + jit_request_name: str, + **kwargs: Any + ) -> "_models.JitRequestDefinition": + """Gets the JIT request. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param jit_request_name: The name of the JIT request. + :type jit_request_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JitRequestDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.managedapplication.v2021_07_01.models.JitRequestDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JitRequestDefinition"] + 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, + jit_request_name=jit_request_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('JitRequestDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/jitRequests/{jitRequestName}'} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + jit_request_name: str, + parameters: "_models.JitRequestDefinition", + **kwargs: Any + ) -> "_models.JitRequestDefinition": + cls = kwargs.pop('cls', None) # type: ClsType["_models.JitRequestDefinition"] + 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, 'JitRequestDefinition') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + jit_request_name=jit_request_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.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('JitRequestDefinition', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('JitRequestDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/jitRequests/{jitRequestName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + jit_request_name: str, + parameters: "_models.JitRequestDefinition", + **kwargs: Any + ) -> AsyncLROPoller["_models.JitRequestDefinition"]: + """Creates or updates the JIT request. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param jit_request_name: The name of the JIT request. + :type jit_request_name: str + :param parameters: Parameters supplied to the update JIT request. + :type parameters: ~azure.mgmt.managedapplication.v2021_07_01.models.JitRequestDefinition + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either JitRequestDefinition or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managedapplication.v2021_07_01.models.JitRequestDefinition] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.JitRequestDefinition"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + jit_request_name=jit_request_name, + parameters=parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('JitRequestDefinition', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/jitRequests/{jitRequestName}'} # type: ignore + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + jit_request_name: str, + parameters: "_models.JitRequestPatchable", + **kwargs: Any + ) -> "_models.JitRequestDefinition": + """Updates the JIT request. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param jit_request_name: The name of the JIT request. + :type jit_request_name: str + :param parameters: Parameters supplied to the update JIT request. + :type parameters: ~azure.mgmt.managedapplication.v2021_07_01.models.JitRequestPatchable + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JitRequestDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.managedapplication.v2021_07_01.models.JitRequestDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JitRequestDefinition"] + 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, 'JitRequestPatchable') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + jit_request_name=jit_request_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('JitRequestDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/jitRequests/{jitRequestName}'} # type: ignore + + + @distributed_trace_async + async def delete( + self, + resource_group_name: str, + jit_request_name: str, + **kwargs: Any + ) -> None: + """Deletes the JIT request. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param jit_request_name: The name of the JIT request. + :type jit_request_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, + jit_request_name=jit_request_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/jitRequests/{jitRequestName}'} # type: ignore + + + @distributed_trace_async + async def list_by_subscription( + self, + **kwargs: Any + ) -> "_models.JitRequestDefinitionListResult": + """Retrieves all JIT requests within the subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JitRequestDefinitionListResult, or the result of cls(response) + :rtype: ~azure.mgmt.managedapplication.v2021_07_01.models.JitRequestDefinitionListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JitRequestDefinitionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + 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) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('JitRequestDefinitionListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Solutions/jitRequests'} # type: ignore + + + @distributed_trace_async + async def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> "_models.JitRequestDefinitionListResult": + """Retrieves all JIT requests within the resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JitRequestDefinitionListResult, or the result of cls(response) + :rtype: ~azure.mgmt.managedapplication.v2021_07_01.models.JitRequestDefinitionListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JitRequestDefinitionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + 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) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('JitRequestDefinitionListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/jitRequests'} # type: ignore + diff --git a/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/models/__init__.py b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/models/__init__.py new file mode 100644 index 000000000000..355024a13707 --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/models/__init__.py @@ -0,0 +1,127 @@ +# 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 Application +from ._models_py3 import ApplicationArtifact +from ._models_py3 import ApplicationAuthorization +from ._models_py3 import ApplicationBillingDetailsDefinition +from ._models_py3 import ApplicationClientDetails +from ._models_py3 import ApplicationDefinition +from ._models_py3 import ApplicationDefinitionArtifact +from ._models_py3 import ApplicationDefinitionListResult +from ._models_py3 import ApplicationDefinitionPatchable +from ._models_py3 import ApplicationDeploymentPolicy +from ._models_py3 import ApplicationJitAccessPolicy +from ._models_py3 import ApplicationListResult +from ._models_py3 import ApplicationManagementPolicy +from ._models_py3 import ApplicationNotificationEndpoint +from ._models_py3 import ApplicationNotificationPolicy +from ._models_py3 import ApplicationPackageContact +from ._models_py3 import ApplicationPackageLockingPolicyDefinition +from ._models_py3 import ApplicationPackageSupportUrls +from ._models_py3 import ApplicationPatchable +from ._models_py3 import ApplicationPolicy +from ._models_py3 import ApplicationPropertiesPatchable +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import GenericResource +from ._models_py3 import Identity +from ._models_py3 import JitApproverDefinition +from ._models_py3 import JitAuthorizationPolicies +from ._models_py3 import JitRequestDefinition +from ._models_py3 import JitRequestDefinitionListResult +from ._models_py3 import JitRequestPatchable +from ._models_py3 import JitSchedulingPolicy +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import Plan +from ._models_py3 import PlanPatchable +from ._models_py3 import Resource +from ._models_py3 import Sku +from ._models_py3 import SystemData +from ._models_py3 import UserAssignedResourceIdentity + + +from ._application_client_enums import ( + ActionType, + ApplicationArtifactName, + ApplicationArtifactType, + ApplicationDefinitionArtifactName, + ApplicationLockLevel, + ApplicationManagementMode, + CreatedByType, + DeploymentMode, + JitApprovalMode, + JitApproverType, + JitRequestState, + JitSchedulingType, + Origin, + ProvisioningState, + ResourceIdentityType, +) + +__all__ = [ + 'Application', + 'ApplicationArtifact', + 'ApplicationAuthorization', + 'ApplicationBillingDetailsDefinition', + 'ApplicationClientDetails', + 'ApplicationDefinition', + 'ApplicationDefinitionArtifact', + 'ApplicationDefinitionListResult', + 'ApplicationDefinitionPatchable', + 'ApplicationDeploymentPolicy', + 'ApplicationJitAccessPolicy', + 'ApplicationListResult', + 'ApplicationManagementPolicy', + 'ApplicationNotificationEndpoint', + 'ApplicationNotificationPolicy', + 'ApplicationPackageContact', + 'ApplicationPackageLockingPolicyDefinition', + 'ApplicationPackageSupportUrls', + 'ApplicationPatchable', + 'ApplicationPolicy', + 'ApplicationPropertiesPatchable', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'GenericResource', + 'Identity', + 'JitApproverDefinition', + 'JitAuthorizationPolicies', + 'JitRequestDefinition', + 'JitRequestDefinitionListResult', + 'JitRequestPatchable', + 'JitSchedulingPolicy', + 'Operation', + 'OperationDisplay', + 'OperationListResult', + 'Plan', + 'PlanPatchable', + 'Resource', + 'Sku', + 'SystemData', + 'UserAssignedResourceIdentity', + 'ActionType', + 'ApplicationArtifactName', + 'ApplicationArtifactType', + 'ApplicationDefinitionArtifactName', + 'ApplicationLockLevel', + 'ApplicationManagementMode', + 'CreatedByType', + 'DeploymentMode', + 'JitApprovalMode', + 'JitApproverType', + 'JitRequestState', + 'JitSchedulingType', + 'Origin', + 'ProvisioningState', + 'ResourceIdentityType', +] diff --git a/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/models/_application_client_enums.py b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/models/_application_client_enums.py new file mode 100644 index 000000000000..bd5773717b5c --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/models/_application_client_enums.py @@ -0,0 +1,145 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum +from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta + + +class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + """ + + INTERNAL = "Internal" + +class ApplicationArtifactName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The managed application artifact name. + """ + + NOT_SPECIFIED = "NotSpecified" + VIEW_DEFINITION = "ViewDefinition" + AUTHORIZATIONS = "Authorizations" + CUSTOM_ROLE_DEFINITION = "CustomRoleDefinition" + +class ApplicationArtifactType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The managed application artifact type. + """ + + NOT_SPECIFIED = "NotSpecified" + TEMPLATE = "Template" + CUSTOM = "Custom" + +class ApplicationDefinitionArtifactName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The managed application artifact name. + """ + + NOT_SPECIFIED = "NotSpecified" + APPLICATION_RESOURCE_TEMPLATE = "ApplicationResourceTemplate" + CREATE_UI_DEFINITION = "CreateUiDefinition" + MAIN_TEMPLATE_PARAMETERS = "MainTemplateParameters" + +class ApplicationLockLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The managed application lock level. + """ + + CAN_NOT_DELETE = "CanNotDelete" + READ_ONLY = "ReadOnly" + NONE = "None" + +class ApplicationManagementMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The management mode. + """ + + NOT_SPECIFIED = "NotSpecified" + UNMANAGED = "Unmanaged" + MANAGED = "Managed" + +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class DeploymentMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The deployment mode. + """ + + NOT_SPECIFIED = "NotSpecified" + INCREMENTAL = "Incremental" + COMPLETE = "Complete" + +class JitApprovalMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The Jit approval mode. + """ + + NOT_SPECIFIED = "NotSpecified" + AUTO_APPROVE = "AutoApprove" + MANUAL_APPROVE = "ManualApprove" + +class JitApproverType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The approver type. + """ + + USER = "user" + GROUP = "group" + +class JitRequestState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The JIT request state. + """ + + NOT_SPECIFIED = "NotSpecified" + PENDING = "Pending" + APPROVED = "Approved" + DENIED = "Denied" + FAILED = "Failed" + CANCELED = "Canceled" + EXPIRED = "Expired" + TIMEOUT = "Timeout" + +class JitSchedulingType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The JIT request scheduling type. + """ + + NOT_SPECIFIED = "NotSpecified" + ONCE = "Once" + RECURRING = "Recurring" + +class Origin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is "user,system" + """ + + USER = "user" + SYSTEM = "system" + USER_SYSTEM = "user,system" + +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning status of the managed application. + """ + + NOT_SPECIFIED = "NotSpecified" + ACCEPTED = "Accepted" + RUNNING = "Running" + DELETING = "Deleting" + DELETED = "Deleted" + CANCELED = "Canceled" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + UPDATING = "Updating" + +class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The identity type. + """ + + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" + NONE = "None" diff --git a/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/models/_models_py3.py b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/models/_models_py3.py new file mode 100644 index 000000000000..7bebca2089b0 --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/models/_models_py3.py @@ -0,0 +1,2295 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Any, Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._application_client_enums import * + + +class Resource(msrest.serialization.Model): + """Resource information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.managedapplication.v2021_07_01.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'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}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + self.system_data = None + + +class GenericResource(Resource): + """Resource information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.managedapplication.v2021_07_01.models.SystemData + :ivar managed_by: ID of the resource that manages this resource. + :vartype managed_by: str + :ivar sku: The SKU of the resource. + :vartype sku: ~azure.mgmt.managedapplication.v2021_07_01.models.Sku + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'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}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + managed_by: Optional[str] = None, + sku: Optional["Sku"] = None, + **kwargs + ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword managed_by: ID of the resource that manages this resource. + :paramtype managed_by: str + :keyword sku: The SKU of the resource. + :paramtype sku: ~azure.mgmt.managedapplication.v2021_07_01.models.Sku + """ + super(GenericResource, self).__init__(location=location, tags=tags, **kwargs) + self.managed_by = managed_by + self.sku = sku + + +class Application(GenericResource): + """Information about managed application. + + 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: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.managedapplication.v2021_07_01.models.SystemData + :ivar managed_by: ID of the resource that manages this resource. + :vartype managed_by: str + :ivar sku: The SKU of the resource. + :vartype sku: ~azure.mgmt.managedapplication.v2021_07_01.models.Sku + :ivar plan: The plan information. + :vartype plan: ~azure.mgmt.managedapplication.v2021_07_01.models.Plan + :ivar kind: Required. The kind of the managed application. Allowed values are MarketPlace and + ServiceCatalog. + :vartype kind: str + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.managedapplication.v2021_07_01.models.Identity + :ivar managed_resource_group_id: The managed resource group Id. + :vartype managed_resource_group_id: str + :ivar application_definition_id: The fully qualified path of managed application definition Id. + :vartype application_definition_id: str + :ivar parameters: Name and value pairs that define the managed application parameters. It can + be a JObject or a well formed JSON string. + :vartype parameters: any + :ivar outputs: Name and value pairs that define the managed application outputs. + :vartype outputs: any + :ivar provisioning_state: The managed application provisioning state. Possible values include: + "NotSpecified", "Accepted", "Running", "Deleting", "Deleted", "Canceled", "Failed", + "Succeeded", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.managedapplication.v2021_07_01.models.ProvisioningState + :ivar billing_details: The managed application billing details. + :vartype billing_details: + ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationBillingDetailsDefinition + :ivar jit_access_policy: The managed application Jit access policy. + :vartype jit_access_policy: + ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationJitAccessPolicy + :ivar publisher_tenant_id: The publisher tenant Id. + :vartype publisher_tenant_id: str + :ivar authorizations: The read-only authorizations property that is retrieved from the + application package. + :vartype authorizations: + list[~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationAuthorization] + :ivar management_mode: The managed application management mode. Possible values include: + "NotSpecified", "Unmanaged", "Managed". + :vartype management_mode: str or + ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationManagementMode + :ivar customer_support: The read-only customer support property that is retrieved from the + application package. + :vartype customer_support: + ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationPackageContact + :ivar support_urls: The read-only support URLs property that is retrieved from the application + package. + :vartype support_urls: + ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationPackageSupportUrls + :ivar artifacts: The collection of managed application artifacts. + :vartype artifacts: list[~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationArtifact] + :ivar created_by: The client entity that created the JIT request. + :vartype created_by: ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationClientDetails + :ivar updated_by: The client entity that last updated the JIT request. + :vartype updated_by: ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationClientDetails + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'kind': {'required': True, 'pattern': r'^[-\w\._,\(\)]+$'}, + 'outputs': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'billing_details': {'readonly': True}, + 'publisher_tenant_id': {'readonly': True}, + 'authorizations': {'readonly': True}, + 'management_mode': {'readonly': True}, + 'customer_support': {'readonly': True}, + 'support_urls': {'readonly': True}, + 'artifacts': {'readonly': True}, + 'created_by': {'readonly': True}, + 'updated_by': {'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}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'plan': {'key': 'plan', 'type': 'Plan'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, + 'managed_resource_group_id': {'key': 'properties.managedResourceGroupId', 'type': 'str'}, + 'application_definition_id': {'key': 'properties.applicationDefinitionId', 'type': 'str'}, + 'parameters': {'key': 'properties.parameters', 'type': 'object'}, + 'outputs': {'key': 'properties.outputs', 'type': 'object'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'billing_details': {'key': 'properties.billingDetails', 'type': 'ApplicationBillingDetailsDefinition'}, + 'jit_access_policy': {'key': 'properties.jitAccessPolicy', 'type': 'ApplicationJitAccessPolicy'}, + 'publisher_tenant_id': {'key': 'properties.publisherTenantId', 'type': 'str'}, + 'authorizations': {'key': 'properties.authorizations', 'type': '[ApplicationAuthorization]'}, + 'management_mode': {'key': 'properties.managementMode', 'type': 'str'}, + 'customer_support': {'key': 'properties.customerSupport', 'type': 'ApplicationPackageContact'}, + 'support_urls': {'key': 'properties.supportUrls', 'type': 'ApplicationPackageSupportUrls'}, + 'artifacts': {'key': 'properties.artifacts', 'type': '[ApplicationArtifact]'}, + 'created_by': {'key': 'properties.createdBy', 'type': 'ApplicationClientDetails'}, + 'updated_by': {'key': 'properties.updatedBy', 'type': 'ApplicationClientDetails'}, + } + + def __init__( + self, + *, + kind: str, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + managed_by: Optional[str] = None, + sku: Optional["Sku"] = None, + plan: Optional["Plan"] = None, + identity: Optional["Identity"] = None, + managed_resource_group_id: Optional[str] = None, + application_definition_id: Optional[str] = None, + parameters: Optional[Any] = None, + jit_access_policy: Optional["ApplicationJitAccessPolicy"] = None, + **kwargs + ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword managed_by: ID of the resource that manages this resource. + :paramtype managed_by: str + :keyword sku: The SKU of the resource. + :paramtype sku: ~azure.mgmt.managedapplication.v2021_07_01.models.Sku + :keyword plan: The plan information. + :paramtype plan: ~azure.mgmt.managedapplication.v2021_07_01.models.Plan + :keyword kind: Required. The kind of the managed application. Allowed values are MarketPlace + and ServiceCatalog. + :paramtype kind: str + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.managedapplication.v2021_07_01.models.Identity + :keyword managed_resource_group_id: The managed resource group Id. + :paramtype managed_resource_group_id: str + :keyword application_definition_id: The fully qualified path of managed application definition + Id. + :paramtype application_definition_id: str + :keyword parameters: Name and value pairs that define the managed application parameters. It + can be a JObject or a well formed JSON string. + :paramtype parameters: any + :keyword jit_access_policy: The managed application Jit access policy. + :paramtype jit_access_policy: + ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationJitAccessPolicy + """ + super(Application, self).__init__(location=location, tags=tags, managed_by=managed_by, sku=sku, **kwargs) + self.plan = plan + self.kind = kind + self.identity = identity + self.managed_resource_group_id = managed_resource_group_id + self.application_definition_id = application_definition_id + self.parameters = parameters + self.outputs = None + self.provisioning_state = None + self.billing_details = None + self.jit_access_policy = jit_access_policy + self.publisher_tenant_id = None + self.authorizations = None + self.management_mode = None + self.customer_support = None + self.support_urls = None + self.artifacts = None + self.created_by = None + self.updated_by = None + + +class ApplicationArtifact(msrest.serialization.Model): + """Managed application artifact. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. The managed application artifact name. Possible values include: + "NotSpecified", "ViewDefinition", "Authorizations", "CustomRoleDefinition". + :vartype name: str or ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationArtifactName + :ivar uri: Required. The managed application artifact blob uri. + :vartype uri: str + :ivar type: Required. The managed application artifact type. Possible values include: + "NotSpecified", "Template", "Custom". + :vartype type: str or ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationArtifactType + """ + + _validation = { + 'name': {'required': True}, + 'uri': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'uri': {'key': 'uri', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Union[str, "ApplicationArtifactName"], + uri: str, + type: Union[str, "ApplicationArtifactType"], + **kwargs + ): + """ + :keyword name: Required. The managed application artifact name. Possible values include: + "NotSpecified", "ViewDefinition", "Authorizations", "CustomRoleDefinition". + :paramtype name: str or + ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationArtifactName + :keyword uri: Required. The managed application artifact blob uri. + :paramtype uri: str + :keyword type: Required. The managed application artifact type. Possible values include: + "NotSpecified", "Template", "Custom". + :paramtype type: str or + ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationArtifactType + """ + super(ApplicationArtifact, self).__init__(**kwargs) + self.name = name + self.uri = uri + self.type = type + + +class ApplicationAuthorization(msrest.serialization.Model): + """The managed application provider authorization. + + All required parameters must be populated in order to send to Azure. + + :ivar principal_id: Required. The provider's principal identifier. This is the identity that + the provider will use to call ARM to manage the managed application resources. + :vartype principal_id: str + :ivar role_definition_id: Required. The provider's role definition identifier. This role will + define all the permissions that the provider must have on the managed application's container + resource group. This role definition cannot have permission to delete the resource group. + :vartype role_definition_id: str + """ + + _validation = { + 'principal_id': {'required': True}, + 'role_definition_id': {'required': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'role_definition_id': {'key': 'roleDefinitionId', 'type': 'str'}, + } + + def __init__( + self, + *, + principal_id: str, + role_definition_id: str, + **kwargs + ): + """ + :keyword principal_id: Required. The provider's principal identifier. This is the identity that + the provider will use to call ARM to manage the managed application resources. + :paramtype principal_id: str + :keyword role_definition_id: Required. The provider's role definition identifier. This role + will define all the permissions that the provider must have on the managed application's + container resource group. This role definition cannot have permission to delete the resource + group. + :paramtype role_definition_id: str + """ + super(ApplicationAuthorization, self).__init__(**kwargs) + self.principal_id = principal_id + self.role_definition_id = role_definition_id + + +class ApplicationBillingDetailsDefinition(msrest.serialization.Model): + """Managed application billing details definition. + + :ivar resource_usage_id: The managed application resource usage Id. + :vartype resource_usage_id: str + """ + + _attribute_map = { + 'resource_usage_id': {'key': 'resourceUsageId', 'type': 'str'}, + } + + def __init__( + self, + *, + resource_usage_id: Optional[str] = None, + **kwargs + ): + """ + :keyword resource_usage_id: The managed application resource usage Id. + :paramtype resource_usage_id: str + """ + super(ApplicationBillingDetailsDefinition, self).__init__(**kwargs) + self.resource_usage_id = resource_usage_id + + +class ApplicationClientDetails(msrest.serialization.Model): + """The application client details to track the entity creating/updating the managed app resource. + + :ivar oid: The client Oid. + :vartype oid: str + :ivar puid: The client Puid. + :vartype puid: str + :ivar application_id: The client application Id. + :vartype application_id: str + """ + + _attribute_map = { + 'oid': {'key': 'oid', 'type': 'str'}, + 'puid': {'key': 'puid', 'type': 'str'}, + 'application_id': {'key': 'applicationId', 'type': 'str'}, + } + + def __init__( + self, + *, + oid: Optional[str] = None, + puid: Optional[str] = None, + application_id: Optional[str] = None, + **kwargs + ): + """ + :keyword oid: The client Oid. + :paramtype oid: str + :keyword puid: The client Puid. + :paramtype puid: str + :keyword application_id: The client application Id. + :paramtype application_id: str + """ + super(ApplicationClientDetails, self).__init__(**kwargs) + self.oid = oid + self.puid = puid + self.application_id = application_id + + +class ApplicationDefinition(GenericResource): + """Information about managed application definition. + + 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: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.managedapplication.v2021_07_01.models.SystemData + :ivar managed_by: ID of the resource that manages this resource. + :vartype managed_by: str + :ivar sku: The SKU of the resource. + :vartype sku: ~azure.mgmt.managedapplication.v2021_07_01.models.Sku + :ivar lock_level: Required. The managed application lock level. Possible values include: + "CanNotDelete", "ReadOnly", "None". + :vartype lock_level: str or + ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationLockLevel + :ivar display_name: The managed application definition display name. + :vartype display_name: str + :ivar is_enabled: A value indicating whether the package is enabled or not. + :vartype is_enabled: bool + :ivar authorizations: The managed application provider authorizations. + :vartype authorizations: + list[~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationAuthorization] + :ivar artifacts: The collection of managed application artifacts. The portal will use the files + specified as artifacts to construct the user experience of creating a managed application from + a managed application definition. + :vartype artifacts: + list[~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationDefinitionArtifact] + :ivar provisioning_state: Provisioning state. Possible values include: "NotSpecified", + "Accepted", "Running", "Deleting", "Deleted", "Canceled", "Failed", "Succeeded", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.managedapplication.v2021_07_01.models.ProvisioningState + :ivar description: The managed application definition description. + :vartype description: str + :ivar package_file_uri: The managed application definition package file Uri. Use this element. + :vartype package_file_uri: str + :ivar storage_account_id: The storage account id for bring your own storage scenario. + :vartype storage_account_id: str + :ivar main_template: The inline main template json which has resources to be provisioned. It + can be a JObject or well-formed JSON string. + :vartype main_template: any + :ivar create_ui_definition: The createUiDefinition json for the backing template with + Microsoft.Solutions/applications resource. It can be a JObject or well-formed JSON string. + :vartype create_ui_definition: any + :ivar notification_policy: The managed application notification policy. + :vartype notification_policy: + ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationNotificationPolicy + :ivar locking_policy: The managed application locking policy. + :vartype locking_policy: + ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationPackageLockingPolicyDefinition + :ivar deployment_policy: The managed application deployment policy. + :vartype deployment_policy: + ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationDeploymentPolicy + :ivar management_policy: The managed application management policy that determines publisher's + access to the managed resource group. + :vartype management_policy: + ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationManagementPolicy + :ivar policies: The managed application provider policies. + :vartype policies: list[~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationPolicy] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'lock_level': {'required': True}, + 'provisioning_state': {'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}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'lock_level': {'key': 'properties.lockLevel', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, + 'authorizations': {'key': 'properties.authorizations', 'type': '[ApplicationAuthorization]'}, + 'artifacts': {'key': 'properties.artifacts', 'type': '[ApplicationDefinitionArtifact]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'package_file_uri': {'key': 'properties.packageFileUri', 'type': 'str'}, + 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, + 'main_template': {'key': 'properties.mainTemplate', 'type': 'object'}, + 'create_ui_definition': {'key': 'properties.createUiDefinition', 'type': 'object'}, + 'notification_policy': {'key': 'properties.notificationPolicy', 'type': 'ApplicationNotificationPolicy'}, + 'locking_policy': {'key': 'properties.lockingPolicy', 'type': 'ApplicationPackageLockingPolicyDefinition'}, + 'deployment_policy': {'key': 'properties.deploymentPolicy', 'type': 'ApplicationDeploymentPolicy'}, + 'management_policy': {'key': 'properties.managementPolicy', 'type': 'ApplicationManagementPolicy'}, + 'policies': {'key': 'properties.policies', 'type': '[ApplicationPolicy]'}, + } + + def __init__( + self, + *, + lock_level: Union[str, "ApplicationLockLevel"], + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + managed_by: Optional[str] = None, + sku: Optional["Sku"] = None, + display_name: Optional[str] = None, + is_enabled: Optional[bool] = None, + authorizations: Optional[List["ApplicationAuthorization"]] = None, + artifacts: Optional[List["ApplicationDefinitionArtifact"]] = None, + description: Optional[str] = None, + package_file_uri: Optional[str] = None, + storage_account_id: Optional[str] = None, + main_template: Optional[Any] = None, + create_ui_definition: Optional[Any] = None, + notification_policy: Optional["ApplicationNotificationPolicy"] = None, + locking_policy: Optional["ApplicationPackageLockingPolicyDefinition"] = None, + deployment_policy: Optional["ApplicationDeploymentPolicy"] = None, + management_policy: Optional["ApplicationManagementPolicy"] = None, + policies: Optional[List["ApplicationPolicy"]] = None, + **kwargs + ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword managed_by: ID of the resource that manages this resource. + :paramtype managed_by: str + :keyword sku: The SKU of the resource. + :paramtype sku: ~azure.mgmt.managedapplication.v2021_07_01.models.Sku + :keyword lock_level: Required. The managed application lock level. Possible values include: + "CanNotDelete", "ReadOnly", "None". + :paramtype lock_level: str or + ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationLockLevel + :keyword display_name: The managed application definition display name. + :paramtype display_name: str + :keyword is_enabled: A value indicating whether the package is enabled or not. + :paramtype is_enabled: bool + :keyword authorizations: The managed application provider authorizations. + :paramtype authorizations: + list[~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationAuthorization] + :keyword artifacts: The collection of managed application artifacts. The portal will use the + files specified as artifacts to construct the user experience of creating a managed application + from a managed application definition. + :paramtype artifacts: + list[~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationDefinitionArtifact] + :keyword description: The managed application definition description. + :paramtype description: str + :keyword package_file_uri: The managed application definition package file Uri. Use this + element. + :paramtype package_file_uri: str + :keyword storage_account_id: The storage account id for bring your own storage scenario. + :paramtype storage_account_id: str + :keyword main_template: The inline main template json which has resources to be provisioned. It + can be a JObject or well-formed JSON string. + :paramtype main_template: any + :keyword create_ui_definition: The createUiDefinition json for the backing template with + Microsoft.Solutions/applications resource. It can be a JObject or well-formed JSON string. + :paramtype create_ui_definition: any + :keyword notification_policy: The managed application notification policy. + :paramtype notification_policy: + ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationNotificationPolicy + :keyword locking_policy: The managed application locking policy. + :paramtype locking_policy: + ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationPackageLockingPolicyDefinition + :keyword deployment_policy: The managed application deployment policy. + :paramtype deployment_policy: + ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationDeploymentPolicy + :keyword management_policy: The managed application management policy that determines + publisher's access to the managed resource group. + :paramtype management_policy: + ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationManagementPolicy + :keyword policies: The managed application provider policies. + :paramtype policies: list[~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationPolicy] + """ + super(ApplicationDefinition, self).__init__(location=location, tags=tags, managed_by=managed_by, sku=sku, **kwargs) + self.lock_level = lock_level + self.display_name = display_name + self.is_enabled = is_enabled + self.authorizations = authorizations + self.artifacts = artifacts + self.provisioning_state = None + self.description = description + self.package_file_uri = package_file_uri + self.storage_account_id = storage_account_id + self.main_template = main_template + self.create_ui_definition = create_ui_definition + self.notification_policy = notification_policy + self.locking_policy = locking_policy + self.deployment_policy = deployment_policy + self.management_policy = management_policy + self.policies = policies + + +class ApplicationDefinitionArtifact(msrest.serialization.Model): + """Application definition artifact. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. The managed application definition artifact name. Possible values + include: "NotSpecified", "ApplicationResourceTemplate", "CreateUiDefinition", + "MainTemplateParameters". + :vartype name: str or + ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationDefinitionArtifactName + :ivar uri: Required. The managed application definition artifact blob uri. + :vartype uri: str + :ivar type: Required. The managed application definition artifact type. Possible values + include: "NotSpecified", "Template", "Custom". + :vartype type: str or ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationArtifactType + """ + + _validation = { + 'name': {'required': True}, + 'uri': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'uri': {'key': 'uri', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Union[str, "ApplicationDefinitionArtifactName"], + uri: str, + type: Union[str, "ApplicationArtifactType"], + **kwargs + ): + """ + :keyword name: Required. The managed application definition artifact name. Possible values + include: "NotSpecified", "ApplicationResourceTemplate", "CreateUiDefinition", + "MainTemplateParameters". + :paramtype name: str or + ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationDefinitionArtifactName + :keyword uri: Required. The managed application definition artifact blob uri. + :paramtype uri: str + :keyword type: Required. The managed application definition artifact type. Possible values + include: "NotSpecified", "Template", "Custom". + :paramtype type: str or + ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationArtifactType + """ + super(ApplicationDefinitionArtifact, self).__init__(**kwargs) + self.name = name + self.uri = uri + self.type = type + + +class ApplicationDefinitionListResult(msrest.serialization.Model): + """List of managed application definitions. + + :ivar value: The array of managed application definitions. + :vartype value: list[~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationDefinition] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ApplicationDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ApplicationDefinition"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The array of managed application definitions. + :paramtype value: list[~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationDefinition] + :keyword next_link: The URL to use for getting the next set of results. + :paramtype next_link: str + """ + super(ApplicationDefinitionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ApplicationDefinitionPatchable(msrest.serialization.Model): + """Information about an application definition request. + + :ivar tags: A set of tags. Application definition tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Application definition tags. + :paramtype tags: dict[str, str] + """ + super(ApplicationDefinitionPatchable, self).__init__(**kwargs) + self.tags = tags + + +class ApplicationDeploymentPolicy(msrest.serialization.Model): + """Managed application deployment policy. + + All required parameters must be populated in order to send to Azure. + + :ivar deployment_mode: Required. The managed application deployment mode. Possible values + include: "NotSpecified", "Incremental", "Complete". + :vartype deployment_mode: str or + ~azure.mgmt.managedapplication.v2021_07_01.models.DeploymentMode + """ + + _validation = { + 'deployment_mode': {'required': True}, + } + + _attribute_map = { + 'deployment_mode': {'key': 'deploymentMode', 'type': 'str'}, + } + + def __init__( + self, + *, + deployment_mode: Union[str, "DeploymentMode"], + **kwargs + ): + """ + :keyword deployment_mode: Required. The managed application deployment mode. Possible values + include: "NotSpecified", "Incremental", "Complete". + :paramtype deployment_mode: str or + ~azure.mgmt.managedapplication.v2021_07_01.models.DeploymentMode + """ + super(ApplicationDeploymentPolicy, self).__init__(**kwargs) + self.deployment_mode = deployment_mode + + +class ApplicationJitAccessPolicy(msrest.serialization.Model): + """Managed application Jit access policy. + + All required parameters must be populated in order to send to Azure. + + :ivar jit_access_enabled: Required. Whether the JIT access is enabled. + :vartype jit_access_enabled: bool + :ivar jit_approval_mode: JIT approval mode. Possible values include: "NotSpecified", + "AutoApprove", "ManualApprove". + :vartype jit_approval_mode: str or + ~azure.mgmt.managedapplication.v2021_07_01.models.JitApprovalMode + :ivar jit_approvers: The JIT approvers. + :vartype jit_approvers: + list[~azure.mgmt.managedapplication.v2021_07_01.models.JitApproverDefinition] + :ivar maximum_jit_access_duration: The maximum duration JIT access is granted. This is an + ISO8601 time period value. + :vartype maximum_jit_access_duration: str + """ + + _validation = { + 'jit_access_enabled': {'required': True}, + } + + _attribute_map = { + 'jit_access_enabled': {'key': 'jitAccessEnabled', 'type': 'bool'}, + 'jit_approval_mode': {'key': 'jitApprovalMode', 'type': 'str'}, + 'jit_approvers': {'key': 'jitApprovers', 'type': '[JitApproverDefinition]'}, + 'maximum_jit_access_duration': {'key': 'maximumJitAccessDuration', 'type': 'str'}, + } + + def __init__( + self, + *, + jit_access_enabled: bool, + jit_approval_mode: Optional[Union[str, "JitApprovalMode"]] = None, + jit_approvers: Optional[List["JitApproverDefinition"]] = None, + maximum_jit_access_duration: Optional[str] = None, + **kwargs + ): + """ + :keyword jit_access_enabled: Required. Whether the JIT access is enabled. + :paramtype jit_access_enabled: bool + :keyword jit_approval_mode: JIT approval mode. Possible values include: "NotSpecified", + "AutoApprove", "ManualApprove". + :paramtype jit_approval_mode: str or + ~azure.mgmt.managedapplication.v2021_07_01.models.JitApprovalMode + :keyword jit_approvers: The JIT approvers. + :paramtype jit_approvers: + list[~azure.mgmt.managedapplication.v2021_07_01.models.JitApproverDefinition] + :keyword maximum_jit_access_duration: The maximum duration JIT access is granted. This is an + ISO8601 time period value. + :paramtype maximum_jit_access_duration: str + """ + super(ApplicationJitAccessPolicy, self).__init__(**kwargs) + self.jit_access_enabled = jit_access_enabled + self.jit_approval_mode = jit_approval_mode + self.jit_approvers = jit_approvers + self.maximum_jit_access_duration = maximum_jit_access_duration + + +class ApplicationListResult(msrest.serialization.Model): + """List of managed applications. + + :ivar value: The array of managed applications. + :vartype value: list[~azure.mgmt.managedapplication.v2021_07_01.models.Application] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Application]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Application"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The array of managed applications. + :paramtype value: list[~azure.mgmt.managedapplication.v2021_07_01.models.Application] + :keyword next_link: The URL to use for getting the next set of results. + :paramtype next_link: str + """ + super(ApplicationListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ApplicationManagementPolicy(msrest.serialization.Model): + """Managed application management policy. + + :ivar mode: The managed application management mode. Possible values include: "NotSpecified", + "Unmanaged", "Managed". + :vartype mode: str or + ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationManagementMode + """ + + _attribute_map = { + 'mode': {'key': 'mode', 'type': 'str'}, + } + + def __init__( + self, + *, + mode: Optional[Union[str, "ApplicationManagementMode"]] = None, + **kwargs + ): + """ + :keyword mode: The managed application management mode. Possible values include: + "NotSpecified", "Unmanaged", "Managed". + :paramtype mode: str or + ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationManagementMode + """ + super(ApplicationManagementPolicy, self).__init__(**kwargs) + self.mode = mode + + +class ApplicationNotificationEndpoint(msrest.serialization.Model): + """Managed application notification endpoint. + + All required parameters must be populated in order to send to Azure. + + :ivar uri: Required. The managed application notification endpoint uri. + :vartype uri: str + """ + + _validation = { + 'uri': {'required': True}, + } + + _attribute_map = { + 'uri': {'key': 'uri', 'type': 'str'}, + } + + def __init__( + self, + *, + uri: str, + **kwargs + ): + """ + :keyword uri: Required. The managed application notification endpoint uri. + :paramtype uri: str + """ + super(ApplicationNotificationEndpoint, self).__init__(**kwargs) + self.uri = uri + + +class ApplicationNotificationPolicy(msrest.serialization.Model): + """Managed application notification policy. + + All required parameters must be populated in order to send to Azure. + + :ivar notification_endpoints: Required. The managed application notification endpoint. + :vartype notification_endpoints: + list[~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationNotificationEndpoint] + """ + + _validation = { + 'notification_endpoints': {'required': True}, + } + + _attribute_map = { + 'notification_endpoints': {'key': 'notificationEndpoints', 'type': '[ApplicationNotificationEndpoint]'}, + } + + def __init__( + self, + *, + notification_endpoints: List["ApplicationNotificationEndpoint"], + **kwargs + ): + """ + :keyword notification_endpoints: Required. The managed application notification endpoint. + :paramtype notification_endpoints: + list[~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationNotificationEndpoint] + """ + super(ApplicationNotificationPolicy, self).__init__(**kwargs) + self.notification_endpoints = notification_endpoints + + +class ApplicationPackageContact(msrest.serialization.Model): + """The application package contact information. + + All required parameters must be populated in order to send to Azure. + + :ivar contact_name: The contact name. + :vartype contact_name: str + :ivar email: Required. The contact email. + :vartype email: str + :ivar phone: Required. The contact phone number. + :vartype phone: str + """ + + _validation = { + 'email': {'required': True}, + 'phone': {'required': True}, + } + + _attribute_map = { + 'contact_name': {'key': 'contactName', 'type': 'str'}, + 'email': {'key': 'email', 'type': 'str'}, + 'phone': {'key': 'phone', 'type': 'str'}, + } + + def __init__( + self, + *, + email: str, + phone: str, + contact_name: Optional[str] = None, + **kwargs + ): + """ + :keyword contact_name: The contact name. + :paramtype contact_name: str + :keyword email: Required. The contact email. + :paramtype email: str + :keyword phone: Required. The contact phone number. + :paramtype phone: str + """ + super(ApplicationPackageContact, self).__init__(**kwargs) + self.contact_name = contact_name + self.email = email + self.phone = phone + + +class ApplicationPackageLockingPolicyDefinition(msrest.serialization.Model): + """Managed application locking policy. + + :ivar allowed_actions: The deny assignment excluded actions. + :vartype allowed_actions: list[str] + :ivar allowed_data_actions: The deny assignment excluded data actions. + :vartype allowed_data_actions: list[str] + """ + + _attribute_map = { + 'allowed_actions': {'key': 'allowedActions', 'type': '[str]'}, + 'allowed_data_actions': {'key': 'allowedDataActions', 'type': '[str]'}, + } + + def __init__( + self, + *, + allowed_actions: Optional[List[str]] = None, + allowed_data_actions: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword allowed_actions: The deny assignment excluded actions. + :paramtype allowed_actions: list[str] + :keyword allowed_data_actions: The deny assignment excluded data actions. + :paramtype allowed_data_actions: list[str] + """ + super(ApplicationPackageLockingPolicyDefinition, self).__init__(**kwargs) + self.allowed_actions = allowed_actions + self.allowed_data_actions = allowed_data_actions + + +class ApplicationPackageSupportUrls(msrest.serialization.Model): + """The appliance package support URLs. + + :ivar public_azure: The public azure support URL. + :vartype public_azure: str + :ivar government_cloud: The government cloud support URL. + :vartype government_cloud: str + """ + + _attribute_map = { + 'public_azure': {'key': 'publicAzure', 'type': 'str'}, + 'government_cloud': {'key': 'governmentCloud', 'type': 'str'}, + } + + def __init__( + self, + *, + public_azure: Optional[str] = None, + government_cloud: Optional[str] = None, + **kwargs + ): + """ + :keyword public_azure: The public azure support URL. + :paramtype public_azure: str + :keyword government_cloud: The government cloud support URL. + :paramtype government_cloud: str + """ + super(ApplicationPackageSupportUrls, self).__init__(**kwargs) + self.public_azure = public_azure + self.government_cloud = government_cloud + + +class ApplicationPatchable(GenericResource): + """Information about managed application. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.managedapplication.v2021_07_01.models.SystemData + :ivar managed_by: ID of the resource that manages this resource. + :vartype managed_by: str + :ivar sku: The SKU of the resource. + :vartype sku: ~azure.mgmt.managedapplication.v2021_07_01.models.Sku + :ivar plan: The plan information. + :vartype plan: ~azure.mgmt.managedapplication.v2021_07_01.models.PlanPatchable + :ivar kind: The kind of the managed application. Allowed values are MarketPlace and + ServiceCatalog. + :vartype kind: str + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.managedapplication.v2021_07_01.models.Identity + :ivar managed_resource_group_id: The managed resource group Id. + :vartype managed_resource_group_id: str + :ivar application_definition_id: The fully qualified path of managed application definition Id. + :vartype application_definition_id: str + :ivar parameters: Name and value pairs that define the managed application parameters. It can + be a JObject or a well formed JSON string. + :vartype parameters: any + :ivar outputs: Name and value pairs that define the managed application outputs. + :vartype outputs: any + :ivar provisioning_state: The managed application provisioning state. Possible values include: + "NotSpecified", "Accepted", "Running", "Deleting", "Deleted", "Canceled", "Failed", + "Succeeded", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.managedapplication.v2021_07_01.models.ProvisioningState + :ivar billing_details: The managed application billing details. + :vartype billing_details: + ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationBillingDetailsDefinition + :ivar jit_access_policy: The managed application Jit access policy. + :vartype jit_access_policy: + ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationJitAccessPolicy + :ivar publisher_tenant_id: The publisher tenant Id. + :vartype publisher_tenant_id: str + :ivar authorizations: The read-only authorizations property that is retrieved from the + application package. + :vartype authorizations: + list[~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationAuthorization] + :ivar management_mode: The managed application management mode. Possible values include: + "NotSpecified", "Unmanaged", "Managed". + :vartype management_mode: str or + ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationManagementMode + :ivar customer_support: The read-only customer support property that is retrieved from the + application package. + :vartype customer_support: + ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationPackageContact + :ivar support_urls: The read-only support URLs property that is retrieved from the application + package. + :vartype support_urls: + ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationPackageSupportUrls + :ivar artifacts: The collection of managed application artifacts. + :vartype artifacts: list[~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationArtifact] + :ivar created_by: The client entity that created the JIT request. + :vartype created_by: ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationClientDetails + :ivar updated_by: The client entity that last updated the JIT request. + :vartype updated_by: ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationClientDetails + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'kind': {'pattern': r'^[-\w\._,\(\)]+$'}, + 'outputs': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'billing_details': {'readonly': True}, + 'publisher_tenant_id': {'readonly': True}, + 'authorizations': {'readonly': True}, + 'management_mode': {'readonly': True}, + 'customer_support': {'readonly': True}, + 'support_urls': {'readonly': True}, + 'artifacts': {'readonly': True}, + 'created_by': {'readonly': True}, + 'updated_by': {'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}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'plan': {'key': 'plan', 'type': 'PlanPatchable'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, + 'managed_resource_group_id': {'key': 'properties.managedResourceGroupId', 'type': 'str'}, + 'application_definition_id': {'key': 'properties.applicationDefinitionId', 'type': 'str'}, + 'parameters': {'key': 'properties.parameters', 'type': 'object'}, + 'outputs': {'key': 'properties.outputs', 'type': 'object'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'billing_details': {'key': 'properties.billingDetails', 'type': 'ApplicationBillingDetailsDefinition'}, + 'jit_access_policy': {'key': 'properties.jitAccessPolicy', 'type': 'ApplicationJitAccessPolicy'}, + 'publisher_tenant_id': {'key': 'properties.publisherTenantId', 'type': 'str'}, + 'authorizations': {'key': 'properties.authorizations', 'type': '[ApplicationAuthorization]'}, + 'management_mode': {'key': 'properties.managementMode', 'type': 'str'}, + 'customer_support': {'key': 'properties.customerSupport', 'type': 'ApplicationPackageContact'}, + 'support_urls': {'key': 'properties.supportUrls', 'type': 'ApplicationPackageSupportUrls'}, + 'artifacts': {'key': 'properties.artifacts', 'type': '[ApplicationArtifact]'}, + 'created_by': {'key': 'properties.createdBy', 'type': 'ApplicationClientDetails'}, + 'updated_by': {'key': 'properties.updatedBy', 'type': 'ApplicationClientDetails'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + managed_by: Optional[str] = None, + sku: Optional["Sku"] = None, + plan: Optional["PlanPatchable"] = None, + kind: Optional[str] = None, + identity: Optional["Identity"] = None, + managed_resource_group_id: Optional[str] = None, + application_definition_id: Optional[str] = None, + parameters: Optional[Any] = None, + jit_access_policy: Optional["ApplicationJitAccessPolicy"] = None, + **kwargs + ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword managed_by: ID of the resource that manages this resource. + :paramtype managed_by: str + :keyword sku: The SKU of the resource. + :paramtype sku: ~azure.mgmt.managedapplication.v2021_07_01.models.Sku + :keyword plan: The plan information. + :paramtype plan: ~azure.mgmt.managedapplication.v2021_07_01.models.PlanPatchable + :keyword kind: The kind of the managed application. Allowed values are MarketPlace and + ServiceCatalog. + :paramtype kind: str + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.managedapplication.v2021_07_01.models.Identity + :keyword managed_resource_group_id: The managed resource group Id. + :paramtype managed_resource_group_id: str + :keyword application_definition_id: The fully qualified path of managed application definition + Id. + :paramtype application_definition_id: str + :keyword parameters: Name and value pairs that define the managed application parameters. It + can be a JObject or a well formed JSON string. + :paramtype parameters: any + :keyword jit_access_policy: The managed application Jit access policy. + :paramtype jit_access_policy: + ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationJitAccessPolicy + """ + super(ApplicationPatchable, self).__init__(location=location, tags=tags, managed_by=managed_by, sku=sku, **kwargs) + self.plan = plan + self.kind = kind + self.identity = identity + self.managed_resource_group_id = managed_resource_group_id + self.application_definition_id = application_definition_id + self.parameters = parameters + self.outputs = None + self.provisioning_state = None + self.billing_details = None + self.jit_access_policy = jit_access_policy + self.publisher_tenant_id = None + self.authorizations = None + self.management_mode = None + self.customer_support = None + self.support_urls = None + self.artifacts = None + self.created_by = None + self.updated_by = None + + +class ApplicationPolicy(msrest.serialization.Model): + """Managed application policy. + + :ivar name: The policy name. + :vartype name: str + :ivar policy_definition_id: The policy definition Id. + :vartype policy_definition_id: str + :ivar parameters: The policy parameters. + :vartype parameters: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'policy_definition_id': {'key': 'policyDefinitionId', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + policy_definition_id: Optional[str] = None, + parameters: Optional[str] = None, + **kwargs + ): + """ + :keyword name: The policy name. + :paramtype name: str + :keyword policy_definition_id: The policy definition Id. + :paramtype policy_definition_id: str + :keyword parameters: The policy parameters. + :paramtype parameters: str + """ + super(ApplicationPolicy, self).__init__(**kwargs) + self.name = name + self.policy_definition_id = policy_definition_id + self.parameters = parameters + + +class ApplicationPropertiesPatchable(msrest.serialization.Model): + """The managed application properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar managed_resource_group_id: The managed resource group Id. + :vartype managed_resource_group_id: str + :ivar application_definition_id: The fully qualified path of managed application definition Id. + :vartype application_definition_id: str + :ivar parameters: Name and value pairs that define the managed application parameters. It can + be a JObject or a well formed JSON string. + :vartype parameters: any + :ivar outputs: Name and value pairs that define the managed application outputs. + :vartype outputs: any + :ivar provisioning_state: The managed application provisioning state. Possible values include: + "NotSpecified", "Accepted", "Running", "Deleting", "Deleted", "Canceled", "Failed", + "Succeeded", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.managedapplication.v2021_07_01.models.ProvisioningState + """ + + _validation = { + 'outputs': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'managed_resource_group_id': {'key': 'managedResourceGroupId', 'type': 'str'}, + 'application_definition_id': {'key': 'applicationDefinitionId', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': 'object'}, + 'outputs': {'key': 'outputs', 'type': 'object'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + managed_resource_group_id: Optional[str] = None, + application_definition_id: Optional[str] = None, + parameters: Optional[Any] = None, + **kwargs + ): + """ + :keyword managed_resource_group_id: The managed resource group Id. + :paramtype managed_resource_group_id: str + :keyword application_definition_id: The fully qualified path of managed application definition + Id. + :paramtype application_definition_id: str + :keyword parameters: Name and value pairs that define the managed application parameters. It + can be a JObject or a well formed JSON string. + :paramtype parameters: any + """ + super(ApplicationPropertiesPatchable, self).__init__(**kwargs) + self.managed_resource_group_id = managed_resource_group_id + self.application_definition_id = application_definition_id + self.parameters = parameters + self.outputs = None + self.provisioning_state = None + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(msrest.serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.managedapplication.v2021_07_01.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.managedapplication.v2021_07_01.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + :ivar error: The error object. + :vartype error: ~azure.mgmt.managedapplication.v2021_07_01.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDetail"] = None, + **kwargs + ): + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.managedapplication.v2021_07_01.models.ErrorDetail + """ + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class Identity(msrest.serialization.Model): + """Identity for the resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :ivar type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", + "SystemAssigned, UserAssigned", "None". + :vartype type: str or ~azure.mgmt.managedapplication.v2021_07_01.models.ResourceIdentityType + :ivar user_assigned_identities: The list of user identities associated with the resource. The + user identity dictionary key references will be resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.managedapplication.v2021_07_01.models.UserAssignedResourceIdentity] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedResourceIdentity}'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "UserAssignedResourceIdentity"]] = None, + **kwargs + ): + """ + :keyword type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", + "SystemAssigned, UserAssigned", "None". + :paramtype type: str or ~azure.mgmt.managedapplication.v2021_07_01.models.ResourceIdentityType + :keyword user_assigned_identities: The list of user identities associated with the resource. + The user identity dictionary key references will be resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.managedapplication.v2021_07_01.models.UserAssignedResourceIdentity] + """ + super(Identity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class JitApproverDefinition(msrest.serialization.Model): + """JIT approver definition. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Required. The approver service principal Id. + :vartype id: str + :ivar type: The approver type. Possible values include: "user", "group". + :vartype type: str or ~azure.mgmt.managedapplication.v2021_07_01.models.JitApproverType + :ivar display_name: The approver display name. + :vartype display_name: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + } + + def __init__( + self, + *, + id: str, + type: Optional[Union[str, "JitApproverType"]] = None, + display_name: Optional[str] = None, + **kwargs + ): + """ + :keyword id: Required. The approver service principal Id. + :paramtype id: str + :keyword type: The approver type. Possible values include: "user", "group". + :paramtype type: str or ~azure.mgmt.managedapplication.v2021_07_01.models.JitApproverType + :keyword display_name: The approver display name. + :paramtype display_name: str + """ + super(JitApproverDefinition, self).__init__(**kwargs) + self.id = id + self.type = type + self.display_name = display_name + + +class JitAuthorizationPolicies(msrest.serialization.Model): + """The JIT authorization policies. + + All required parameters must be populated in order to send to Azure. + + :ivar principal_id: Required. The the principal id that will be granted JIT access. + :vartype principal_id: str + :ivar role_definition_id: Required. The role definition id that will be granted to the + Principal. + :vartype role_definition_id: str + """ + + _validation = { + 'principal_id': {'required': True}, + 'role_definition_id': {'required': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'role_definition_id': {'key': 'roleDefinitionId', 'type': 'str'}, + } + + def __init__( + self, + *, + principal_id: str, + role_definition_id: str, + **kwargs + ): + """ + :keyword principal_id: Required. The the principal id that will be granted JIT access. + :paramtype principal_id: str + :keyword role_definition_id: Required. The role definition id that will be granted to the + Principal. + :paramtype role_definition_id: str + """ + super(JitAuthorizationPolicies, self).__init__(**kwargs) + self.principal_id = principal_id + self.role_definition_id = role_definition_id + + +class JitRequestDefinition(Resource): + """Information about JIT request definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.managedapplication.v2021_07_01.models.SystemData + :ivar application_resource_id: The parent application id. + :vartype application_resource_id: str + :ivar publisher_tenant_id: The publisher tenant id. + :vartype publisher_tenant_id: str + :ivar jit_authorization_policies: The JIT authorization policies. + :vartype jit_authorization_policies: + list[~azure.mgmt.managedapplication.v2021_07_01.models.JitAuthorizationPolicies] + :ivar jit_scheduling_policy: The JIT request properties. + :vartype jit_scheduling_policy: + ~azure.mgmt.managedapplication.v2021_07_01.models.JitSchedulingPolicy + :ivar provisioning_state: The JIT request provisioning state. Possible values include: + "NotSpecified", "Accepted", "Running", "Deleting", "Deleted", "Canceled", "Failed", + "Succeeded", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.managedapplication.v2021_07_01.models.ProvisioningState + :ivar jit_request_state: The JIT request state. Possible values include: "NotSpecified", + "Pending", "Approved", "Denied", "Failed", "Canceled", "Expired", "Timeout". + :vartype jit_request_state: str or + ~azure.mgmt.managedapplication.v2021_07_01.models.JitRequestState + :ivar created_by: The client entity that created the JIT request. + :vartype created_by: ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationClientDetails + :ivar updated_by: The client entity that last updated the JIT request. + :vartype updated_by: ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationClientDetails + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'publisher_tenant_id': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'jit_request_state': {'readonly': True}, + 'created_by': {'readonly': True}, + 'updated_by': {'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}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'application_resource_id': {'key': 'properties.applicationResourceId', 'type': 'str'}, + 'publisher_tenant_id': {'key': 'properties.publisherTenantId', 'type': 'str'}, + 'jit_authorization_policies': {'key': 'properties.jitAuthorizationPolicies', 'type': '[JitAuthorizationPolicies]'}, + 'jit_scheduling_policy': {'key': 'properties.jitSchedulingPolicy', 'type': 'JitSchedulingPolicy'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'jit_request_state': {'key': 'properties.jitRequestState', 'type': 'str'}, + 'created_by': {'key': 'properties.createdBy', 'type': 'ApplicationClientDetails'}, + 'updated_by': {'key': 'properties.updatedBy', 'type': 'ApplicationClientDetails'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + application_resource_id: Optional[str] = None, + jit_authorization_policies: Optional[List["JitAuthorizationPolicies"]] = None, + jit_scheduling_policy: Optional["JitSchedulingPolicy"] = None, + **kwargs + ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword application_resource_id: The parent application id. + :paramtype application_resource_id: str + :keyword jit_authorization_policies: The JIT authorization policies. + :paramtype jit_authorization_policies: + list[~azure.mgmt.managedapplication.v2021_07_01.models.JitAuthorizationPolicies] + :keyword jit_scheduling_policy: The JIT request properties. + :paramtype jit_scheduling_policy: + ~azure.mgmt.managedapplication.v2021_07_01.models.JitSchedulingPolicy + """ + super(JitRequestDefinition, self).__init__(location=location, tags=tags, **kwargs) + self.application_resource_id = application_resource_id + self.publisher_tenant_id = None + self.jit_authorization_policies = jit_authorization_policies + self.jit_scheduling_policy = jit_scheduling_policy + self.provisioning_state = None + self.jit_request_state = None + self.created_by = None + self.updated_by = None + + +class JitRequestDefinitionListResult(msrest.serialization.Model): + """List of JIT requests. + + :ivar value: The array of Jit request definition. + :vartype value: list[~azure.mgmt.managedapplication.v2021_07_01.models.JitRequestDefinition] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[JitRequestDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["JitRequestDefinition"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The array of Jit request definition. + :paramtype value: list[~azure.mgmt.managedapplication.v2021_07_01.models.JitRequestDefinition] + :keyword next_link: The URL to use for getting the next set of results. + :paramtype next_link: str + """ + super(JitRequestDefinitionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class JitRequestPatchable(msrest.serialization.Model): + """Information about JIT request. + + :ivar tags: A set of tags. Jit request tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Jit request tags. + :paramtype tags: dict[str, str] + """ + super(JitRequestPatchable, self).__init__(**kwargs) + self.tags = tags + + +class JitSchedulingPolicy(msrest.serialization.Model): + """The JIT scheduling policies. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. The type of JIT schedule. Possible values include: "NotSpecified", + "Once", "Recurring". + :vartype type: str or ~azure.mgmt.managedapplication.v2021_07_01.models.JitSchedulingType + :ivar duration: Required. The required duration of the JIT request. + :vartype duration: ~datetime.timedelta + :ivar start_time: Required. The start time of the request. + :vartype start_time: ~datetime.datetime + """ + + _validation = { + 'type': {'required': True}, + 'duration': {'required': True}, + 'start_time': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'duration': {'key': 'duration', 'type': 'duration'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + type: Union[str, "JitSchedulingType"], + duration: datetime.timedelta, + start_time: datetime.datetime, + **kwargs + ): + """ + :keyword type: Required. The type of JIT schedule. Possible values include: "NotSpecified", + "Once", "Recurring". + :paramtype type: str or ~azure.mgmt.managedapplication.v2021_07_01.models.JitSchedulingType + :keyword duration: Required. The required duration of the JIT request. + :paramtype duration: ~datetime.timedelta + :keyword start_time: Required. The start time of the request. + :paramtype start_time: ~datetime.datetime + """ + super(JitSchedulingPolicy, self).__init__(**kwargs) + self.type = type + self.duration = duration + self.start_time = start_time + + +class Operation(msrest.serialization.Model): + """Details of a REST API operation, returned from the Resource Provider Operations API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + :vartype name: str + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for + data-plane operations and "false" for ARM/control-plane operations. + :vartype is_data_action: bool + :ivar display: Localized display information for this particular operation. + :vartype display: ~azure.mgmt.managedapplication.v2021_07_01.models.OperationDisplay + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Possible values include: "user", + "system", "user,system". + :vartype origin: str or ~azure.mgmt.managedapplication.v2021_07_01.models.Origin + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. Possible values include: "Internal". + :vartype action_type: str or ~azure.mgmt.managedapplication.v2021_07_01.models.ActionType + """ + + _validation = { + 'name': {'readonly': True}, + 'is_data_action': {'readonly': True}, + 'origin': {'readonly': True}, + 'action_type': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, + } + + def __init__( + self, + *, + display: Optional["OperationDisplay"] = None, + **kwargs + ): + """ + :keyword display: Localized display information for this particular operation. + :paramtype display: ~azure.mgmt.managedapplication.v2021_07_01.models.OperationDisplay + """ + super(Operation, self).__init__(**kwargs) + self.name = None + self.is_data_action = None + self.display = display + self.origin = None + self.action_type = None + + +class OperationDisplay(msrest.serialization.Model): + """Localized display information for this particular operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". + :vartype provider: str + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". + :vartype resource: str + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +class OperationListResult(msrest.serialization.Model): + """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.managedapplication.v2021_07_01.models.Operation] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class Plan(msrest.serialization.Model): + """Plan for the managed application. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. The plan name. + :vartype name: str + :ivar publisher: Required. The publisher ID. + :vartype publisher: str + :ivar product: Required. The product code. + :vartype product: str + :ivar promotion_code: The promotion code. + :vartype promotion_code: str + :ivar version: Required. The plan's version. + :vartype version: str + """ + + _validation = { + 'name': {'required': True}, + 'publisher': {'required': True}, + 'product': {'required': True}, + 'version': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'product': {'key': 'product', 'type': 'str'}, + 'promotion_code': {'key': 'promotionCode', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + publisher: str, + product: str, + version: str, + promotion_code: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Required. The plan name. + :paramtype name: str + :keyword publisher: Required. The publisher ID. + :paramtype publisher: str + :keyword product: Required. The product code. + :paramtype product: str + :keyword promotion_code: The promotion code. + :paramtype promotion_code: str + :keyword version: Required. The plan's version. + :paramtype version: str + """ + super(Plan, self).__init__(**kwargs) + self.name = name + self.publisher = publisher + self.product = product + self.promotion_code = promotion_code + self.version = version + + +class PlanPatchable(msrest.serialization.Model): + """Plan for the managed application. + + :ivar name: The plan name. + :vartype name: str + :ivar publisher: The publisher ID. + :vartype publisher: str + :ivar product: The product code. + :vartype product: str + :ivar promotion_code: The promotion code. + :vartype promotion_code: str + :ivar version: The plan's version. + :vartype version: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'product': {'key': 'product', 'type': 'str'}, + 'promotion_code': {'key': 'promotionCode', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + publisher: Optional[str] = None, + product: Optional[str] = None, + promotion_code: Optional[str] = None, + version: Optional[str] = None, + **kwargs + ): + """ + :keyword name: The plan name. + :paramtype name: str + :keyword publisher: The publisher ID. + :paramtype publisher: str + :keyword product: The product code. + :paramtype product: str + :keyword promotion_code: The promotion code. + :paramtype promotion_code: str + :keyword version: The plan's version. + :paramtype version: str + """ + super(PlanPatchable, self).__init__(**kwargs) + self.name = name + self.publisher = publisher + self.product = product + self.promotion_code = promotion_code + self.version = version + + +class Sku(msrest.serialization.Model): + """SKU for the resource. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. The SKU name. + :vartype name: str + :ivar tier: The SKU tier. + :vartype tier: str + :ivar size: The SKU size. + :vartype size: str + :ivar family: The SKU family. + :vartype family: str + :ivar model: The SKU model. + :vartype model: str + :ivar capacity: The SKU capacity. + :vartype capacity: int + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'str'}, + 'family': {'key': 'family', 'type': 'str'}, + 'model': {'key': 'model', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + *, + name: str, + tier: Optional[str] = None, + size: Optional[str] = None, + family: Optional[str] = None, + model: Optional[str] = None, + capacity: Optional[int] = None, + **kwargs + ): + """ + :keyword name: Required. The SKU name. + :paramtype name: str + :keyword tier: The SKU tier. + :paramtype tier: str + :keyword size: The SKU size. + :paramtype size: str + :keyword family: The SKU family. + :paramtype family: str + :keyword model: The SKU model. + :paramtype model: str + :keyword capacity: The SKU capacity. + :paramtype capacity: int + """ + super(Sku, self).__init__(**kwargs) + self.name = name + self.tier = tier + self.size = size + self.family = family + self.model = model + self.capacity = capacity + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or + ~azure.mgmt.managedapplication.v2021_07_01.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :vartype last_modified_by_type: str or + ~azure.mgmt.managedapplication.v2021_07_01.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or + ~azure.mgmt.managedapplication.v2021_07_01.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or + ~azure.mgmt.managedapplication.v2021_07_01.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class UserAssignedResourceIdentity(msrest.serialization.Model): + """Represents the user assigned identity that is contained within the UserAssignedIdentities dictionary on ResourceIdentity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant id of user assigned identity. + :vartype tenant_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(UserAssignedResourceIdentity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None diff --git a/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/operations/__init__.py b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/operations/__init__.py new file mode 100644 index 000000000000..dbc1b2f338e0 --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/operations/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._application_client_operations import ApplicationClientOperationsMixin +from ._applications_operations import ApplicationsOperations +from ._application_definitions_operations import ApplicationDefinitionsOperations +from ._jit_requests_operations import JitRequestsOperations + +__all__ = [ + 'ApplicationClientOperationsMixin', + 'ApplicationsOperations', + 'ApplicationDefinitionsOperations', + 'JitRequestsOperations', +] diff --git a/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/operations/_application_client_operations.py b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/operations/_application_client_operations.py new file mode 100644 index 000000000000..bbd3fcc40a42 --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/operations/_application_client_operations.py @@ -0,0 +1,116 @@ +# 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_operations_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Solutions/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 ApplicationClientOperationsMixin(object): + + @distributed_trace + def list_operations( + self, + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: + """Lists all of the available Microsoft.Solutions REST API operations. + + :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.managedapplication.v2021_07_01.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_operations_request( + template_url=self.list_operations.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_operations_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_operations.metadata = {'url': '/providers/Microsoft.Solutions/operations'} # type: ignore diff --git a/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/operations/_application_definitions_operations.py b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/operations/_application_definitions_operations.py new file mode 100644 index 000000000000..3a98c4dafb1a --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/operations/_application_definitions_operations.py @@ -0,0 +1,741 @@ +# 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.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +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_get_request( + subscription_id: str, + resource_group_name: str, + application_definition_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "applicationDefinitionName": _SERIALIZER.url("application_definition_name", application_definition_name, 'str', max_length=64, min_length=3), + } + + 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_initial( + subscription_id: str, + resource_group_name: str, + application_definition_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "applicationDefinitionName": _SERIALIZER.url("application_definition_name", application_definition_name, 'str', max_length=64, min_length=3), + } + + 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 + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + application_definition_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "applicationDefinitionName": _SERIALIZER.url("application_definition_name", application_definition_name, 'str', max_length=64, min_length=3), + } + + 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, + application_definition_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "applicationDefinitionName": _SERIALIZER.url("application_definition_name", application_definition_name, 'str', max_length=64, min_length=3), + } + + 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_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + 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_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Solutions/applicationDefinitions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + 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 ApplicationDefinitionsOperations(object): + """ApplicationDefinitionsOperations 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.managedapplication.v2021_07_01.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( + self, + resource_group_name: str, + application_definition_name: str, + **kwargs: Any + ) -> "_models.ApplicationDefinition": + """Gets the managed application definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_definition_name: The name of the managed application definition. + :type application_definition_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationDefinition"] + 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, + application_definition_name=application_definition_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ApplicationDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'} # type: ignore + + + def _delete_initial( + self, + resource_group_name: str, + application_definition_name: str, + **kwargs: Any + ) -> None: + 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_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_definition_name=application_definition_name, + template_url=self._delete_initial.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, 202, 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_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + application_definition_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes the managed application definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_definition_name: The name of the managed application definition. + :type application_definition_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + application_definition_name=application_definition_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + application_definition_name: str, + parameters: "_models.ApplicationDefinition", + **kwargs: Any + ) -> "_models.ApplicationDefinition": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationDefinition"] + 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, 'ApplicationDefinition') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_definition_name=application_definition_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.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('ApplicationDefinition', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ApplicationDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + application_definition_name: str, + parameters: "_models.ApplicationDefinition", + **kwargs: Any + ) -> LROPoller["_models.ApplicationDefinition"]: + """Creates a new managed application definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_definition_name: The name of the managed application definition. + :type application_definition_name: str + :param parameters: Parameters supplied to the create or update an managed application + definition. + :type parameters: ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationDefinition + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ApplicationDefinition or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationDefinition] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationDefinition"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + application_definition_name=application_definition_name, + parameters=parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ApplicationDefinition', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'} # type: ignore + + @distributed_trace + def update( + self, + resource_group_name: str, + application_definition_name: str, + parameters: "_models.ApplicationDefinitionPatchable", + **kwargs: Any + ) -> "_models.ApplicationDefinition": + """Updates the managed application definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_definition_name: The name of the managed application definition. + :type application_definition_name: str + :param parameters: Parameters supplied to the update a managed application definition. + :type parameters: + ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationDefinitionPatchable + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationDefinition"] + 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, 'ApplicationDefinitionPatchable') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_definition_name=application_definition_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ApplicationDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'} # type: ignore + + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ApplicationDefinitionListResult"]: + """Lists the managed application definitions in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationDefinitionListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationDefinitionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationDefinitionListResult"] + 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("ApplicationDefinitionListResult", 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions'} # type: ignore + + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> Iterable["_models.ApplicationDefinitionListResult"]: + """Gets all the application definitions within a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationDefinitionListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationDefinitionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationDefinitionListResult"] + 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("ApplicationDefinitionListResult", 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Solutions/applicationDefinitions'} # type: ignore diff --git a/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/operations/_applications_operations.py b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/operations/_applications_operations.py new file mode 100644 index 000000000000..2e1b8f5403d5 --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/operations/_applications_operations.py @@ -0,0 +1,959 @@ +# 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.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +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_get_request( + subscription_id: str, + resource_group_name: str, + application_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str', max_length=64, min_length=3), + } + + 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_initial( + subscription_id: str, + resource_group_name: str, + application_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str', max_length=64, min_length=3), + } + + 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 + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + application_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str', max_length=64, min_length=3), + } + + 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, + application_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str', max_length=64, min_length=3), + } + + 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_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + 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_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Solutions/applications') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + 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_refresh_permissions_request_initial( + subscription_id: str, + resource_group_name: str, + application_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}/refreshPermissions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str', max_length=64, min_length=3), + } + + 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="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_allowed_upgrade_plans_request( + subscription_id: str, + resource_group_name: str, + application_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}/listAllowedUpgradePlans') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str', max_length=64, min_length=3), + } + + 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="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class ApplicationsOperations(object): + """ApplicationsOperations 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.managedapplication.v2021_07_01.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( + self, + resource_group_name: str, + application_name: str, + **kwargs: Any + ) -> "_models.Application": + """Gets the managed application. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_name: The name of the managed application. + :type application_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Application, or the result of cls(response) + :rtype: ~azure.mgmt.managedapplication.v2021_07_01.models.Application + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Application"] + 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, + application_name=application_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Application', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}'} # type: ignore + + + def _delete_initial( + self, + resource_group_name: str, + application_name: str, + **kwargs: Any + ) -> None: + 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_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_name=application_name, + template_url=self._delete_initial.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_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + application_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes the managed application. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_name: The name of the managed application. + :type application_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + application_name=application_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + application_name: str, + parameters: "_models.Application", + **kwargs: Any + ) -> "_models.Application": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Application"] + 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, 'Application') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_name=application_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.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('Application', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Application', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + application_name: str, + parameters: "_models.Application", + **kwargs: Any + ) -> LROPoller["_models.Application"]: + """Creates a new managed application. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_name: The name of the managed application. + :type application_name: str + :param parameters: Parameters supplied to the create or update a managed application. + :type parameters: ~azure.mgmt.managedapplication.v2021_07_01.models.Application + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Application or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.managedapplication.v2021_07_01.models.Application] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Application"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + application_name=application_name, + parameters=parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Application', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}'} # type: ignore + + @distributed_trace + def update( + self, + resource_group_name: str, + application_name: str, + parameters: Optional["_models.ApplicationPatchable"] = None, + **kwargs: Any + ) -> Optional["_models.Application"]: + """Updates an existing managed application. The only value that can be updated via PATCH currently + is the tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_name: The name of the managed application. + :type application_name: str + :param parameters: Parameters supplied to update an existing managed application. + :type parameters: ~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationPatchable + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Application, or the result of cls(response) + :rtype: ~azure.mgmt.managedapplication.v2021_07_01.models.Application or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Application"]] + 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] + + if parameters is not None: + _json = self._serialize.body(parameters, 'ApplicationPatchable') + else: + _json = None + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_name=application_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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Application', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}'} # type: ignore + + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ApplicationListResult"]: + """Gets all the applications within a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationListResult"] + 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("ApplicationListResult", 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications'} # type: ignore + + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> Iterable["_models.ApplicationListResult"]: + """Gets all the applications within a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.managedapplication.v2021_07_01.models.ApplicationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationListResult"] + 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("ApplicationListResult", 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Solutions/applications'} # type: ignore + + def _refresh_permissions_initial( + self, + resource_group_name: str, + application_name: str, + **kwargs: Any + ) -> None: + 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_refresh_permissions_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_name=application_name, + template_url=self._refresh_permissions_initial.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, 202]: + 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, {}) + + _refresh_permissions_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}/refreshPermissions'} # type: ignore + + + @distributed_trace + def begin_refresh_permissions( + self, + resource_group_name: str, + application_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Refresh Permissions for application. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_name: The name of the managed application. + :type application_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._refresh_permissions_initial( + resource_group_name=resource_group_name, + application_name=application_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_refresh_permissions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}/refreshPermissions'} # type: ignore + + @distributed_trace + def list_allowed_upgrade_plans( + self, + resource_group_name: str, + application_name: str, + **kwargs: Any + ) -> None: + """List allowed upgrade plans for application. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_name: The name of the managed application. + :type application_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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_list_allowed_upgrade_plans_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_name=application_name, + template_url=self.list_allowed_upgrade_plans.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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + list_allowed_upgrade_plans.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}/listAllowedUpgradePlans'} # type: ignore + diff --git a/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/operations/_jit_requests_operations.py b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/operations/_jit_requests_operations.py new file mode 100644 index 000000000000..c2f87f22a8bb --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/operations/_jit_requests_operations.py @@ -0,0 +1,645 @@ +# 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, Union +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.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +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_get_request( + subscription_id: str, + resource_group_name: str, + jit_request_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/jitRequests/{jitRequestName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "jitRequestName": _SERIALIZER.url("jit_request_name", jit_request_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_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + jit_request_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/jitRequests/{jitRequestName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "jitRequestName": _SERIALIZER.url("jit_request_name", jit_request_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, + jit_request_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/jitRequests/{jitRequestName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "jitRequestName": _SERIALIZER.url("jit_request_name", jit_request_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_delete_request( + subscription_id: str, + resource_group_name: str, + jit_request_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/jitRequests/{jitRequestName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "jitRequestName": _SERIALIZER.url("jit_request_name", jit_request_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 + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Solutions/jitRequests') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + 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-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/jitRequests') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + 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 JitRequestsOperations(object): + """JitRequestsOperations 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.managedapplication.v2021_07_01.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( + self, + resource_group_name: str, + jit_request_name: str, + **kwargs: Any + ) -> "_models.JitRequestDefinition": + """Gets the JIT request. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param jit_request_name: The name of the JIT request. + :type jit_request_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JitRequestDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.managedapplication.v2021_07_01.models.JitRequestDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JitRequestDefinition"] + 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, + jit_request_name=jit_request_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('JitRequestDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/jitRequests/{jitRequestName}'} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + jit_request_name: str, + parameters: "_models.JitRequestDefinition", + **kwargs: Any + ) -> "_models.JitRequestDefinition": + cls = kwargs.pop('cls', None) # type: ClsType["_models.JitRequestDefinition"] + 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, 'JitRequestDefinition') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + jit_request_name=jit_request_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.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('JitRequestDefinition', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('JitRequestDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/jitRequests/{jitRequestName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + jit_request_name: str, + parameters: "_models.JitRequestDefinition", + **kwargs: Any + ) -> LROPoller["_models.JitRequestDefinition"]: + """Creates or updates the JIT request. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param jit_request_name: The name of the JIT request. + :type jit_request_name: str + :param parameters: Parameters supplied to the update JIT request. + :type parameters: ~azure.mgmt.managedapplication.v2021_07_01.models.JitRequestDefinition + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either JitRequestDefinition or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.managedapplication.v2021_07_01.models.JitRequestDefinition] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.JitRequestDefinition"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + jit_request_name=jit_request_name, + parameters=parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('JitRequestDefinition', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/jitRequests/{jitRequestName}'} # type: ignore + + @distributed_trace + def update( + self, + resource_group_name: str, + jit_request_name: str, + parameters: "_models.JitRequestPatchable", + **kwargs: Any + ) -> "_models.JitRequestDefinition": + """Updates the JIT request. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param jit_request_name: The name of the JIT request. + :type jit_request_name: str + :param parameters: Parameters supplied to the update JIT request. + :type parameters: ~azure.mgmt.managedapplication.v2021_07_01.models.JitRequestPatchable + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JitRequestDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.managedapplication.v2021_07_01.models.JitRequestDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JitRequestDefinition"] + 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, 'JitRequestPatchable') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + jit_request_name=jit_request_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('JitRequestDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/jitRequests/{jitRequestName}'} # type: ignore + + + @distributed_trace + def delete( + self, + resource_group_name: str, + jit_request_name: str, + **kwargs: Any + ) -> None: + """Deletes the JIT request. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param jit_request_name: The name of the JIT request. + :type jit_request_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, + jit_request_name=jit_request_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/jitRequests/{jitRequestName}'} # type: ignore + + + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> "_models.JitRequestDefinitionListResult": + """Retrieves all JIT requests within the subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JitRequestDefinitionListResult, or the result of cls(response) + :rtype: ~azure.mgmt.managedapplication.v2021_07_01.models.JitRequestDefinitionListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JitRequestDefinitionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + 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) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('JitRequestDefinitionListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Solutions/jitRequests'} # type: ignore + + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> "_models.JitRequestDefinitionListResult": + """Retrieves all JIT requests within the resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JitRequestDefinitionListResult, or the result of cls(response) + :rtype: ~azure.mgmt.managedapplication.v2021_07_01.models.JitRequestDefinitionListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JitRequestDefinitionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + 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) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('JitRequestDefinitionListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/jitRequests'} # type: ignore + diff --git a/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/py.typed b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/azure/mgmt/managedapplication/v2021_07_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/managedapplication/azure-mgmt-managedapplication/sdk_packaging.toml b/sdk/managedapplication/azure-mgmt-managedapplication/sdk_packaging.toml new file mode 100644 index 000000000000..bb48be041e4c --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/sdk_packaging.toml @@ -0,0 +1,9 @@ +[packaging] +package_name = "azure-mgmt-managedapplication" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true diff --git a/sdk/managedapplication/azure-mgmt-managedapplication/setup.py b/sdk/managedapplication/azure-mgmt-managedapplication/setup.py new file mode 100644 index 000000000000..f5afabbca60f --- /dev/null +++ b/sdk/managedapplication/azure-mgmt-managedapplication/setup.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-managedapplication" +PACKAGE_PPRINT_NAME = "MyService Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +with open('README.md', encoding='utf-8') as f: + readme = f.read() +with open('CHANGELOG.md', encoding='utf-8') as f: + changelog = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + '\n\n' + changelog, + long_description_content_type='text/markdown', + license='MIT License', + author='Microsoft Corporation', + author_email='azpysdkhelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python', + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + "Programming Language :: Python :: 3 :: Only", + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.mgmt', + ]), + install_requires=[ + 'msrest>=0.6.21', + 'azure-common~=1.1', + 'azure-mgmt-core>=1.3.0,<2.0.0', + ], + python_requires=">=3.6" +) diff --git a/sdk/managedapplication/ci.yml b/sdk/managedapplication/ci.yml new file mode 100644 index 000000000000..1a4d99745f89 --- /dev/null +++ b/sdk/managedapplication/ci.yml @@ -0,0 +1,33 @@ +# DO NOT EDIT THIS FILE +# This file is generated automatically and any changes will be lost. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/managedapplication/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/managedapplication/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: managedapplication + Artifacts: + - name: azure-mgmt-managedapplication + safeName: azuremgmtmanagedapplication