From 6fa16d595ac0a658c980883381db89cd9d38e4c3 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 3 Dec 2021 00:12:58 +0000 Subject: [PATCH] CodeGen from PR 16948 in Azure/azure-rest-api-specs Merge fa8e5305acb4f7924d27db9459730a00d9298477 into 3c5135f8325eaf79be7b137cae363bdcba028c17 --- .../CHANGELOG.md | 5 + .../azure-mgmt-externalidentities/LICENSE.txt | 21 + .../azure-mgmt-externalidentities/MANIFEST.in | 6 + .../azure-mgmt-externalidentities/README.md | 27 + .../azure-mgmt-externalidentities/_meta.json | 11 + .../azure/__init__.py | 1 + .../azure/mgmt/__init__.py | 1 + .../azure/mgmt/externalidentities/__init__.py | 16 + .../mgmt/externalidentities/_configuration.py | 71 ++ ...xternal_identities_configuration_client.py | 154 +++++ .../azure/mgmt/externalidentities/_version.py | 8 + .../mgmt/externalidentities/aio/__init__.py | 10 + .../externalidentities/aio/_configuration.py | 67 ++ ...xternal_identities_configuration_client.py | 152 +++++ .../azure/mgmt/externalidentities/models.py | 8 + .../azure/mgmt/externalidentities/py.typed | 1 + .../v2019_01_01_preview/__init__.py | 19 + .../v2019_01_01_preview/_configuration.py | 71 ++ ...xternal_identities_configuration_client.py | 94 +++ .../v2019_01_01_preview/_metadata.json | 104 +++ .../v2019_01_01_preview/_version.py | 9 + .../v2019_01_01_preview/aio/__init__.py | 10 + .../v2019_01_01_preview/aio/_configuration.py | 67 ++ ...xternal_identities_configuration_client.py | 87 +++ .../aio/operations/__init__.py | 15 + .../aio/operations/_b2_ctenants_operations.py | 621 +++++++++++++++++ .../aio/operations/_operations.py | 158 +++++ .../v2019_01_01_preview/models/__init__.py | 72 ++ ...l_identities_configuration_client_enums.py | 75 +++ .../v2019_01_01_preview/models/_models.py | 565 ++++++++++++++++ .../v2019_01_01_preview/models/_models_py3.py | 617 +++++++++++++++++ .../operations/__init__.py | 15 + .../operations/_b2_ctenants_operations.py | 634 ++++++++++++++++++ .../operations/_operations.py | 164 +++++ .../v2019_01_01_preview/py.typed | 1 + .../v2020_05_01_preview/__init__.py | 19 + .../v2020_05_01_preview/_configuration.py | 71 ++ ...xternal_identities_configuration_client.py | 93 +++ .../v2020_05_01_preview/_metadata.json | 104 +++ .../v2020_05_01_preview/_version.py | 9 + .../v2020_05_01_preview/aio/__init__.py | 10 + .../v2020_05_01_preview/aio/_configuration.py | 67 ++ ...xternal_identities_configuration_client.py | 86 +++ .../aio/operations/__init__.py | 15 + .../operations/_guest_usages_operations.py | 443 ++++++++++++ .../aio/operations/_operations.py | 104 +++ .../v2020_05_01_preview/models/__init__.py | 37 + .../v2020_05_01_preview/models/_models.py | 270 ++++++++ .../v2020_05_01_preview/models/_models_py3.py | 282 ++++++++ .../operations/__init__.py | 15 + .../operations/_guest_usages_operations.py | 453 +++++++++++++ .../operations/_operations.py | 109 +++ .../v2020_05_01_preview/py.typed | 1 + .../sdk_packaging.toml | 9 + .../azure-mgmt-externalidentities/setup.cfg | 2 + .../azure-mgmt-externalidentities/setup.py | 90 +++ sdk/externalidentities/ci.yml | 33 + 57 files changed, 6279 insertions(+) create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/CHANGELOG.md create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/LICENSE.txt create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/MANIFEST.in create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/README.md create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/_meta.json create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/__init__.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/__init__.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/__init__.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/_configuration.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/_external_identities_configuration_client.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/_version.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/aio/__init__.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/aio/_configuration.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/aio/_external_identities_configuration_client.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/models.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/py.typed create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/__init__.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/_configuration.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/_external_identities_configuration_client.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/_metadata.json create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/_version.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/aio/__init__.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/aio/_configuration.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/aio/_external_identities_configuration_client.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/aio/operations/__init__.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/aio/operations/_b2_ctenants_operations.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/aio/operations/_operations.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/models/__init__.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/models/_external_identities_configuration_client_enums.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/models/_models.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/models/_models_py3.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/operations/__init__.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/operations/_b2_ctenants_operations.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/operations/_operations.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/py.typed create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/__init__.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/_configuration.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/_external_identities_configuration_client.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/_metadata.json create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/_version.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/aio/__init__.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/aio/_configuration.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/aio/_external_identities_configuration_client.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/aio/operations/__init__.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/aio/operations/_guest_usages_operations.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/aio/operations/_operations.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/models/__init__.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/models/_models.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/models/_models_py3.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/operations/__init__.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/operations/_guest_usages_operations.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/operations/_operations.py create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/py.typed create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/sdk_packaging.toml create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/setup.cfg create mode 100644 sdk/externalidentities/azure-mgmt-externalidentities/setup.py create mode 100644 sdk/externalidentities/ci.yml diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/CHANGELOG.md b/sdk/externalidentities/azure-mgmt-externalidentities/CHANGELOG.md new file mode 100644 index 0000000000000..578ed6acf4796 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/LICENSE.txt b/sdk/externalidentities/azure-mgmt-externalidentities/LICENSE.txt new file mode 100644 index 0000000000000..2d3163745319c --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2021 Microsoft + +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/externalidentities/azure-mgmt-externalidentities/MANIFEST.in b/sdk/externalidentities/azure-mgmt-externalidentities/MANIFEST.in new file mode 100644 index 0000000000000..ef61eb0e35276 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/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.txt diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/README.md b/sdk/externalidentities/azure-mgmt-externalidentities/README.md new file mode 100644 index 0000000000000..a03c5f816c529 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/README.md @@ -0,0 +1,27 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure MyService Management Client Library. +This package has been tested with Python 2.7, 3.6+. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + + +# Usage + + +To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) + + + +For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) +Code samples for this package can be found at [MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-externalidentities%2FREADME.png) diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/_meta.json b/sdk/externalidentities/azure-mgmt-externalidentities/_meta.json new file mode 100644 index 0000000000000..09700cbdf8d69 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.4.5", + "use": [ + "@autorest/python@5.8.4", + "@autorest/modelerfour@4.19.2" + ], + "commit": "0e77befbf7b81b2cc40f7999ae5a46dd49b7ba5e", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/cpim/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", + "readme": "specification/cpim/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/__init__.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/__init__.py new file mode 100644 index 0000000000000..8db66d3d0f0f2 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/__init__.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/__init__.py new file mode 100644 index 0000000000000..8db66d3d0f0f2 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/__init__.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/__init__.py new file mode 100644 index 0000000000000..ff17ccb718b5b --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/__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 ._external_identities_configuration_client import ExternalIdentitiesConfigurationClient +__all__ = ['ExternalIdentitiesConfigurationClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/_configuration.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/_configuration.py new file mode 100644 index 0000000000000..fe9a470759600 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/_configuration.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + +class ExternalIdentitiesConfigurationClientConfiguration(Configuration): + """Configuration for ExternalIdentitiesConfigurationClient. + + 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 Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :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(ExternalIdentitiesConfigurationClientConfiguration, 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-externalidentities/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/_external_identities_configuration_client.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/_external_identities_configuration_client.py new file mode 100644 index 0000000000000..2a5990c7a35f6 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/_external_identities_configuration_client.py @@ -0,0 +1,154 @@ +# 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 ExternalIdentitiesConfigurationClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +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 ExternalIdentitiesConfigurationClient(MultiApiClientMixin, _SDKClient): + """External Identities Configuration Client. + + 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 Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :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 = '2020-05-01-preview' + _PROFILE_TAG = "azure.mgmt.externalidentities.ExternalIdentitiesConfigurationClient" + LATEST_PROFILE = ProfileDefinition({ + _PROFILE_TAG: { + None: DEFAULT_API_VERSION, + 'b2_ctenants': '2019-01-01-preview', + }}, + _PROFILE_TAG + " latest" + ) + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + api_version=None, # type: Optional[str] + base_url=None, # type: Optional[str] + profile=KnownProfiles.default, # type: KnownProfiles + **kwargs # type: Any + ): + if not base_url: + base_url = 'https://management.azure.com' + self._config = ExternalIdentitiesConfigurationClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + super(ExternalIdentitiesConfigurationClient, 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: + + * 2019-01-01-preview: :mod:`v2019_01_01_preview.models` + * 2020-05-01-preview: :mod:`v2020_05_01_preview.models` + """ + if api_version == '2019-01-01-preview': + from .v2019_01_01_preview import models + return models + elif api_version == '2020-05-01-preview': + from .v2020_05_01_preview import models + return models + raise ValueError("API version {} is not available".format(api_version)) + + @property + def b2_ctenants(self): + """Instance depends on the API version: + + * 2019-01-01-preview: :class:`B2CTenantsOperations` + """ + api_version = self._get_api_version('b2_ctenants') + if api_version == '2019-01-01-preview': + from .v2019_01_01_preview.operations import B2CTenantsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'b2_ctenants'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def guest_usages(self): + """Instance depends on the API version: + + * 2020-05-01-preview: :class:`GuestUsagesOperations` + """ + api_version = self._get_api_version('guest_usages') + if api_version == '2020-05-01-preview': + from .v2020_05_01_preview.operations import GuestUsagesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'guest_usages'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def operations(self): + """Instance depends on the API version: + + * 2019-01-01-preview: :class:`Operations` + * 2020-05-01-preview: :class:`Operations` + """ + api_version = self._get_api_version('operations') + if api_version == '2019-01-01-preview': + from .v2019_01_01_preview.operations import Operations as OperationClass + elif api_version == '2020-05-01-preview': + from .v2020_05_01_preview.operations import Operations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'operations'".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/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/_version.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/_version.py new file mode 100644 index 0000000000000..a30a458f8b5b3 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/_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/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/aio/__init__.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/aio/__init__.py new file mode 100644 index 0000000000000..c3afc1ec34601 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/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 ._external_identities_configuration_client import ExternalIdentitiesConfigurationClient +__all__ = ['ExternalIdentitiesConfigurationClient'] diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/aio/_configuration.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/aio/_configuration.py new file mode 100644 index 0000000000000..161d5849e2f08 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/aio/_configuration.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +class ExternalIdentitiesConfigurationClientConfiguration(Configuration): + """Configuration for ExternalIdentitiesConfigurationClient. + + 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 Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :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(ExternalIdentitiesConfigurationClientConfiguration, 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-externalidentities/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/aio/_external_identities_configuration_client.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/aio/_external_identities_configuration_client.py new file mode 100644 index 0000000000000..845cac0d36b65 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/aio/_external_identities_configuration_client.py @@ -0,0 +1,152 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from azure.profiles import KnownProfiles, ProfileDefinition +from azure.profiles.multiapiclient import MultiApiClientMixin +from msrest import Deserializer, Serializer + +from ._configuration import ExternalIdentitiesConfigurationClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + 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 ExternalIdentitiesConfigurationClient(MultiApiClientMixin, _SDKClient): + """External Identities Configuration Client. + + 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 Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :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 = '2020-05-01-preview' + _PROFILE_TAG = "azure.mgmt.externalidentities.ExternalIdentitiesConfigurationClient" + LATEST_PROFILE = ProfileDefinition({ + _PROFILE_TAG: { + None: DEFAULT_API_VERSION, + 'b2_ctenants': '2019-01-01-preview', + }}, + _PROFILE_TAG + " latest" + ) + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + api_version: Optional[str] = None, + base_url: Optional[str] = None, + profile: KnownProfiles = KnownProfiles.default, + **kwargs # type: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = ExternalIdentitiesConfigurationClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + super(ExternalIdentitiesConfigurationClient, 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: + + * 2019-01-01-preview: :mod:`v2019_01_01_preview.models` + * 2020-05-01-preview: :mod:`v2020_05_01_preview.models` + """ + if api_version == '2019-01-01-preview': + from ..v2019_01_01_preview import models + return models + elif api_version == '2020-05-01-preview': + from ..v2020_05_01_preview import models + return models + raise ValueError("API version {} is not available".format(api_version)) + + @property + def b2_ctenants(self): + """Instance depends on the API version: + + * 2019-01-01-preview: :class:`B2CTenantsOperations` + """ + api_version = self._get_api_version('b2_ctenants') + if api_version == '2019-01-01-preview': + from ..v2019_01_01_preview.aio.operations import B2CTenantsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'b2_ctenants'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def guest_usages(self): + """Instance depends on the API version: + + * 2020-05-01-preview: :class:`GuestUsagesOperations` + """ + api_version = self._get_api_version('guest_usages') + if api_version == '2020-05-01-preview': + from ..v2020_05_01_preview.aio.operations import GuestUsagesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'guest_usages'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def operations(self): + """Instance depends on the API version: + + * 2019-01-01-preview: :class:`Operations` + * 2020-05-01-preview: :class:`Operations` + """ + api_version = self._get_api_version('operations') + if api_version == '2019-01-01-preview': + from ..v2019_01_01_preview.aio.operations import Operations as OperationClass + elif api_version == '2020-05-01-preview': + from ..v2020_05_01_preview.aio.operations import Operations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'operations'".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/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/models.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/models.py new file mode 100644 index 0000000000000..0ca8965a74115 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/models.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. +# -------------------------------------------------------------------------- +from .v2019_01_01_preview.models import * +from .v2020_05_01_preview.models import * diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/py.typed b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/py.typed new file mode 100644 index 0000000000000..e5aff4f83af86 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/__init__.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/__init__.py new file mode 100644 index 0000000000000..5cbc32e877fd6 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/__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 ._external_identities_configuration_client import ExternalIdentitiesConfigurationClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['ExternalIdentitiesConfigurationClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/_configuration.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/_configuration.py new file mode 100644 index 0000000000000..f0e269524ada3 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/_configuration.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class ExternalIdentitiesConfigurationClientConfiguration(Configuration): + """Configuration for ExternalIdentitiesConfigurationClient. + + 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: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :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(ExternalIdentitiesConfigurationClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2019-01-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-externalidentities/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/_external_identities_configuration_client.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/_external_identities_configuration_client.py new file mode 100644 index 0000000000000..d4291a13360e0 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/_external_identities_configuration_client.py @@ -0,0 +1,94 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import ExternalIdentitiesConfigurationClientConfiguration +from .operations import B2CTenantsOperations +from .operations import Operations +from . import models + + +class ExternalIdentitiesConfigurationClient(object): + """External Identities Configuration Client. + + :ivar b2_ctenants: B2CTenantsOperations operations + :vartype b2_ctenants: $(python-base-namespace).v2019_01_01_preview.operations.B2CTenantsOperations + :ivar operations: Operations operations + :vartype operations: $(python-base-namespace).v2019_01_01_preview.operations.Operations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = ExternalIdentitiesConfigurationClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.b2_ctenants = B2CTenantsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> ExternalIdentitiesConfigurationClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/_metadata.json b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/_metadata.json new file mode 100644 index 0000000000000..785a2abec888a --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/_metadata.json @@ -0,0 +1,104 @@ +{ + "chosen_version": "2019-01-01-preview", + "total_api_version_list": ["2019-01-01-preview"], + "client": { + "name": "ExternalIdentitiesConfigurationClient", + "filename": "_external_identities_configuration_client", + "description": "External Identities Configuration Client.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ExternalIdentitiesConfigurationClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ExternalIdentitiesConfigurationClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "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": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "b2_ctenants": "B2CTenantsOperations", + "operations": "Operations" + } +} \ No newline at end of file diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/_version.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/_version.py new file mode 100644 index 0000000000000..dfa6ee022f154 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/_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.0b2" diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/aio/__init__.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/aio/__init__.py new file mode 100644 index 0000000000000..c3afc1ec34601 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/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 ._external_identities_configuration_client import ExternalIdentitiesConfigurationClient +__all__ = ['ExternalIdentitiesConfigurationClient'] diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/aio/_configuration.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/aio/_configuration.py new file mode 100644 index 0000000000000..4d11487740f15 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/aio/_configuration.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class ExternalIdentitiesConfigurationClientConfiguration(Configuration): + """Configuration for ExternalIdentitiesConfigurationClient. + + 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: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(ExternalIdentitiesConfigurationClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2019-01-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-externalidentities/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/aio/_external_identities_configuration_client.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/aio/_external_identities_configuration_client.py new file mode 100644 index 0000000000000..b19fd4d06a916 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/aio/_external_identities_configuration_client.py @@ -0,0 +1,87 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import ExternalIdentitiesConfigurationClientConfiguration +from .operations import B2CTenantsOperations +from .operations import Operations +from .. import models + + +class ExternalIdentitiesConfigurationClient(object): + """External Identities Configuration Client. + + :ivar b2_ctenants: B2CTenantsOperations operations + :vartype b2_ctenants: $(python-base-namespace).v2019_01_01_preview.aio.operations.B2CTenantsOperations + :ivar operations: Operations operations + :vartype operations: $(python-base-namespace).v2019_01_01_preview.aio.operations.Operations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = ExternalIdentitiesConfigurationClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.b2_ctenants = B2CTenantsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "ExternalIdentitiesConfigurationClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/aio/operations/__init__.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/aio/operations/__init__.py new file mode 100644 index 0000000000000..368202cb4d7e2 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/aio/operations/__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 ._b2_ctenants_operations import B2CTenantsOperations +from ._operations import Operations + +__all__ = [ + 'B2CTenantsOperations', + 'Operations', +] diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/aio/operations/_b2_ctenants_operations.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/aio/operations/_b2_ctenants_operations.py new file mode 100644 index 0000000000000..4bee3bf1fe434 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/aio/operations/_b2_ctenants_operations.py @@ -0,0 +1,621 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class B2CTenantsOperations: + """B2CTenantsOperations 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: ~$(python-base-namespace).v2019_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def check_name_availability( + self, + check_name_availability_request_body: Optional["_models.CheckNameAvailabilityRequestBody"] = None, + **kwargs: Any + ) -> "_models.NameAvailabilityResponse": + """Checks the availability and validity of a domain name for the tenant. + + :param check_name_availability_request_body: + :type check_name_availability_request_body: ~$(python-base-namespace).v2019_01_01_preview.models.CheckNameAvailabilityRequestBody + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailabilityResponse, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2019_01_01_preview.models.NameAvailabilityResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NameAvailabilityResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if check_name_availability_request_body is not None: + body_content = self._serialize.body(check_name_availability_request_body, 'CheckNameAvailabilityRequestBody') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NameAvailabilityResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureActiveDirectory/checkNameAvailability'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.B2CTenantResourceList"]: + """Get all the Azure AD B2C tenant resources in a resource group. + + :param resource_group_name: The name of the resource group. + :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 B2CTenantResourceList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.B2CTenantResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('B2CTenantResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories'} # type: ignore + + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.B2CTenantResourceList"]: + """Get all the Azure AD B2C tenant resources in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either B2CTenantResourceList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.B2CTenantResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('B2CTenantResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureActiveDirectory/b2cDirectories'} # type: ignore + + async def get( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> "_models.B2CTenantResource": + """Get the Azure AD B2C tenant resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_name: The initial domain name of the B2C tenant. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: B2CTenantResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.B2CTenantResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('B2CTenantResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + resource_name: str, + update_tenant_request_body: Optional["_models.B2CTenantUpdateRequest"] = None, + **kwargs: Any + ) -> "_models.B2CTenantResource": + """Update the Azure AD B2C tenant resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_name: The initial domain name of the B2C tenant. + :type resource_name: str + :param update_tenant_request_body: + :type update_tenant_request_body: ~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantUpdateRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: B2CTenantResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.B2CTenantResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if update_tenant_request_body is not None: + body_content = self._serialize.body(update_tenant_request_body, 'B2CTenantUpdateRequest') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('B2CTenantResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + resource_name: str, + create_tenant_request_body: Optional["_models.CreateTenantRequestBody"] = None, + **kwargs: Any + ) -> Optional["_models.B2CTenantResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.B2CTenantResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if create_tenant_request_body is not None: + body_content = self._serialize.body(create_tenant_request_body, 'CreateTenantRequestBody') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('B2CTenantResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('B2CTenantResource', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + create_tenant_request_body: Optional["_models.CreateTenantRequestBody"] = None, + **kwargs: Any + ) -> AsyncLROPoller["_models.B2CTenantResource"]: + """Initiates an async request to create both the Azure AD B2C tenant and the corresponding Azure + resource linked to a subscription. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_name: The initial domain name of the B2C tenant. + :type resource_name: str + :param create_tenant_request_body: + :type create_tenant_request_body: ~$(python-base-namespace).v2019_01_01_preview.models.CreateTenantRequestBody + :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 B2CTenantResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.B2CTenantResource"] + 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_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + create_tenant_request_body=create_tenant_request_body, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('B2CTenantResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + resource_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', {})) + api_version = "2019-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Initiates an async operation to delete the Azure AD B2C tenant and Azure resource. The resource + deletion can only happen as the last step in `the tenant deletion process + `_. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_name: The initial domain name of the B2C tenant. + :type resource_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, 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, + resource_name=resource_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/aio/operations/_operations.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/aio/operations/_operations.py new file mode 100644 index 0000000000000..32e11d23c9087 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/aio/operations/_operations.py @@ -0,0 +1,158 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~$(python-base-namespace).v2019_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.OperationListResult"]: + """Lists the operations available from this provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_01_01_preview.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.AzureActiveDirectory/operations'} # type: ignore + + async def get_async_status( + self, + operation_id: str, + **kwargs: Any + ) -> "_models.AsyncOperationStatus": + """Gets the status of the async operation. + + :param operation_id: The operation ID. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AsyncOperationStatus, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2019_01_01_preview.models.AsyncOperationStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AsyncOperationStatus"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_async_status.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AsyncOperationStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_async_status.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureActiveDirectory/operations/{operationId}'} # type: ignore diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/models/__init__.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/models/__init__.py new file mode 100644 index 0000000000000..6fcf205b51e3d --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/models/__init__.py @@ -0,0 +1,72 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import AsyncOperationStatus + from ._models_py3 import AsyncOperationStatusError + from ._models_py3 import B2CResourceSKU + from ._models_py3 import B2CTenantResource + from ._models_py3 import B2CTenantResourceList + from ._models_py3 import B2CTenantResourcePropertiesBillingConfig + from ._models_py3 import B2CTenantUpdateRequest + from ._models_py3 import CheckNameAvailabilityRequestBody + from ._models_py3 import CreateTenantRequestBody + from ._models_py3 import CreateTenantRequestBodyProperties + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorResponse + from ._models_py3 import NameAvailabilityResponse + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationListResult +except (SyntaxError, ImportError): + from ._models import AsyncOperationStatus # type: ignore + from ._models import AsyncOperationStatusError # type: ignore + from ._models import B2CResourceSKU # type: ignore + from ._models import B2CTenantResource # type: ignore + from ._models import B2CTenantResourceList # type: ignore + from ._models import B2CTenantResourcePropertiesBillingConfig # type: ignore + from ._models import B2CTenantUpdateRequest # type: ignore + from ._models import CheckNameAvailabilityRequestBody # type: ignore + from ._models import CreateTenantRequestBody # type: ignore + from ._models import CreateTenantRequestBodyProperties # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import NameAvailabilityResponse # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationListResult # type: ignore + +from ._external_identities_configuration_client_enums import ( + B2CResourceSKUName, + BillingType, + NameAvailabilityReasonType, + StatusType, +) + +__all__ = [ + 'AsyncOperationStatus', + 'AsyncOperationStatusError', + 'B2CResourceSKU', + 'B2CTenantResource', + 'B2CTenantResourceList', + 'B2CTenantResourcePropertiesBillingConfig', + 'B2CTenantUpdateRequest', + 'CheckNameAvailabilityRequestBody', + 'CreateTenantRequestBody', + 'CreateTenantRequestBodyProperties', + 'ErrorAdditionalInfo', + 'ErrorResponse', + 'NameAvailabilityResponse', + 'Operation', + 'OperationDisplay', + 'OperationListResult', + 'B2CResourceSKUName', + 'BillingType', + 'NameAvailabilityReasonType', + 'StatusType', +] diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/models/_external_identities_configuration_client_enums.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/models/_external_identities_configuration_client_enums.py new file mode 100644 index 0000000000000..d7e1cce9495be --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/models/_external_identities_configuration_client_enums.py @@ -0,0 +1,75 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class B2CResourceSKUName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The name of the SKU for the tenant. + """ + + #: Azure AD B2C usage is billed to a linked Azure subscription and uses a monthly active users + #: (MAU) billing model. + STANDARD = "Standard" + #: Azure AD B2C usage is billed to a linked Azure subscription and uses number of authentications + #: based billing. + PREMIUM_P1 = "PremiumP1" + #: Azure AD B2C usage is billed to a linked Azure subscription and uses number of authentications + #: based billing. + PREMIUM_P2 = "PremiumP2" + +class BillingType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of billing. Will be MAU for all new customers. If 'Auths', it can be updated to 'MAU'. + Cannot be changed if value is 'MAU'. Learn more about Azure AD B2C billing at + `aka.ms/b2cBilling `_. + """ + + #: Azure AD B2C usage is billed to a linked Azure subscription and uses a monthly active users + #: (MAU) billing model. + MAU = "MAU" + #: Azure AD B2C usage is billed to a linked Azure subscription and uses number of authentications + #: based billing. + AUTHS = "Auths" + +class NameAvailabilityReasonType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Describes the reason for the 'nameAvailable' value. + """ + + #: The name is already in use and is therefore unavailable. + ALREADY_EXISTS = "AlreadyExists" + #: The name provided does not match the resource provider’s naming requirements (incorrect length, + #: unsupported characters, etc.). + INVALID = "Invalid" + +class StatusType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The status of the operation. + """ + + #: The operation succeeded. + SUCCEEDED = "Succeeded" + #: The operation is pending. + PENDING = "Pending" + #: The operation failed. + FAILED = "Failed" diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/models/_models.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/models/_models.py new file mode 100644 index 0000000000000..3c4461df91c80 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/models/_models.py @@ -0,0 +1,565 @@ +# 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 msrest.serialization + + +class AsyncOperationStatus(msrest.serialization.Model): + """The async operation status. + + :param subscription_id: Subscription ID that the resource belongs to. + :type subscription_id: str + :param id: The GET resource path for the operation. + :type id: str + :param name: The operation ID. + :type name: str + :param status: The status of the operation. Possible values include: "Succeeded", "Pending", + "Failed". + :type status: str or ~$(python-base-namespace).v2019_01_01_preview.models.StatusType + :param start_time: Start time of the async operation. + :type start_time: str + :param end_time: End time of the async operation. + :type end_time: str + :param error: Error response if async operation failed. + :type error: ~$(python-base-namespace).v2019_01_01_preview.models.AsyncOperationStatusError + :param billing_config: The billing configuration for the tenant. + :type billing_config: + ~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResourcePropertiesBillingConfig + :param tenant_id: An identifier of the B2C tenant. + :type tenant_id: str + """ + + _attribute_map = { + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'str'}, + 'end_time': {'key': 'endTime', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'AsyncOperationStatusError'}, + 'billing_config': {'key': 'properties.billingConfig', 'type': 'B2CTenantResourcePropertiesBillingConfig'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AsyncOperationStatus, self).__init__(**kwargs) + self.subscription_id = kwargs.get('subscription_id', None) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + self.status = kwargs.get('status', None) + self.start_time = kwargs.get('start_time', None) + self.end_time = kwargs.get('end_time', None) + self.error = kwargs.get('error', None) + self.billing_config = kwargs.get('billing_config', None) + self.tenant_id = kwargs.get('tenant_id', None) + + +class AsyncOperationStatusError(msrest.serialization.Model): + """Error response if async operation failed. + + :param code: Error code. + :type code: str + :param message: Error message. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AsyncOperationStatusError, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class B2CResourceSKU(msrest.serialization.Model): + """SKU properties of the Azure AD B2C tenant. Learn more about Azure AD B2C billing at `aka.ms/b2cBilling `_. + + :param name: The name of the SKU for the tenant. Possible values include: "Standard", + "PremiumP1", "PremiumP2". + :type name: str or ~$(python-base-namespace).v2019_01_01_preview.models.B2CResourceSKUName + :param tier: The tier of the tenant. The only acceptable values to pass in are None and "A0". + The default value is None. + :type tier: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(B2CResourceSKU, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.tier = kwargs.get('tier', None) + + +class B2CTenantResource(msrest.serialization.Model): + """B2CTenantResource. + + 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 type: The type of the B2C tenant resource. The only acceptable values to pass in are None + and "Microsoft.AzureActiveDirectory/b2cDirectories". The default value is None. + :vartype type: str + :param sku: Required. SKU properties of the Azure AD B2C tenant. Learn more about Azure AD B2C + billing at `aka.ms/b2cBilling `_. + :type sku: ~$(python-base-namespace).v2019_01_01_preview.models.B2CResourceSKU + :ivar id: An identifier that represents the B2C tenant resource. + :vartype id: str + :ivar name: The name of the B2C tenant resource. + :vartype name: str + :param location: Required. The location in which the resource is hosted and data resides. Can + be one of 'United States', 'Europe', 'Asia Pacific', or 'Australia' (preview). Refer to `this + documentation `_ for more information. + :type location: str + :param tags: A set of tags. Resource Tags. + :type tags: dict[str, str] + :param billing_config: The billing configuration for the tenant. + :type billing_config: + ~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResourcePropertiesBillingConfig + :param tenant_id: An identifier of the B2C tenant. + :type tenant_id: str + """ + + _validation = { + 'type': {'readonly': True}, + 'sku': {'required': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'B2CResourceSKU'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'billing_config': {'key': 'properties.billingConfig', 'type': 'B2CTenantResourcePropertiesBillingConfig'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(B2CTenantResource, self).__init__(**kwargs) + self.type = None + self.sku = kwargs['sku'] + self.id = None + self.name = None + self.location = kwargs['location'] + self.tags = kwargs.get('tags', None) + self.billing_config = kwargs.get('billing_config', None) + self.tenant_id = kwargs.get('tenant_id', None) + + +class B2CTenantResourceList(msrest.serialization.Model): + """The collection of Azure AD B2C tenant resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of guest usages resources. + :vartype value: list[~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResource] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[B2CTenantResource]'}, + } + + def __init__( + self, + **kwargs + ): + super(B2CTenantResourceList, self).__init__(**kwargs) + self.value = None + + +class B2CTenantResourcePropertiesBillingConfig(msrest.serialization.Model): + """The billing configuration for the tenant. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param billing_type: The type of billing. Will be MAU for all new customers. If 'Auths', it can + be updated to 'MAU'. Cannot be changed if value is 'MAU'. Learn more about Azure AD B2C billing + at `aka.ms/b2cBilling `_. Possible values include: "MAU", "Auths". + :type billing_type: str or ~$(python-base-namespace).v2019_01_01_preview.models.BillingType + :ivar effective_start_date_utc: The data from which the billing type took effect. + :vartype effective_start_date_utc: str + """ + + _validation = { + 'effective_start_date_utc': {'readonly': True}, + } + + _attribute_map = { + 'billing_type': {'key': 'billingType', 'type': 'str'}, + 'effective_start_date_utc': {'key': 'effectiveStartDateUtc', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(B2CTenantResourcePropertiesBillingConfig, self).__init__(**kwargs) + self.billing_type = kwargs.get('billing_type', None) + self.effective_start_date_utc = None + + +class B2CTenantUpdateRequest(msrest.serialization.Model): + """The request body to update the Azure AD B2C tenant resource. + + :param sku: SKU properties of the Azure AD B2C tenant. Learn more about Azure AD B2C billing at + `aka.ms/b2cBilling `_. + :type sku: ~$(python-base-namespace).v2019_01_01_preview.models.B2CResourceSKU + :param tags: A set of tags. Resource Tags. + :type tags: dict[str, str] + :param billing_config: The billing configuration for the tenant. + :type billing_config: + ~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResourcePropertiesBillingConfig + :param tenant_id: An identifier of the B2C tenant. + :type tenant_id: str + """ + + _attribute_map = { + 'sku': {'key': 'sku', 'type': 'B2CResourceSKU'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'billing_config': {'key': 'properties.billingConfig', 'type': 'B2CTenantResourcePropertiesBillingConfig'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(B2CTenantUpdateRequest, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) + self.tags = kwargs.get('tags', None) + self.billing_config = kwargs.get('billing_config', None) + self.tenant_id = kwargs.get('tenant_id', None) + + +class CheckNameAvailabilityRequestBody(msrest.serialization.Model): + """The information required to check the availability of the name for the tenant. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The domain name to check for availability. + :type name: str + :param country_code: Required. Country code of Azure tenant (e.g. 'US'). Refer to + `aka.ms/B2CDataResidency `_ to see valid country codes and + corresponding data residency locations. If you do not see a country code in an valid data + residency location, choose one from the list. + :type country_code: str + """ + + _validation = { + 'name': {'required': True}, + 'country_code': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'country_code': {'key': 'countryCode', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CheckNameAvailabilityRequestBody, self).__init__(**kwargs) + self.name = kwargs['name'] + self.country_code = kwargs['country_code'] + + +class CreateTenantRequestBody(msrest.serialization.Model): + """The information needed to create the Azure AD B2C tenant and corresponding Azure resource, which is used for billing purposes. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. The location in which the resource is hosted and data resides. Can + be one of 'United States', 'Europe', 'Asia Pacific', or 'Australia' (preview). Refer to `this + documentation `_ for more information. + :type location: str + :param properties: Required. + :type properties: + ~$(python-base-namespace).v2019_01_01_preview.models.CreateTenantRequestBodyProperties + :param sku: Required. SKU properties of the Azure AD B2C tenant. Learn more about Azure AD B2C + billing at `aka.ms/b2cBilling `_. + :type sku: ~$(python-base-namespace).v2019_01_01_preview.models.B2CResourceSKU + :param tags: A set of tags. Resource Tags. + :type tags: dict[str, str] + """ + + _validation = { + 'location': {'required': True}, + 'properties': {'required': True}, + 'sku': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'CreateTenantRequestBodyProperties'}, + 'sku': {'key': 'sku', 'type': 'B2CResourceSKU'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(CreateTenantRequestBody, self).__init__(**kwargs) + self.location = kwargs['location'] + self.properties = kwargs['properties'] + self.sku = kwargs['sku'] + self.tags = kwargs.get('tags', None) + + +class CreateTenantRequestBodyProperties(msrest.serialization.Model): + """CreateTenantRequestBodyProperties. + + :param display_name: The display name of the B2C tenant. + :type display_name: str + :param country_code: Country code of Azure tenant (e.g. 'US'). Refer to + `aka.ms/B2CDataResidency `_ to see valid country codes and + corresponding data residency locations. If you do not see a country code in an valid data + residency location, choose one from the list. + :type country_code: str + """ + + _attribute_map = { + 'display_name': {'key': 'createTenantProperties.displayName', 'type': 'str'}, + 'country_code': {'key': 'createTenantProperties.countryCode', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CreateTenantRequestBodyProperties, self).__init__(**kwargs) + self.display_name = kwargs.get('display_name', None) + self.country_code = kwargs.get('country_code', 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 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.). + + 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[~$(python-base-namespace).v2019_01_01_preview.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~$(python-base-namespace).v2019_01_01_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class NameAvailabilityResponse(msrest.serialization.Model): + """Response of the CheckNameAvailability operation. + + :param message: Description of the reason if name is not available. + :type message: str + :param name_available: True if the name is available and can be used to create a new tenant. + Otherwise false. + :type name_available: bool + :param reason: Describes the reason for the 'nameAvailable' value. Possible values include: + "AlreadyExists", "Invalid". + :type reason: str or + ~$(python-base-namespace).v2019_01_01_preview.models.NameAvailabilityReasonType + """ + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NameAvailabilityResponse, self).__init__(**kwargs) + self.message = kwargs.get('message', None) + self.name_available = kwargs.get('name_available', None) + self.reason = kwargs.get('reason', None) + + +class Operation(msrest.serialization.Model): + """Microsoft.AzureActiveDirectory REST API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~$(python-base-namespace).v2019_01_01_preview.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = kwargs.get('display', None) + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: Service provider: Microsoft.AzureActiveDirectory. + :vartype provider: str + :ivar resource: Resource on which the operation is performed: GuestUsages, etc. + :vartype resource: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str + :param description: Friendly name of the operation. + :type description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'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 = kwargs.get('description', None) + + +class OperationListResult(msrest.serialization.Model): + """Result of listing operations for the resourceProvider. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of cpim service operations supported by the Microsoft.AzureActiveDirectory + resource provider. + :vartype value: list[~$(python-base-namespace).v2019_01_01_preview.models.Operation] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = None diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/models/_models_py3.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/models/_models_py3.py new file mode 100644 index 0000000000000..43fccd6ae4c69 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/models/_models_py3.py @@ -0,0 +1,617 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Dict, Optional, Union + +import msrest.serialization + +from ._external_identities_configuration_client_enums import * + + +class AsyncOperationStatus(msrest.serialization.Model): + """The async operation status. + + :param subscription_id: Subscription ID that the resource belongs to. + :type subscription_id: str + :param id: The GET resource path for the operation. + :type id: str + :param name: The operation ID. + :type name: str + :param status: The status of the operation. Possible values include: "Succeeded", "Pending", + "Failed". + :type status: str or ~$(python-base-namespace).v2019_01_01_preview.models.StatusType + :param start_time: Start time of the async operation. + :type start_time: str + :param end_time: End time of the async operation. + :type end_time: str + :param error: Error response if async operation failed. + :type error: ~$(python-base-namespace).v2019_01_01_preview.models.AsyncOperationStatusError + :param billing_config: The billing configuration for the tenant. + :type billing_config: + ~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResourcePropertiesBillingConfig + :param tenant_id: An identifier of the B2C tenant. + :type tenant_id: str + """ + + _attribute_map = { + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'str'}, + 'end_time': {'key': 'endTime', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'AsyncOperationStatusError'}, + 'billing_config': {'key': 'properties.billingConfig', 'type': 'B2CTenantResourcePropertiesBillingConfig'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + } + + def __init__( + self, + *, + subscription_id: Optional[str] = None, + id: Optional[str] = None, + name: Optional[str] = None, + status: Optional[Union[str, "StatusType"]] = None, + start_time: Optional[str] = None, + end_time: Optional[str] = None, + error: Optional["AsyncOperationStatusError"] = None, + billing_config: Optional["B2CTenantResourcePropertiesBillingConfig"] = None, + tenant_id: Optional[str] = None, + **kwargs + ): + super(AsyncOperationStatus, self).__init__(**kwargs) + self.subscription_id = subscription_id + self.id = id + self.name = name + self.status = status + self.start_time = start_time + self.end_time = end_time + self.error = error + self.billing_config = billing_config + self.tenant_id = tenant_id + + +class AsyncOperationStatusError(msrest.serialization.Model): + """Error response if async operation failed. + + :param code: Error code. + :type code: str + :param message: Error message. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): + super(AsyncOperationStatusError, self).__init__(**kwargs) + self.code = code + self.message = message + + +class B2CResourceSKU(msrest.serialization.Model): + """SKU properties of the Azure AD B2C tenant. Learn more about Azure AD B2C billing at `aka.ms/b2cBilling `_. + + :param name: The name of the SKU for the tenant. Possible values include: "Standard", + "PremiumP1", "PremiumP2". + :type name: str or ~$(python-base-namespace).v2019_01_01_preview.models.B2CResourceSKUName + :param tier: The tier of the tenant. The only acceptable values to pass in are None and "A0". + The default value is None. + :type tier: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[Union[str, "B2CResourceSKUName"]] = None, + tier: Optional[str] = None, + **kwargs + ): + super(B2CResourceSKU, self).__init__(**kwargs) + self.name = name + self.tier = tier + + +class B2CTenantResource(msrest.serialization.Model): + """B2CTenantResource. + + 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 type: The type of the B2C tenant resource. The only acceptable values to pass in are None + and "Microsoft.AzureActiveDirectory/b2cDirectories". The default value is None. + :vartype type: str + :param sku: Required. SKU properties of the Azure AD B2C tenant. Learn more about Azure AD B2C + billing at `aka.ms/b2cBilling `_. + :type sku: ~$(python-base-namespace).v2019_01_01_preview.models.B2CResourceSKU + :ivar id: An identifier that represents the B2C tenant resource. + :vartype id: str + :ivar name: The name of the B2C tenant resource. + :vartype name: str + :param location: Required. The location in which the resource is hosted and data resides. Can + be one of 'United States', 'Europe', 'Asia Pacific', or 'Australia' (preview). Refer to `this + documentation `_ for more information. + :type location: str + :param tags: A set of tags. Resource Tags. + :type tags: dict[str, str] + :param billing_config: The billing configuration for the tenant. + :type billing_config: + ~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResourcePropertiesBillingConfig + :param tenant_id: An identifier of the B2C tenant. + :type tenant_id: str + """ + + _validation = { + 'type': {'readonly': True}, + 'sku': {'required': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'B2CResourceSKU'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'billing_config': {'key': 'properties.billingConfig', 'type': 'B2CTenantResourcePropertiesBillingConfig'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + } + + def __init__( + self, + *, + sku: "B2CResourceSKU", + location: str, + tags: Optional[Dict[str, str]] = None, + billing_config: Optional["B2CTenantResourcePropertiesBillingConfig"] = None, + tenant_id: Optional[str] = None, + **kwargs + ): + super(B2CTenantResource, self).__init__(**kwargs) + self.type = None + self.sku = sku + self.id = None + self.name = None + self.location = location + self.tags = tags + self.billing_config = billing_config + self.tenant_id = tenant_id + + +class B2CTenantResourceList(msrest.serialization.Model): + """The collection of Azure AD B2C tenant resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of guest usages resources. + :vartype value: list[~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResource] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[B2CTenantResource]'}, + } + + def __init__( + self, + **kwargs + ): + super(B2CTenantResourceList, self).__init__(**kwargs) + self.value = None + + +class B2CTenantResourcePropertiesBillingConfig(msrest.serialization.Model): + """The billing configuration for the tenant. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param billing_type: The type of billing. Will be MAU for all new customers. If 'Auths', it can + be updated to 'MAU'. Cannot be changed if value is 'MAU'. Learn more about Azure AD B2C billing + at `aka.ms/b2cBilling `_. Possible values include: "MAU", "Auths". + :type billing_type: str or ~$(python-base-namespace).v2019_01_01_preview.models.BillingType + :ivar effective_start_date_utc: The data from which the billing type took effect. + :vartype effective_start_date_utc: str + """ + + _validation = { + 'effective_start_date_utc': {'readonly': True}, + } + + _attribute_map = { + 'billing_type': {'key': 'billingType', 'type': 'str'}, + 'effective_start_date_utc': {'key': 'effectiveStartDateUtc', 'type': 'str'}, + } + + def __init__( + self, + *, + billing_type: Optional[Union[str, "BillingType"]] = None, + **kwargs + ): + super(B2CTenantResourcePropertiesBillingConfig, self).__init__(**kwargs) + self.billing_type = billing_type + self.effective_start_date_utc = None + + +class B2CTenantUpdateRequest(msrest.serialization.Model): + """The request body to update the Azure AD B2C tenant resource. + + :param sku: SKU properties of the Azure AD B2C tenant. Learn more about Azure AD B2C billing at + `aka.ms/b2cBilling `_. + :type sku: ~$(python-base-namespace).v2019_01_01_preview.models.B2CResourceSKU + :param tags: A set of tags. Resource Tags. + :type tags: dict[str, str] + :param billing_config: The billing configuration for the tenant. + :type billing_config: + ~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResourcePropertiesBillingConfig + :param tenant_id: An identifier of the B2C tenant. + :type tenant_id: str + """ + + _attribute_map = { + 'sku': {'key': 'sku', 'type': 'B2CResourceSKU'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'billing_config': {'key': 'properties.billingConfig', 'type': 'B2CTenantResourcePropertiesBillingConfig'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + } + + def __init__( + self, + *, + sku: Optional["B2CResourceSKU"] = None, + tags: Optional[Dict[str, str]] = None, + billing_config: Optional["B2CTenantResourcePropertiesBillingConfig"] = None, + tenant_id: Optional[str] = None, + **kwargs + ): + super(B2CTenantUpdateRequest, self).__init__(**kwargs) + self.sku = sku + self.tags = tags + self.billing_config = billing_config + self.tenant_id = tenant_id + + +class CheckNameAvailabilityRequestBody(msrest.serialization.Model): + """The information required to check the availability of the name for the tenant. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The domain name to check for availability. + :type name: str + :param country_code: Required. Country code of Azure tenant (e.g. 'US'). Refer to + `aka.ms/B2CDataResidency `_ to see valid country codes and + corresponding data residency locations. If you do not see a country code in an valid data + residency location, choose one from the list. + :type country_code: str + """ + + _validation = { + 'name': {'required': True}, + 'country_code': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'country_code': {'key': 'countryCode', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + country_code: str, + **kwargs + ): + super(CheckNameAvailabilityRequestBody, self).__init__(**kwargs) + self.name = name + self.country_code = country_code + + +class CreateTenantRequestBody(msrest.serialization.Model): + """The information needed to create the Azure AD B2C tenant and corresponding Azure resource, which is used for billing purposes. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. The location in which the resource is hosted and data resides. Can + be one of 'United States', 'Europe', 'Asia Pacific', or 'Australia' (preview). Refer to `this + documentation `_ for more information. + :type location: str + :param properties: Required. + :type properties: + ~$(python-base-namespace).v2019_01_01_preview.models.CreateTenantRequestBodyProperties + :param sku: Required. SKU properties of the Azure AD B2C tenant. Learn more about Azure AD B2C + billing at `aka.ms/b2cBilling `_. + :type sku: ~$(python-base-namespace).v2019_01_01_preview.models.B2CResourceSKU + :param tags: A set of tags. Resource Tags. + :type tags: dict[str, str] + """ + + _validation = { + 'location': {'required': True}, + 'properties': {'required': True}, + 'sku': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'CreateTenantRequestBodyProperties'}, + 'sku': {'key': 'sku', 'type': 'B2CResourceSKU'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: str, + properties: "CreateTenantRequestBodyProperties", + sku: "B2CResourceSKU", + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(CreateTenantRequestBody, self).__init__(**kwargs) + self.location = location + self.properties = properties + self.sku = sku + self.tags = tags + + +class CreateTenantRequestBodyProperties(msrest.serialization.Model): + """CreateTenantRequestBodyProperties. + + :param display_name: The display name of the B2C tenant. + :type display_name: str + :param country_code: Country code of Azure tenant (e.g. 'US'). Refer to + `aka.ms/B2CDataResidency `_ to see valid country codes and + corresponding data residency locations. If you do not see a country code in an valid data + residency location, choose one from the list. + :type country_code: str + """ + + _attribute_map = { + 'display_name': {'key': 'createTenantProperties.displayName', 'type': 'str'}, + 'country_code': {'key': 'createTenantProperties.countryCode', 'type': 'str'}, + } + + def __init__( + self, + *, + display_name: Optional[str] = None, + country_code: Optional[str] = None, + **kwargs + ): + super(CreateTenantRequestBodyProperties, self).__init__(**kwargs) + self.display_name = display_name + self.country_code = country_code + + +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 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.). + + 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[~$(python-base-namespace).v2019_01_01_preview.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~$(python-base-namespace).v2019_01_01_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class NameAvailabilityResponse(msrest.serialization.Model): + """Response of the CheckNameAvailability operation. + + :param message: Description of the reason if name is not available. + :type message: str + :param name_available: True if the name is available and can be used to create a new tenant. + Otherwise false. + :type name_available: bool + :param reason: Describes the reason for the 'nameAvailable' value. Possible values include: + "AlreadyExists", "Invalid". + :type reason: str or + ~$(python-base-namespace).v2019_01_01_preview.models.NameAvailabilityReasonType + """ + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + } + + def __init__( + self, + *, + message: Optional[str] = None, + name_available: Optional[bool] = None, + reason: Optional[Union[str, "NameAvailabilityReasonType"]] = None, + **kwargs + ): + super(NameAvailabilityResponse, self).__init__(**kwargs) + self.message = message + self.name_available = name_available + self.reason = reason + + +class Operation(msrest.serialization.Model): + """Microsoft.AzureActiveDirectory REST API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~$(python-base-namespace).v2019_01_01_preview.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + *, + display: Optional["OperationDisplay"] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = display + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: Service provider: Microsoft.AzureActiveDirectory. + :vartype provider: str + :ivar resource: Resource on which the operation is performed: GuestUsages, etc. + :vartype resource: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str + :param description: Friendly name of the operation. + :type description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'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, + *, + description: Optional[str] = None, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = description + + +class OperationListResult(msrest.serialization.Model): + """Result of listing operations for the resourceProvider. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of cpim service operations supported by the Microsoft.AzureActiveDirectory + resource provider. + :vartype value: list[~$(python-base-namespace).v2019_01_01_preview.models.Operation] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = None diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/operations/__init__.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/operations/__init__.py new file mode 100644 index 0000000000000..368202cb4d7e2 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/operations/__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 ._b2_ctenants_operations import B2CTenantsOperations +from ._operations import Operations + +__all__ = [ + 'B2CTenantsOperations', + 'Operations', +] diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/operations/_b2_ctenants_operations.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/operations/_b2_ctenants_operations.py new file mode 100644 index 0000000000000..1837edff6a92f --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/operations/_b2_ctenants_operations.py @@ -0,0 +1,634 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class B2CTenantsOperations(object): + """B2CTenantsOperations 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: ~$(python-base-namespace).v2019_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def check_name_availability( + self, + check_name_availability_request_body=None, # type: Optional["_models.CheckNameAvailabilityRequestBody"] + **kwargs # type: Any + ): + # type: (...) -> "_models.NameAvailabilityResponse" + """Checks the availability and validity of a domain name for the tenant. + + :param check_name_availability_request_body: + :type check_name_availability_request_body: ~$(python-base-namespace).v2019_01_01_preview.models.CheckNameAvailabilityRequestBody + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailabilityResponse, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2019_01_01_preview.models.NameAvailabilityResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NameAvailabilityResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if check_name_availability_request_body is not None: + body_content = self._serialize.body(check_name_availability_request_body, 'CheckNameAvailabilityRequestBody') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NameAvailabilityResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureActiveDirectory/checkNameAvailability'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.B2CTenantResourceList"] + """Get all the Azure AD B2C tenant resources in a resource group. + + :param resource_group_name: The name of the resource group. + :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 B2CTenantResourceList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.B2CTenantResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('B2CTenantResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.B2CTenantResourceList"] + """Get all the Azure AD B2C tenant resources in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either B2CTenantResourceList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.B2CTenantResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('B2CTenantResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureActiveDirectory/b2cDirectories'} # type: ignore + + def get( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.B2CTenantResource" + """Get the Azure AD B2C tenant resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_name: The initial domain name of the B2C tenant. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: B2CTenantResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.B2CTenantResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('B2CTenantResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + resource_name, # type: str + update_tenant_request_body=None, # type: Optional["_models.B2CTenantUpdateRequest"] + **kwargs # type: Any + ): + # type: (...) -> "_models.B2CTenantResource" + """Update the Azure AD B2C tenant resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_name: The initial domain name of the B2C tenant. + :type resource_name: str + :param update_tenant_request_body: + :type update_tenant_request_body: ~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantUpdateRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: B2CTenantResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.B2CTenantResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if update_tenant_request_body is not None: + body_content = self._serialize.body(update_tenant_request_body, 'B2CTenantUpdateRequest') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('B2CTenantResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore + + def _create_initial( + self, + resource_group_name, # type: str + resource_name, # type: str + create_tenant_request_body=None, # type: Optional["_models.CreateTenantRequestBody"] + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.B2CTenantResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.B2CTenantResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if create_tenant_request_body is not None: + body_content = self._serialize.body(create_tenant_request_body, 'CreateTenantRequestBody') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('B2CTenantResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('B2CTenantResource', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore + + def begin_create( + self, + resource_group_name, # type: str + resource_name, # type: str + create_tenant_request_body=None, # type: Optional["_models.CreateTenantRequestBody"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.B2CTenantResource"] + """Initiates an async request to create both the Azure AD B2C tenant and the corresponding Azure + resource linked to a subscription. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_name: The initial domain name of the B2C tenant. + :type resource_name: str + :param create_tenant_request_body: + :type create_tenant_request_body: ~$(python-base-namespace).v2019_01_01_preview.models.CreateTenantRequestBody + :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 B2CTenantResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.B2CTenantResource"] + 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_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + create_tenant_request_body=create_tenant_request_body, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('B2CTenantResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Initiates an async operation to delete the Azure AD B2C tenant and Azure resource. The resource + deletion can only happen as the last step in `the tenant deletion process + `_. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_name: The initial domain name of the B2C tenant. + :type resource_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, 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, + resource_name=resource_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/operations/_operations.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/operations/_operations.py new file mode 100644 index 0000000000000..adc4085645649 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/operations/_operations.py @@ -0,0 +1,164 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class Operations(object): + """Operations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~$(python-base-namespace).v2019_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.OperationListResult"] + """Lists the operations available from this provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_01_01_preview.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.AzureActiveDirectory/operations'} # type: ignore + + def get_async_status( + self, + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AsyncOperationStatus" + """Gets the status of the async operation. + + :param operation_id: The operation ID. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AsyncOperationStatus, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2019_01_01_preview.models.AsyncOperationStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AsyncOperationStatus"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_async_status.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AsyncOperationStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_async_status.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureActiveDirectory/operations/{operationId}'} # type: ignore diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/py.typed b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/py.typed new file mode 100644 index 0000000000000..e5aff4f83af86 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2019_01_01_preview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/__init__.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/__init__.py new file mode 100644 index 0000000000000..5cbc32e877fd6 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/__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 ._external_identities_configuration_client import ExternalIdentitiesConfigurationClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['ExternalIdentitiesConfigurationClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/_configuration.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/_configuration.py new file mode 100644 index 0000000000000..278be72fa68ee --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/_configuration.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class ExternalIdentitiesConfigurationClientConfiguration(Configuration): + """Configuration for ExternalIdentitiesConfigurationClient. + + 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 Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :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(ExternalIdentitiesConfigurationClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2020-05-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-externalidentities/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/_external_identities_configuration_client.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/_external_identities_configuration_client.py new file mode 100644 index 0000000000000..848807c2fd8ca --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/_external_identities_configuration_client.py @@ -0,0 +1,93 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import ExternalIdentitiesConfigurationClientConfiguration +from .operations import Operations +from .operations import GuestUsagesOperations +from . import models + + +class ExternalIdentitiesConfigurationClient(object): + """External Identities Configuration Client. + + :ivar operations: Operations operations + :vartype operations: $(python-base-namespace).v2020_05_01_preview.operations.Operations + :ivar guest_usages: GuestUsagesOperations operations + :vartype guest_usages: $(python-base-namespace).v2020_05_01_preview.operations.GuestUsagesOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = ExternalIdentitiesConfigurationClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.guest_usages = GuestUsagesOperations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> ExternalIdentitiesConfigurationClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/_metadata.json b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/_metadata.json new file mode 100644 index 0000000000000..e0e6742d62025 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/_metadata.json @@ -0,0 +1,104 @@ +{ + "chosen_version": "2020-05-01-preview", + "total_api_version_list": ["2020-05-01-preview"], + "client": { + "name": "ExternalIdentitiesConfigurationClient", + "filename": "_external_identities_configuration_client", + "description": "External Identities Configuration Client.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": false, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ExternalIdentitiesConfigurationClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ExternalIdentitiesConfigurationClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000).", + "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 Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000).", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "operations": "Operations", + "guest_usages": "GuestUsagesOperations" + } +} \ No newline at end of file diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/_version.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/_version.py new file mode 100644 index 0000000000000..dfa6ee022f154 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/_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.0b2" diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/aio/__init__.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/aio/__init__.py new file mode 100644 index 0000000000000..c3afc1ec34601 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/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 ._external_identities_configuration_client import ExternalIdentitiesConfigurationClient +__all__ = ['ExternalIdentitiesConfigurationClient'] diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/aio/_configuration.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/aio/_configuration.py new file mode 100644 index 0000000000000..9f5aeccaaf1ad --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/aio/_configuration.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class ExternalIdentitiesConfigurationClientConfiguration(Configuration): + """Configuration for ExternalIdentitiesConfigurationClient. + + 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 Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(ExternalIdentitiesConfigurationClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2020-05-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-externalidentities/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/aio/_external_identities_configuration_client.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/aio/_external_identities_configuration_client.py new file mode 100644 index 0000000000000..863611c42f64c --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/aio/_external_identities_configuration_client.py @@ -0,0 +1,86 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import ExternalIdentitiesConfigurationClientConfiguration +from .operations import Operations +from .operations import GuestUsagesOperations +from .. import models + + +class ExternalIdentitiesConfigurationClient(object): + """External Identities Configuration Client. + + :ivar operations: Operations operations + :vartype operations: $(python-base-namespace).v2020_05_01_preview.aio.operations.Operations + :ivar guest_usages: GuestUsagesOperations operations + :vartype guest_usages: $(python-base-namespace).v2020_05_01_preview.aio.operations.GuestUsagesOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = ExternalIdentitiesConfigurationClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.guest_usages = GuestUsagesOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "ExternalIdentitiesConfigurationClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/aio/operations/__init__.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/aio/operations/__init__.py new file mode 100644 index 0000000000000..448e3531cc2f4 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/aio/operations/__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 ._operations import Operations +from ._guest_usages_operations import GuestUsagesOperations + +__all__ = [ + 'Operations', + 'GuestUsagesOperations', +] diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/aio/operations/_guest_usages_operations.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/aio/operations/_guest_usages_operations.py new file mode 100644 index 0000000000000..a501b8222e7b1 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/aio/operations/_guest_usages_operations.py @@ -0,0 +1,443 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class GuestUsagesOperations: + """GuestUsagesOperations 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: ~$(python-base-namespace).v2020_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def create( + self, + resource_group_name: str, + resource_name: str, + resource: Optional["_models.GuestUsagesResource"] = None, + **kwargs: Any + ) -> "_models.GuestUsagesResource": + """Creates a Guest Usages resource. + + Creates a Guest Usages resource for the Microsoft.AzureActiveDirectory resource provider. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_name: The initial domain name of the AAD tenant. + :type resource_name: str + :param resource: Guest Usages resource to be created. + :type resource: ~$(python-base-namespace).v2020_05_01_preview.models.GuestUsagesResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GuestUsagesResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2020_05_01_preview.models.GuestUsagesResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestUsagesResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if resource is not None: + body_content = self._serialize.body(resource, 'GuestUsagesResource') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GuestUsagesResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/guestUsages/{resourceName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + resource_name: str, + resource_patch: Optional["_models.GuestUsagesResourcePatch"] = None, + **kwargs: Any + ) -> "_models.GuestUsagesResource": + """Updates a Guest Usages resource. + + Updates a Guest Usages resource for the Microsoft.AzureActiveDirectory resource provider. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_name: The initial domain name of the AAD tenant. + :type resource_name: str + :param resource_patch: Guest Usages Resource to be updated. + :type resource_patch: ~$(python-base-namespace).v2020_05_01_preview.models.GuestUsagesResourcePatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GuestUsagesResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2020_05_01_preview.models.GuestUsagesResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestUsagesResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if resource_patch is not None: + body_content = self._serialize.body(resource_patch, 'GuestUsagesResourcePatch') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GuestUsagesResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/guestUsages/{resourceName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> None: + """Deletes a Guest Usages resource. + + Deletes a Guest Usages resource for the Microsoft.AzureActiveDirectory resource provider. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_name: The initial domain name of the AAD tenant. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/guestUsages/{resourceName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> "_models.GuestUsagesResource": + """Gets a Guest Usages resource. + + Gets a Guest Usages resource for the Microsoft.AzureActiveDirectory resource provider. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_name: The initial domain name of the AAD tenant. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GuestUsagesResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2020_05_01_preview.models.GuestUsagesResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestUsagesResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GuestUsagesResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/guestUsages/{resourceName}'} # type: ignore + + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.GuestUsagesResourceList"]: + """Gets Guest Usages resources under a subscription. + + Gets Guest Usages resources under a subscription for the Microsoft.AzureActiveDirectory + resource provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GuestUsagesResourceList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2020_05_01_preview.models.GuestUsagesResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestUsagesResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('GuestUsagesResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureActiveDirectory/guestUsages'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.GuestUsagesResourceList"]: + """Gets Guest Usages resources under resource group. + + Gets Guest Usages resources under a resource group for the Microsoft.AzureActiveDirectory + resource provider. + + :param resource_group_name: The name of the resource group. + :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 GuestUsagesResourceList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2020_05_01_preview.models.GuestUsagesResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestUsagesResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('GuestUsagesResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/guestUsages'} # type: ignore diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/aio/operations/_operations.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/aio/operations/_operations.py new file mode 100644 index 0000000000000..556f0b83a8b8d --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/aio/operations/_operations.py @@ -0,0 +1,104 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~$(python-base-namespace).v2020_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.OperationListResult"]: + """Lists the operations available from this provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2020_05_01_preview.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.AzureActiveDirectory/operations'} # type: ignore diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/models/__init__.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/models/__init__.py new file mode 100644 index 0000000000000..fa5e0bba5d7c1 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/models/__init__.py @@ -0,0 +1,37 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorResponse + from ._models_py3 import GuestUsagesResource + from ._models_py3 import GuestUsagesResourceList + from ._models_py3 import GuestUsagesResourcePatch + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationListResult +except (SyntaxError, ImportError): + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import GuestUsagesResource # type: ignore + from ._models import GuestUsagesResourceList # type: ignore + from ._models import GuestUsagesResourcePatch # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationListResult # type: ignore + +__all__ = [ + 'ErrorAdditionalInfo', + 'ErrorResponse', + 'GuestUsagesResource', + 'GuestUsagesResourceList', + 'GuestUsagesResourcePatch', + 'Operation', + 'OperationDisplay', + 'OperationListResult', +] diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/models/_models.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/models/_models.py new file mode 100644 index 0000000000000..581584d14380f --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/models/_models.py @@ -0,0 +1,270 @@ +# 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 msrest.serialization + + +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 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.). + + 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[~$(python-base-namespace).v2020_05_01_preview.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~$(python-base-namespace).v2020_05_01_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class GuestUsagesResource(msrest.serialization.Model): + """Guest Usages Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: An identifier that represents the Guest Usages resource. + :vartype id: str + :ivar name: The name of the Guest Usages resource. + :vartype name: str + :ivar type: The type of the Guest Usages resource. + :vartype type: str + :param location: Location of the Guest Usages resource. + :type location: str + :param tags: A set of tags. Key-value pairs of additional resource provisioning properties. + :type tags: dict[str, str] + :param tenant_id: An identifier for the tenant for which the resource is being created. + :type tenant_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GuestUsagesResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + self.tenant_id = kwargs.get('tenant_id', None) + + +class GuestUsagesResourceList(msrest.serialization.Model): + """The collection of guest usages resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of guest usages resources. + :vartype value: list[~$(python-base-namespace).v2020_05_01_preview.models.GuestUsagesResource] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[GuestUsagesResource]'}, + } + + def __init__( + self, + **kwargs + ): + super(GuestUsagesResourceList, self).__init__(**kwargs) + self.value = None + + +class GuestUsagesResourcePatch(msrest.serialization.Model): + """Guest Usages Resource for Patch. + + :param tags: A set of tags. Key-value pairs of additional resource provisioning properties. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(GuestUsagesResourcePatch, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + +class Operation(msrest.serialization.Model): + """Microsoft.AzureActiveDirectory REST API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~$(python-base-namespace).v2020_05_01_preview.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = kwargs.get('display', None) + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: Service provider: Microsoft.AzureActiveDirectory. + :vartype provider: str + :ivar resource: Resource on which the operation is performed: GuestUsages, etc. + :vartype resource: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str + :param description: Friendly name of the operation. + :type description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'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 = kwargs.get('description', None) + + +class OperationListResult(msrest.serialization.Model): + """Result of listing operations for the resourceProvider. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of cpim service operations supported by the Microsoft.AzureActiveDirectory + resource provider. + :vartype value: list[~$(python-base-namespace).v2020_05_01_preview.models.Operation] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = None diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/models/_models_py3.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/models/_models_py3.py new file mode 100644 index 0000000000000..4d7367bfb4dd9 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/models/_models_py3.py @@ -0,0 +1,282 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Dict, Optional + +import msrest.serialization + + +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 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.). + + 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[~$(python-base-namespace).v2020_05_01_preview.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~$(python-base-namespace).v2020_05_01_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class GuestUsagesResource(msrest.serialization.Model): + """Guest Usages Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: An identifier that represents the Guest Usages resource. + :vartype id: str + :ivar name: The name of the Guest Usages resource. + :vartype name: str + :ivar type: The type of the Guest Usages resource. + :vartype type: str + :param location: Location of the Guest Usages resource. + :type location: str + :param tags: A set of tags. Key-value pairs of additional resource provisioning properties. + :type tags: dict[str, str] + :param tenant_id: An identifier for the tenant for which the resource is being created. + :type tenant_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + tenant_id: Optional[str] = None, + **kwargs + ): + super(GuestUsagesResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + self.tenant_id = tenant_id + + +class GuestUsagesResourceList(msrest.serialization.Model): + """The collection of guest usages resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of guest usages resources. + :vartype value: list[~$(python-base-namespace).v2020_05_01_preview.models.GuestUsagesResource] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[GuestUsagesResource]'}, + } + + def __init__( + self, + **kwargs + ): + super(GuestUsagesResourceList, self).__init__(**kwargs) + self.value = None + + +class GuestUsagesResourcePatch(msrest.serialization.Model): + """Guest Usages Resource for Patch. + + :param tags: A set of tags. Key-value pairs of additional resource provisioning properties. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(GuestUsagesResourcePatch, self).__init__(**kwargs) + self.tags = tags + + +class Operation(msrest.serialization.Model): + """Microsoft.AzureActiveDirectory REST API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~$(python-base-namespace).v2020_05_01_preview.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + *, + display: Optional["OperationDisplay"] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = display + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: Service provider: Microsoft.AzureActiveDirectory. + :vartype provider: str + :ivar resource: Resource on which the operation is performed: GuestUsages, etc. + :vartype resource: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str + :param description: Friendly name of the operation. + :type description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'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, + *, + description: Optional[str] = None, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = description + + +class OperationListResult(msrest.serialization.Model): + """Result of listing operations for the resourceProvider. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of cpim service operations supported by the Microsoft.AzureActiveDirectory + resource provider. + :vartype value: list[~$(python-base-namespace).v2020_05_01_preview.models.Operation] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = None diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/operations/__init__.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/operations/__init__.py new file mode 100644 index 0000000000000..448e3531cc2f4 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/operations/__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 ._operations import Operations +from ._guest_usages_operations import GuestUsagesOperations + +__all__ = [ + 'Operations', + 'GuestUsagesOperations', +] diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/operations/_guest_usages_operations.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/operations/_guest_usages_operations.py new file mode 100644 index 0000000000000..d1886311e2070 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/operations/_guest_usages_operations.py @@ -0,0 +1,453 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class GuestUsagesOperations(object): + """GuestUsagesOperations 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: ~$(python-base-namespace).v2020_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def create( + self, + resource_group_name, # type: str + resource_name, # type: str + resource=None, # type: Optional["_models.GuestUsagesResource"] + **kwargs # type: Any + ): + # type: (...) -> "_models.GuestUsagesResource" + """Creates a Guest Usages resource. + + Creates a Guest Usages resource for the Microsoft.AzureActiveDirectory resource provider. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_name: The initial domain name of the AAD tenant. + :type resource_name: str + :param resource: Guest Usages resource to be created. + :type resource: ~$(python-base-namespace).v2020_05_01_preview.models.GuestUsagesResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GuestUsagesResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2020_05_01_preview.models.GuestUsagesResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestUsagesResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if resource is not None: + body_content = self._serialize.body(resource, 'GuestUsagesResource') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GuestUsagesResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/guestUsages/{resourceName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + resource_name, # type: str + resource_patch=None, # type: Optional["_models.GuestUsagesResourcePatch"] + **kwargs # type: Any + ): + # type: (...) -> "_models.GuestUsagesResource" + """Updates a Guest Usages resource. + + Updates a Guest Usages resource for the Microsoft.AzureActiveDirectory resource provider. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_name: The initial domain name of the AAD tenant. + :type resource_name: str + :param resource_patch: Guest Usages Resource to be updated. + :type resource_patch: ~$(python-base-namespace).v2020_05_01_preview.models.GuestUsagesResourcePatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GuestUsagesResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2020_05_01_preview.models.GuestUsagesResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestUsagesResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if resource_patch is not None: + body_content = self._serialize.body(resource_patch, 'GuestUsagesResourcePatch') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GuestUsagesResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/guestUsages/{resourceName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a Guest Usages resource. + + Deletes a Guest Usages resource for the Microsoft.AzureActiveDirectory resource provider. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_name: The initial domain name of the AAD tenant. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/guestUsages/{resourceName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.GuestUsagesResource" + """Gets a Guest Usages resource. + + Gets a Guest Usages resource for the Microsoft.AzureActiveDirectory resource provider. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_name: The initial domain name of the AAD tenant. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GuestUsagesResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2020_05_01_preview.models.GuestUsagesResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestUsagesResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GuestUsagesResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/guestUsages/{resourceName}'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.GuestUsagesResourceList"] + """Gets Guest Usages resources under a subscription. + + Gets Guest Usages resources under a subscription for the Microsoft.AzureActiveDirectory + resource provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GuestUsagesResourceList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2020_05_01_preview.models.GuestUsagesResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestUsagesResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('GuestUsagesResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureActiveDirectory/guestUsages'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.GuestUsagesResourceList"] + """Gets Guest Usages resources under resource group. + + Gets Guest Usages resources under a resource group for the Microsoft.AzureActiveDirectory + resource provider. + + :param resource_group_name: The name of the resource group. + :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 GuestUsagesResourceList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2020_05_01_preview.models.GuestUsagesResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestUsagesResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('GuestUsagesResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/guestUsages'} # type: ignore diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/operations/_operations.py b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/operations/_operations.py new file mode 100644 index 0000000000000..645948404a5bb --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/operations/_operations.py @@ -0,0 +1,109 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class Operations(object): + """Operations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~$(python-base-namespace).v2020_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.OperationListResult"] + """Lists the operations available from this provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2020_05_01_preview.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.AzureActiveDirectory/operations'} # type: ignore diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/py.typed b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/py.typed new file mode 100644 index 0000000000000..e5aff4f83af86 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/azure/mgmt/externalidentities/v2020_05_01_preview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/sdk_packaging.toml b/sdk/externalidentities/azure-mgmt-externalidentities/sdk_packaging.toml new file mode 100644 index 0000000000000..1b499ed21072b --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/sdk_packaging.toml @@ -0,0 +1,9 @@ +[packaging] +package_name = "azure-mgmt-externalidentities" +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/externalidentities/azure-mgmt-externalidentities/setup.cfg b/sdk/externalidentities/azure-mgmt-externalidentities/setup.cfg new file mode 100644 index 0000000000000..3c6e79cf31da1 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/externalidentities/azure-mgmt-externalidentities/setup.py b/sdk/externalidentities/azure-mgmt-externalidentities/setup.py new file mode 100644 index 0000000000000..9e74512c20966 --- /dev/null +++ b/sdk/externalidentities/azure-mgmt-externalidentities/setup.py @@ -0,0 +1,90 @@ +#!/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-externalidentities" +PACKAGE_PPRINT_NAME = "MyService Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# azure v0.x is not compatible with this package +# azure v0.x used to have a __version__ attribute (newer versions don't) +try: + import azure + try: + ver = azure.__version__ + raise Exception( + 'This package is incompatible with azure=={}. '.format(ver) + + 'Uninstall it with "pip uninstall azure".' + ) + except AttributeError: + pass +except ImportError: + pass + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +with open('README.md', encoding='utf-8') as f: + readme = f.read() +with open('CHANGELOG.md', encoding='utf-8') as f: + changelog = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + '\n\n' + changelog, + long_description_content_type='text/markdown', + license='MIT License', + author='Microsoft Corporation', + author_email='azpysdkhelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python', + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.mgmt', + ]), + install_requires=[ + 'msrest>=0.6.21', + 'azure-common~=1.1', + 'azure-mgmt-core>=1.2.0,<2.0.0', + ], + extras_require={ + ":python_version<'3.0'": ['azure-mgmt-nspkg'], + } +) diff --git a/sdk/externalidentities/ci.yml b/sdk/externalidentities/ci.yml new file mode 100644 index 0000000000000..7dc9a33d658fb --- /dev/null +++ b/sdk/externalidentities/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/externalidentities/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/externalidentities/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: externalidentities + Artifacts: + - name: azure-mgmt-externalidentities + safeName: azuremgmtexternalidentities