From aa38e184d4c66b6db5c0f721bf7fdca60a0d9570 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 8 Sep 2021 02:53:12 +0000 Subject: [PATCH] CodeGen from PR 15861 in Azure/azure-rest-api-specs [Hub Generated] Review request for Microsoft.Aadiam to add version preview/2020-03-01-preview and stable/2020-03-01 (#15861) * Adds base for updating Microsoft.Aadiam from version preview/2020-03-01-preview to version 2020-03-01 * Updates readme * Updates API version in new specs and examples * Adding changes from previous PR * Ran prettier, fixed types.json reference * Remove changes to preview version * Fix python failure * Try switching error locations * Change error location back * fix old examples * Try to fix python check --- .../CHANGELOG.md | 5 + .../MANIFEST.in | 6 + .../azure-mgmt-azureactivedirectory/README.md | 27 ++ .../_meta.json | 11 + .../azure/__init__.py | 1 + .../azure/mgmt/__init__.py | 1 + .../mgmt/azureactivedirectory/__init__.py | 19 + .../_azureactivedirectory.py | 92 ++++ .../azureactivedirectory/_configuration.py | 65 +++ .../mgmt/azureactivedirectory/_metadata.json | 93 ++++ .../mgmt/azureactivedirectory/_version.py | 9 + .../mgmt/azureactivedirectory/aio/__init__.py | 10 + .../aio/_azureactivedirectory.py | 85 ++++ .../aio/_configuration.py | 61 +++ .../aio/operations/__init__.py | 17 + ...diagnostic_settings_category_operations.py | 88 ++++ .../_diagnostic_settings_operations.py | 255 ++++++++++ .../aio/operations/_operations.py | 88 ++++ .../azureactivedirectory/models/__init__.py | 56 +++ .../models/_azureactivedirectory_enums.py | 42 ++ .../azureactivedirectory/models/_models.py | 417 ++++++++++++++++ .../models/_models_py3.py | 457 ++++++++++++++++++ .../operations/__init__.py | 17 + ...diagnostic_settings_category_operations.py | 93 ++++ .../_diagnostic_settings_operations.py | 263 ++++++++++ .../operations/_operations.py | 93 ++++ .../azure/mgmt/azureactivedirectory/py.typed | 1 + .../sdk_packaging.toml | 9 + .../azure-mgmt-azureactivedirectory/setup.cfg | 2 + .../azure-mgmt-azureactivedirectory/setup.py | 90 ++++ sdk/azureactivedirectory/ci.yml | 33 ++ 31 files changed, 2506 insertions(+) create mode 100644 sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/CHANGELOG.md create mode 100644 sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/MANIFEST.in create mode 100644 sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/README.md create mode 100644 sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/_meta.json create mode 100644 sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/__init__.py create mode 100644 sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/__init__.py create mode 100644 sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/__init__.py create mode 100644 sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/_azureactivedirectory.py create mode 100644 sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/_configuration.py create mode 100644 sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/_metadata.json create mode 100644 sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/_version.py create mode 100644 sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/aio/__init__.py create mode 100644 sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/aio/_azureactivedirectory.py create mode 100644 sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/aio/_configuration.py create mode 100644 sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/aio/operations/__init__.py create mode 100644 sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/aio/operations/_diagnostic_settings_category_operations.py create mode 100644 sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/aio/operations/_diagnostic_settings_operations.py create mode 100644 sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/aio/operations/_operations.py create mode 100644 sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/models/__init__.py create mode 100644 sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/models/_azureactivedirectory_enums.py create mode 100644 sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/models/_models.py create mode 100644 sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/models/_models_py3.py create mode 100644 sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/operations/__init__.py create mode 100644 sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/operations/_diagnostic_settings_category_operations.py create mode 100644 sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/operations/_diagnostic_settings_operations.py create mode 100644 sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/operations/_operations.py create mode 100644 sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/py.typed create mode 100644 sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/sdk_packaging.toml create mode 100644 sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/setup.cfg create mode 100644 sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/setup.py create mode 100644 sdk/azureactivedirectory/ci.yml diff --git a/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/CHANGELOG.md b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/MANIFEST.in b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/MANIFEST.in new file mode 100644 index 000000000000..3a9b6517412b --- /dev/null +++ b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/MANIFEST.in @@ -0,0 +1,6 @@ +include _meta.json +recursive-include tests *.py *.yaml +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py + diff --git a/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/README.md b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/README.md new file mode 100644 index 000000000000..d149771419df --- /dev/null +++ b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/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-azureactivedirectory%2FREADME.png) diff --git a/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/_meta.json b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/_meta.json new file mode 100644 index 000000000000..25c0901a6d70 --- /dev/null +++ b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.4.5", + "use": [ + "@autorest/python@5.8.4", + "@autorest/modelerfour@4.19.2" + ], + "commit": "7f3c455dd3f3d8fcfb42e20a428799b5c0452241", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/azureactivedirectory/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/azureactivedirectory/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/__init__.py b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/__init__.py b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/__init__.py b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/__init__.py new file mode 100644 index 000000000000..a9fb44deff34 --- /dev/null +++ b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/__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 ._azureactivedirectory import Azureactivedirectory +from ._version import VERSION + +__version__ = VERSION +__all__ = ['Azureactivedirectory'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/_azureactivedirectory.py b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/_azureactivedirectory.py new file mode 100644 index 000000000000..846972beb0d6 --- /dev/null +++ b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/_azureactivedirectory.py @@ -0,0 +1,92 @@ +# 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 AzureactivedirectoryConfiguration +from .operations import Operations +from .operations import DiagnosticSettingsOperations +from .operations import DiagnosticSettingsCategoryOperations +from . import models + + +class Azureactivedirectory(object): + """Azure Active Directory Client. + + :ivar operations: Operations operations + :vartype operations: azureactivedirectory.operations.Operations + :ivar diagnostic_settings: DiagnosticSettingsOperations operations + :vartype diagnostic_settings: azureactivedirectory.operations.DiagnosticSettingsOperations + :ivar diagnostic_settings_category: DiagnosticSettingsCategoryOperations operations + :vartype diagnostic_settings_category: azureactivedirectory.operations.DiagnosticSettingsCategoryOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param str base_url: Service URL + """ + + def __init__( + self, + credential, # type: "TokenCredential" + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = AzureactivedirectoryConfiguration(credential, **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.diagnostic_settings = DiagnosticSettingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.diagnostic_settings_category = DiagnosticSettingsCategoryOperations( + 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 + """ + http_request.url = self._client.format_url(http_request.url) + 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: () -> Azureactivedirectory + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/_configuration.py b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/_configuration.py new file mode 100644 index 000000000000..2671feef7657 --- /dev/null +++ b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/_configuration.py @@ -0,0 +1,65 @@ +# 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 AzureactivedirectoryConfiguration(Configuration): + """Configuration for Azureactivedirectory. + + 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 + """ + + def __init__( + self, + credential, # type: "TokenCredential" + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + super(AzureactivedirectoryConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.api_version = "2017-04-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-azureactivedirectory/{}'.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/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/_metadata.json b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/_metadata.json new file mode 100644 index 000000000000..c7c118882545 --- /dev/null +++ b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/_metadata.json @@ -0,0 +1,93 @@ +{ + "chosen_version": "2017-04-01-preview", + "total_api_version_list": ["2017-04-01-preview"], + "client": { + "name": "Azureactivedirectory", + "filename": "_azureactivedirectory", + "description": "Azure Active Directory 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\": [\"AzureactivedirectoryConfiguration\"]}}, \"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\": [\"AzureactivedirectoryConfiguration\"]}}, \"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 + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + } + }, + "constant": { + }, + "call": "credential", + "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", + "diagnostic_settings": "DiagnosticSettingsOperations", + "diagnostic_settings_category": "DiagnosticSettingsCategoryOperations" + } +} \ No newline at end of file diff --git a/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/_version.py b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/aio/__init__.py b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/aio/__init__.py new file mode 100644 index 000000000000..56bb2a0ededb --- /dev/null +++ b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/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 ._azureactivedirectory import Azureactivedirectory +__all__ = ['Azureactivedirectory'] diff --git a/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/aio/_azureactivedirectory.py b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/aio/_azureactivedirectory.py new file mode 100644 index 000000000000..e07ecbb3eade --- /dev/null +++ b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/aio/_azureactivedirectory.py @@ -0,0 +1,85 @@ +# 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 AzureactivedirectoryConfiguration +from .operations import Operations +from .operations import DiagnosticSettingsOperations +from .operations import DiagnosticSettingsCategoryOperations +from .. import models + + +class Azureactivedirectory(object): + """Azure Active Directory Client. + + :ivar operations: Operations operations + :vartype operations: azureactivedirectory.aio.operations.Operations + :ivar diagnostic_settings: DiagnosticSettingsOperations operations + :vartype diagnostic_settings: azureactivedirectory.aio.operations.DiagnosticSettingsOperations + :ivar diagnostic_settings_category: DiagnosticSettingsCategoryOperations operations + :vartype diagnostic_settings_category: azureactivedirectory.aio.operations.DiagnosticSettingsCategoryOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param str base_url: Service URL + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = AzureactivedirectoryConfiguration(credential, **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.diagnostic_settings = DiagnosticSettingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.diagnostic_settings_category = DiagnosticSettingsCategoryOperations( + 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 + """ + http_request.url = self._client.format_url(http_request.url) + 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) -> "Azureactivedirectory": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/aio/_configuration.py b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/aio/_configuration.py new file mode 100644 index 000000000000..1c2ef7263ec2 --- /dev/null +++ b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/aio/_configuration.py @@ -0,0 +1,61 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from 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 AzureactivedirectoryConfiguration(Configuration): + """Configuration for Azureactivedirectory. + + 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 + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + super(AzureactivedirectoryConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.api_version = "2017-04-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-azureactivedirectory/{}'.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/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/aio/operations/__init__.py b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/aio/operations/__init__.py new file mode 100644 index 000000000000..1b45ea462dad --- /dev/null +++ b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/aio/operations/__init__.py @@ -0,0 +1,17 @@ +# 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 ._diagnostic_settings_operations import DiagnosticSettingsOperations +from ._diagnostic_settings_category_operations import DiagnosticSettingsCategoryOperations + +__all__ = [ + 'Operations', + 'DiagnosticSettingsOperations', + 'DiagnosticSettingsCategoryOperations', +] diff --git a/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/aio/operations/_diagnostic_settings_category_operations.py b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/aio/operations/_diagnostic_settings_category_operations.py new file mode 100644 index 000000000000..3d6fa2506fd1 --- /dev/null +++ b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/aio/operations/_diagnostic_settings_category_operations.py @@ -0,0 +1,88 @@ +# 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, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, 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 DiagnosticSettingsCategoryOperations: + """DiagnosticSettingsCategoryOperations 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: ~azureactivedirectory.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 list( + self, + **kwargs: Any + ) -> "_models.DiagnosticSettingsCategoryResourceCollection": + """Lists the diagnostic settings categories for AadIam. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticSettingsCategoryResourceCollection, or the result of cls(response) + :rtype: ~azureactivedirectory.models.DiagnosticSettingsCategoryResourceCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticSettingsCategoryResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01-preview" + accept = "application/json" + + # 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticSettingsCategoryResourceCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/providers/microsoft.aadiam/diagnosticSettingsCategories'} # type: ignore diff --git a/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/aio/operations/_diagnostic_settings_operations.py b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/aio/operations/_diagnostic_settings_operations.py new file mode 100644 index 000000000000..aa528eb64822 --- /dev/null +++ b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/aio/operations/_diagnostic_settings_operations.py @@ -0,0 +1,255 @@ +# 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, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, 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 DiagnosticSettingsOperations: + """DiagnosticSettingsOperations 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: ~azureactivedirectory.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 list( + self, + **kwargs: Any + ) -> "_models.DiagnosticSettingsResourceCollection": + """Gets the active diagnostic settings list for AadIam. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticSettingsResourceCollection, or the result of cls(response) + :rtype: ~azureactivedirectory.models.DiagnosticSettingsResourceCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticSettingsResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01-preview" + accept = "application/json" + + # 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticSettingsResourceCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/providers/microsoft.aadiam/diagnosticSettings'} # type: ignore + + async def get( + self, + name: str, + **kwargs: Any + ) -> "_models.DiagnosticSettingsResource": + """Gets the active diagnostic setting for AadIam. + + :param name: The name of the diagnostic setting. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticSettingsResource, or the result of cls(response) + :rtype: ~azureactivedirectory.models.DiagnosticSettingsResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticSettingsResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticSettingsResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/providers/microsoft.aadiam/diagnosticSettings/{name}'} # type: ignore + + async def create_or_update( + self, + name: str, + parameters: "_models.DiagnosticSettingsResource", + **kwargs: Any + ) -> "_models.DiagnosticSettingsResource": + """Creates or updates diagnostic settings for AadIam. + + :param name: The name of the diagnostic setting. + :type name: str + :param parameters: Parameters supplied to the operation. + :type parameters: ~azureactivedirectory.models.DiagnosticSettingsResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticSettingsResource, or the result of cls(response) + :rtype: ~azureactivedirectory.models.DiagnosticSettingsResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticSettingsResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'DiagnosticSettingsResource') + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticSettingsResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/providers/microsoft.aadiam/diagnosticSettings/{name}'} # type: ignore + + async def delete( + self, + name: str, + **kwargs: Any + ) -> None: + """Deletes existing diagnostic setting for AadIam. + + :param name: The name of the diagnostic setting. + :type 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 = "2017-04-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'name': self._serialize.url("name", 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/providers/microsoft.aadiam/diagnosticSettings/{name}'} # type: ignore diff --git a/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/aio/operations/_operations.py b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/aio/operations/_operations.py new file mode 100644 index 000000000000..018b52b95cf2 --- /dev/null +++ b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/aio/operations/_operations.py @@ -0,0 +1,88 @@ +# 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, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, 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: ~azureactivedirectory.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 list( + self, + **kwargs: Any + ) -> "_models.OperationsDiscoveryCollection": + """Operation to return the list of available operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationsDiscoveryCollection, or the result of cls(response) + :rtype: ~azureactivedirectory.models.OperationsDiscoveryCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationsDiscoveryCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01-preview" + accept = "application/json" + + # 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('OperationsDiscoveryCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/providers/microsoft.aadiam/operations'} # type: ignore diff --git a/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/models/__init__.py b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/models/__init__.py new file mode 100644 index 000000000000..502fa5542477 --- /dev/null +++ b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/models/__init__.py @@ -0,0 +1,56 @@ +# 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 DiagnosticSettingsCategoryResource + from ._models_py3 import DiagnosticSettingsCategoryResourceCollection + from ._models_py3 import DiagnosticSettingsResource + from ._models_py3 import DiagnosticSettingsResourceCollection + from ._models_py3 import Display + from ._models_py3 import ErrorDefinition + from ._models_py3 import ErrorResponse + from ._models_py3 import LogSettings + from ._models_py3 import OperationsDiscovery + from ._models_py3 import OperationsDiscoveryCollection + from ._models_py3 import ProxyOnlyResource + from ._models_py3 import RetentionPolicy +except (SyntaxError, ImportError): + from ._models import DiagnosticSettingsCategoryResource # type: ignore + from ._models import DiagnosticSettingsCategoryResourceCollection # type: ignore + from ._models import DiagnosticSettingsResource # type: ignore + from ._models import DiagnosticSettingsResourceCollection # type: ignore + from ._models import Display # type: ignore + from ._models import ErrorDefinition # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import LogSettings # type: ignore + from ._models import OperationsDiscovery # type: ignore + from ._models import OperationsDiscoveryCollection # type: ignore + from ._models import ProxyOnlyResource # type: ignore + from ._models import RetentionPolicy # type: ignore + +from ._azureactivedirectory_enums import ( + Category, + CategoryType, +) + +__all__ = [ + 'DiagnosticSettingsCategoryResource', + 'DiagnosticSettingsCategoryResourceCollection', + 'DiagnosticSettingsResource', + 'DiagnosticSettingsResourceCollection', + 'Display', + 'ErrorDefinition', + 'ErrorResponse', + 'LogSettings', + 'OperationsDiscovery', + 'OperationsDiscoveryCollection', + 'ProxyOnlyResource', + 'RetentionPolicy', + 'Category', + 'CategoryType', +] diff --git a/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/models/_azureactivedirectory_enums.py b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/models/_azureactivedirectory_enums.py new file mode 100644 index 000000000000..2beb88375340 --- /dev/null +++ b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/models/_azureactivedirectory_enums.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from 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 Category(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Name of a Diagnostic Log category for a resource type this setting is applied to. To obtain the + list of Diagnostic Log categories for a resource, first perform a GET diagnostic settings + operation. + """ + + AUDIT_LOGS = "AuditLogs" + SIGN_IN_LOGS = "SignInLogs" + +class CategoryType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of the diagnostic settings category. + """ + + LOGS = "Logs" diff --git a/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/models/_models.py b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/models/_models.py new file mode 100644 index 000000000000..025bbed30f66 --- /dev/null +++ b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/models/_models.py @@ -0,0 +1,417 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class ProxyOnlyResource(msrest.serialization.Model): + """A proxy only azure resource object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProxyOnlyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class DiagnosticSettingsCategoryResource(ProxyOnlyResource): + """The diagnostic settings category resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :param category_type: The type of the diagnostic settings category. Possible values include: + "Logs". + :type category_type: str or ~azureactivedirectory.models.CategoryType + """ + + _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'}, + 'category_type': {'key': 'properties.categoryType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DiagnosticSettingsCategoryResource, self).__init__(**kwargs) + self.category_type = kwargs.get('category_type', None) + + +class DiagnosticSettingsCategoryResourceCollection(msrest.serialization.Model): + """Represents a collection of diagnostic setting category resources. + + :param value: The collection of diagnostic settings category resources. + :type value: list[~azureactivedirectory.models.DiagnosticSettingsCategoryResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DiagnosticSettingsCategoryResource]'}, + } + + def __init__( + self, + **kwargs + ): + super(DiagnosticSettingsCategoryResourceCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class DiagnosticSettingsResource(ProxyOnlyResource): + """The diagnostic setting resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :param storage_account_id: The resource ID of the storage account to which you would like to + send Diagnostic Logs. + :type storage_account_id: str + :param service_bus_rule_id: The service bus rule Id of the diagnostic setting. This is here to + maintain backwards compatibility. + :type service_bus_rule_id: str + :param workspace_id: The workspace ID (resource ID of a Log Analytics workspace) for a Log + Analytics workspace to which you would like to send Diagnostic Logs. Example: + /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. + :type workspace_id: str + :param event_hub_authorization_rule_id: The resource Id for the event hub authorization rule. + :type event_hub_authorization_rule_id: str + :param event_hub_name: The name of the event hub. If none is specified, the default event hub + will be selected. + :type event_hub_name: str + :param logs: The list of logs settings. + :type logs: list[~azureactivedirectory.models.LogSettings] + """ + + _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'}, + 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, + 'service_bus_rule_id': {'key': 'properties.serviceBusRuleId', 'type': 'str'}, + 'workspace_id': {'key': 'properties.workspaceId', 'type': 'str'}, + 'event_hub_authorization_rule_id': {'key': 'properties.eventHubAuthorizationRuleId', 'type': 'str'}, + 'event_hub_name': {'key': 'properties.eventHubName', 'type': 'str'}, + 'logs': {'key': 'properties.logs', 'type': '[LogSettings]'}, + } + + def __init__( + self, + **kwargs + ): + super(DiagnosticSettingsResource, self).__init__(**kwargs) + self.storage_account_id = kwargs.get('storage_account_id', None) + self.service_bus_rule_id = kwargs.get('service_bus_rule_id', None) + self.workspace_id = kwargs.get('workspace_id', None) + self.event_hub_authorization_rule_id = kwargs.get('event_hub_authorization_rule_id', None) + self.event_hub_name = kwargs.get('event_hub_name', None) + self.logs = kwargs.get('logs', None) + + +class DiagnosticSettingsResourceCollection(msrest.serialization.Model): + """Represents a collection of alert rule resources. + + :param value: The collection of diagnostic settings resources. + :type value: list[~azureactivedirectory.models.DiagnosticSettingsResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DiagnosticSettingsResource]'}, + } + + def __init__( + self, + **kwargs + ): + super(DiagnosticSettingsResourceCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class Display(msrest.serialization.Model): + """Contains the localized display information for this particular operation / action. These value will be used by several clients for (1) custom role definitions for RBAC; (2) complex query filters for the event service; and (3) audit history / records for management operations. + + :param publisher: The publisher. The localized friendly form of the resource publisher name. + :type publisher: str + :param provider: The provider. The localized friendly form of the resource provider name – it + is expected to also include the publisher/company responsible. It should use Title Casing and + begin with "Microsoft" for 1st party services. e.g. "Microsoft Monitoring Insights" or + "Microsoft Compute.". + :type provider: str + :param resource: The resource. The localized friendly form of the resource related to this + action/operation – it should match the public documentation for the resource provider. It + should use Title Casing. This value should be unique for a particular URL type (e.g. nested + types should *not* reuse their parent’s display.resource field). e.g. "Virtual Machines" or + "Scheduler Job Collections", or "Virtual Machine VM Sizes" or "Scheduler Jobs". + :type resource: str + :param operation: The operation. The localized friendly name for the operation, as it should be + shown to the user. It should be concise (to fit in drop downs) but clear (i.e. + self-documenting). It should use Title Casing. Prescriptive guidance: Read Create or Update + Delete 'ActionName'. + :type operation: str + :param description: The description. The localized friendly description for the operation, as + it should be shown to the user. It should be thorough, yet concise – it will be used in tool + tips and detailed views. Prescriptive guidance for namespaces: Read any 'display.provider' + resource Create or Update any 'display.provider' resource Delete any 'display.provider' + resource Perform any other action on any 'display.provider' resource Prescriptive guidance for + namespaces: Read any 'display.resource' Create or Update any 'display.resource' Delete any + 'display.resource' 'ActionName' any 'display.resources'. + :type description: str + """ + + _attribute_map = { + 'publisher': {'key': 'publisher', 'type': 'str'}, + '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(Display, self).__init__(**kwargs) + self.publisher = kwargs.get('publisher', None) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + self.description = kwargs.get('description', None) + + +class ErrorDefinition(msrest.serialization.Model): + """Error definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Service specific error code which serves as the substatus for the HTTP error code. + :vartype code: str + :ivar message: Description of the error. + :vartype message: str + :ivar details: Internal error details. + :vartype details: list[~azureactivedirectory.models.ErrorDefinition] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'details': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDefinition]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDefinition, self).__init__(**kwargs) + self.code = None + self.message = None + self.details = None + + +class ErrorResponse(msrest.serialization.Model): + """Error response. + + :param error: The error details. + :type error: ~azureactivedirectory.models.ErrorDefinition + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class LogSettings(msrest.serialization.Model): + """Part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log. + + All required parameters must be populated in order to send to Azure. + + :param category: Name of a Diagnostic Log category for a resource type this setting is applied + to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET + diagnostic settings operation. Possible values include: "AuditLogs", "SignInLogs". + :type category: str or ~azureactivedirectory.models.Category + :param enabled: Required. A value indicating whether this log is enabled. + :type enabled: bool + :param retention_policy: The retention policy for this log. + :type retention_policy: ~azureactivedirectory.models.RetentionPolicy + """ + + _validation = { + 'enabled': {'required': True}, + } + + _attribute_map = { + 'category': {'key': 'category', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, + } + + def __init__( + self, + **kwargs + ): + super(LogSettings, self).__init__(**kwargs) + self.category = kwargs.get('category', None) + self.enabled = kwargs['enabled'] + self.retention_policy = kwargs.get('retention_policy', None) + + +class OperationsDiscovery(msrest.serialization.Model): + """Operations discovery class. + + :param name: Name of the API. The name of the operation being performed on this particular + object. It should match the action name that appears in RBAC / the event service. Examples of + operations include: * Microsoft.Compute/virtualMachine/capture/action * + Microsoft.Compute/virtualMachine/restart/action * Microsoft.Compute/virtualMachine/write * + Microsoft.Compute/virtualMachine/read * Microsoft.Compute/virtualMachine/delete Each action + should include, in order: (1) Resource Provider Namespace (2) Type hierarchy for which the + action applies (e.g. server/databases for a SQL Azure database) (3) Read, Write, Action or + Delete indicating which type applies. If it is a PUT/PATCH on a collection or named value, + Write should be used. If it is a GET, Read should be used. If it is a DELETE, Delete should be + used. If it is a POST, Action should be used. + :type name: str + :param is_data_action: Indicates whether the operation applies to data-plane. Set the value to + true for data-plane operations and false for ARM/control-plane operations. + :type is_data_action: bool + :param display: Object type. + :type display: ~azureactivedirectory.models.Display + :param origin: Origin. The intended executor of the operation; governs the display of the + operation in the RBAC UX and the audit logs UX. Default value is "user,system". + :type origin: str + :param properties: Properties. Reserved for future use. + :type properties: any + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'Display'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationsDiscovery, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.is_data_action = kwargs.get('is_data_action', None) + self.display = kwargs.get('display', None) + self.origin = kwargs.get('origin', None) + self.properties = kwargs.get('properties', None) + + +class OperationsDiscoveryCollection(msrest.serialization.Model): + """Collection of ClientDiscovery details. + + :param value: The ClientDiscovery details. + :type value: list[~azureactivedirectory.models.OperationsDiscovery] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OperationsDiscovery]'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationsDiscoveryCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class RetentionPolicy(msrest.serialization.Model): + """Specifies the retention policy for the log. + + All required parameters must be populated in order to send to Azure. + + :param enabled: Required. A value indicating whether the retention policy is enabled. + :type enabled: bool + :param days: Required. The number of days for the retention in days. A value of 0 will retain + the events indefinitely. + :type days: int + """ + + _validation = { + 'enabled': {'required': True}, + 'days': {'required': True, 'minimum': 0}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'days': {'key': 'days', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(RetentionPolicy, self).__init__(**kwargs) + self.enabled = kwargs['enabled'] + self.days = kwargs['days'] diff --git a/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/models/_models_py3.py b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/models/_models_py3.py new file mode 100644 index 000000000000..ec07d26cf4d9 --- /dev/null +++ b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/models/_models_py3.py @@ -0,0 +1,457 @@ +# 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, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._azureactivedirectory_enums import * + + +class ProxyOnlyResource(msrest.serialization.Model): + """A proxy only azure resource object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProxyOnlyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class DiagnosticSettingsCategoryResource(ProxyOnlyResource): + """The diagnostic settings category resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :param category_type: The type of the diagnostic settings category. Possible values include: + "Logs". + :type category_type: str or ~azureactivedirectory.models.CategoryType + """ + + _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'}, + 'category_type': {'key': 'properties.categoryType', 'type': 'str'}, + } + + def __init__( + self, + *, + category_type: Optional[Union[str, "CategoryType"]] = None, + **kwargs + ): + super(DiagnosticSettingsCategoryResource, self).__init__(**kwargs) + self.category_type = category_type + + +class DiagnosticSettingsCategoryResourceCollection(msrest.serialization.Model): + """Represents a collection of diagnostic setting category resources. + + :param value: The collection of diagnostic settings category resources. + :type value: list[~azureactivedirectory.models.DiagnosticSettingsCategoryResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DiagnosticSettingsCategoryResource]'}, + } + + def __init__( + self, + *, + value: Optional[List["DiagnosticSettingsCategoryResource"]] = None, + **kwargs + ): + super(DiagnosticSettingsCategoryResourceCollection, self).__init__(**kwargs) + self.value = value + + +class DiagnosticSettingsResource(ProxyOnlyResource): + """The diagnostic setting resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :param storage_account_id: The resource ID of the storage account to which you would like to + send Diagnostic Logs. + :type storage_account_id: str + :param service_bus_rule_id: The service bus rule Id of the diagnostic setting. This is here to + maintain backwards compatibility. + :type service_bus_rule_id: str + :param workspace_id: The workspace ID (resource ID of a Log Analytics workspace) for a Log + Analytics workspace to which you would like to send Diagnostic Logs. Example: + /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. + :type workspace_id: str + :param event_hub_authorization_rule_id: The resource Id for the event hub authorization rule. + :type event_hub_authorization_rule_id: str + :param event_hub_name: The name of the event hub. If none is specified, the default event hub + will be selected. + :type event_hub_name: str + :param logs: The list of logs settings. + :type logs: list[~azureactivedirectory.models.LogSettings] + """ + + _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'}, + 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, + 'service_bus_rule_id': {'key': 'properties.serviceBusRuleId', 'type': 'str'}, + 'workspace_id': {'key': 'properties.workspaceId', 'type': 'str'}, + 'event_hub_authorization_rule_id': {'key': 'properties.eventHubAuthorizationRuleId', 'type': 'str'}, + 'event_hub_name': {'key': 'properties.eventHubName', 'type': 'str'}, + 'logs': {'key': 'properties.logs', 'type': '[LogSettings]'}, + } + + def __init__( + self, + *, + storage_account_id: Optional[str] = None, + service_bus_rule_id: Optional[str] = None, + workspace_id: Optional[str] = None, + event_hub_authorization_rule_id: Optional[str] = None, + event_hub_name: Optional[str] = None, + logs: Optional[List["LogSettings"]] = None, + **kwargs + ): + super(DiagnosticSettingsResource, self).__init__(**kwargs) + self.storage_account_id = storage_account_id + self.service_bus_rule_id = service_bus_rule_id + self.workspace_id = workspace_id + self.event_hub_authorization_rule_id = event_hub_authorization_rule_id + self.event_hub_name = event_hub_name + self.logs = logs + + +class DiagnosticSettingsResourceCollection(msrest.serialization.Model): + """Represents a collection of alert rule resources. + + :param value: The collection of diagnostic settings resources. + :type value: list[~azureactivedirectory.models.DiagnosticSettingsResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DiagnosticSettingsResource]'}, + } + + def __init__( + self, + *, + value: Optional[List["DiagnosticSettingsResource"]] = None, + **kwargs + ): + super(DiagnosticSettingsResourceCollection, self).__init__(**kwargs) + self.value = value + + +class Display(msrest.serialization.Model): + """Contains the localized display information for this particular operation / action. These value will be used by several clients for (1) custom role definitions for RBAC; (2) complex query filters for the event service; and (3) audit history / records for management operations. + + :param publisher: The publisher. The localized friendly form of the resource publisher name. + :type publisher: str + :param provider: The provider. The localized friendly form of the resource provider name – it + is expected to also include the publisher/company responsible. It should use Title Casing and + begin with "Microsoft" for 1st party services. e.g. "Microsoft Monitoring Insights" or + "Microsoft Compute.". + :type provider: str + :param resource: The resource. The localized friendly form of the resource related to this + action/operation – it should match the public documentation for the resource provider. It + should use Title Casing. This value should be unique for a particular URL type (e.g. nested + types should *not* reuse their parent’s display.resource field). e.g. "Virtual Machines" or + "Scheduler Job Collections", or "Virtual Machine VM Sizes" or "Scheduler Jobs". + :type resource: str + :param operation: The operation. The localized friendly name for the operation, as it should be + shown to the user. It should be concise (to fit in drop downs) but clear (i.e. + self-documenting). It should use Title Casing. Prescriptive guidance: Read Create or Update + Delete 'ActionName'. + :type operation: str + :param description: The description. The localized friendly description for the operation, as + it should be shown to the user. It should be thorough, yet concise – it will be used in tool + tips and detailed views. Prescriptive guidance for namespaces: Read any 'display.provider' + resource Create or Update any 'display.provider' resource Delete any 'display.provider' + resource Perform any other action on any 'display.provider' resource Prescriptive guidance for + namespaces: Read any 'display.resource' Create or Update any 'display.resource' Delete any + 'display.resource' 'ActionName' any 'display.resources'. + :type description: str + """ + + _attribute_map = { + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + publisher: Optional[str] = None, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + super(Display, self).__init__(**kwargs) + self.publisher = publisher + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class ErrorDefinition(msrest.serialization.Model): + """Error definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Service specific error code which serves as the substatus for the HTTP error code. + :vartype code: str + :ivar message: Description of the error. + :vartype message: str + :ivar details: Internal error details. + :vartype details: list[~azureactivedirectory.models.ErrorDefinition] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'details': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDefinition]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDefinition, self).__init__(**kwargs) + self.code = None + self.message = None + self.details = None + + +class ErrorResponse(msrest.serialization.Model): + """Error response. + + :param error: The error details. + :type error: ~azureactivedirectory.models.ErrorDefinition + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDefinition"] = None, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class LogSettings(msrest.serialization.Model): + """Part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log. + + All required parameters must be populated in order to send to Azure. + + :param category: Name of a Diagnostic Log category for a resource type this setting is applied + to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET + diagnostic settings operation. Possible values include: "AuditLogs", "SignInLogs". + :type category: str or ~azureactivedirectory.models.Category + :param enabled: Required. A value indicating whether this log is enabled. + :type enabled: bool + :param retention_policy: The retention policy for this log. + :type retention_policy: ~azureactivedirectory.models.RetentionPolicy + """ + + _validation = { + 'enabled': {'required': True}, + } + + _attribute_map = { + 'category': {'key': 'category', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, + } + + def __init__( + self, + *, + enabled: bool, + category: Optional[Union[str, "Category"]] = None, + retention_policy: Optional["RetentionPolicy"] = None, + **kwargs + ): + super(LogSettings, self).__init__(**kwargs) + self.category = category + self.enabled = enabled + self.retention_policy = retention_policy + + +class OperationsDiscovery(msrest.serialization.Model): + """Operations discovery class. + + :param name: Name of the API. The name of the operation being performed on this particular + object. It should match the action name that appears in RBAC / the event service. Examples of + operations include: * Microsoft.Compute/virtualMachine/capture/action * + Microsoft.Compute/virtualMachine/restart/action * Microsoft.Compute/virtualMachine/write * + Microsoft.Compute/virtualMachine/read * Microsoft.Compute/virtualMachine/delete Each action + should include, in order: (1) Resource Provider Namespace (2) Type hierarchy for which the + action applies (e.g. server/databases for a SQL Azure database) (3) Read, Write, Action or + Delete indicating which type applies. If it is a PUT/PATCH on a collection or named value, + Write should be used. If it is a GET, Read should be used. If it is a DELETE, Delete should be + used. If it is a POST, Action should be used. + :type name: str + :param is_data_action: Indicates whether the operation applies to data-plane. Set the value to + true for data-plane operations and false for ARM/control-plane operations. + :type is_data_action: bool + :param display: Object type. + :type display: ~azureactivedirectory.models.Display + :param origin: Origin. The intended executor of the operation; governs the display of the + operation in the RBAC UX and the audit logs UX. Default value is "user,system". + :type origin: str + :param properties: Properties. Reserved for future use. + :type properties: any + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'Display'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'object'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + is_data_action: Optional[bool] = None, + display: Optional["Display"] = None, + origin: Optional[str] = None, + properties: Optional[Any] = None, + **kwargs + ): + super(OperationsDiscovery, self).__init__(**kwargs) + self.name = name + self.is_data_action = is_data_action + self.display = display + self.origin = origin + self.properties = properties + + +class OperationsDiscoveryCollection(msrest.serialization.Model): + """Collection of ClientDiscovery details. + + :param value: The ClientDiscovery details. + :type value: list[~azureactivedirectory.models.OperationsDiscovery] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OperationsDiscovery]'}, + } + + def __init__( + self, + *, + value: Optional[List["OperationsDiscovery"]] = None, + **kwargs + ): + super(OperationsDiscoveryCollection, self).__init__(**kwargs) + self.value = value + + +class RetentionPolicy(msrest.serialization.Model): + """Specifies the retention policy for the log. + + All required parameters must be populated in order to send to Azure. + + :param enabled: Required. A value indicating whether the retention policy is enabled. + :type enabled: bool + :param days: Required. The number of days for the retention in days. A value of 0 will retain + the events indefinitely. + :type days: int + """ + + _validation = { + 'enabled': {'required': True}, + 'days': {'required': True, 'minimum': 0}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'days': {'key': 'days', 'type': 'int'}, + } + + def __init__( + self, + *, + enabled: bool, + days: int, + **kwargs + ): + super(RetentionPolicy, self).__init__(**kwargs) + self.enabled = enabled + self.days = days diff --git a/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/operations/__init__.py b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/operations/__init__.py new file mode 100644 index 000000000000..1b45ea462dad --- /dev/null +++ b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/operations/__init__.py @@ -0,0 +1,17 @@ +# 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 ._diagnostic_settings_operations import DiagnosticSettingsOperations +from ._diagnostic_settings_category_operations import DiagnosticSettingsCategoryOperations + +__all__ = [ + 'Operations', + 'DiagnosticSettingsOperations', + 'DiagnosticSettingsCategoryOperations', +] diff --git a/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/operations/_diagnostic_settings_category_operations.py b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/operations/_diagnostic_settings_category_operations.py new file mode 100644 index 000000000000..5d9f088aef20 --- /dev/null +++ b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/operations/_diagnostic_settings_category_operations.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 +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import 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, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class DiagnosticSettingsCategoryOperations(object): + """DiagnosticSettingsCategoryOperations 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: ~azureactivedirectory.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: (...) -> "_models.DiagnosticSettingsCategoryResourceCollection" + """Lists the diagnostic settings categories for AadIam. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticSettingsCategoryResourceCollection, or the result of cls(response) + :rtype: ~azureactivedirectory.models.DiagnosticSettingsCategoryResourceCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticSettingsCategoryResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01-preview" + accept = "application/json" + + # 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticSettingsCategoryResourceCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/providers/microsoft.aadiam/diagnosticSettingsCategories'} # type: ignore diff --git a/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/operations/_diagnostic_settings_operations.py b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/operations/_diagnostic_settings_operations.py new file mode 100644 index 000000000000..41f60442b08f --- /dev/null +++ b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/operations/_diagnostic_settings_operations.py @@ -0,0 +1,263 @@ +# 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.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, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class DiagnosticSettingsOperations(object): + """DiagnosticSettingsOperations 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: ~azureactivedirectory.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: (...) -> "_models.DiagnosticSettingsResourceCollection" + """Gets the active diagnostic settings list for AadIam. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticSettingsResourceCollection, or the result of cls(response) + :rtype: ~azureactivedirectory.models.DiagnosticSettingsResourceCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticSettingsResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01-preview" + accept = "application/json" + + # 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticSettingsResourceCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/providers/microsoft.aadiam/diagnosticSettings'} # type: ignore + + def get( + self, + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DiagnosticSettingsResource" + """Gets the active diagnostic setting for AadIam. + + :param name: The name of the diagnostic setting. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticSettingsResource, or the result of cls(response) + :rtype: ~azureactivedirectory.models.DiagnosticSettingsResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticSettingsResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticSettingsResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/providers/microsoft.aadiam/diagnosticSettings/{name}'} # type: ignore + + def create_or_update( + self, + name, # type: str + parameters, # type: "_models.DiagnosticSettingsResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.DiagnosticSettingsResource" + """Creates or updates diagnostic settings for AadIam. + + :param name: The name of the diagnostic setting. + :type name: str + :param parameters: Parameters supplied to the operation. + :type parameters: ~azureactivedirectory.models.DiagnosticSettingsResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticSettingsResource, or the result of cls(response) + :rtype: ~azureactivedirectory.models.DiagnosticSettingsResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticSettingsResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'DiagnosticSettingsResource') + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticSettingsResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/providers/microsoft.aadiam/diagnosticSettings/{name}'} # type: ignore + + def delete( + self, + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes existing diagnostic setting for AadIam. + + :param name: The name of the diagnostic setting. + :type 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 = "2017-04-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'name': self._serialize.url("name", 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/providers/microsoft.aadiam/diagnosticSettings/{name}'} # type: ignore diff --git a/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/operations/_operations.py b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/operations/_operations.py new file mode 100644 index 000000000000..2ddb8575a629 --- /dev/null +++ b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/operations/_operations.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 +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import 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, 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: ~azureactivedirectory.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: (...) -> "_models.OperationsDiscoveryCollection" + """Operation to return the list of available operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationsDiscoveryCollection, or the result of cls(response) + :rtype: ~azureactivedirectory.models.OperationsDiscoveryCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationsDiscoveryCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01-preview" + accept = "application/json" + + # 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('OperationsDiscoveryCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/providers/microsoft.aadiam/operations'} # type: ignore diff --git a/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/py.typed b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/azure/mgmt/azureactivedirectory/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/sdk_packaging.toml b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/sdk_packaging.toml new file mode 100644 index 000000000000..0c0e1dbda372 --- /dev/null +++ b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/sdk_packaging.toml @@ -0,0 +1,9 @@ +[packaging] +package_name = "azure-mgmt-azureactivedirectory" +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/azureactivedirectory/azure-mgmt-azureactivedirectory/setup.cfg b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/setup.py b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/setup.py new file mode 100644 index 000000000000..48c6f64436c0 --- /dev/null +++ b/sdk/azureactivedirectory/azure-mgmt-azureactivedirectory/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-azureactivedirectory" +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/azureactivedirectory/ci.yml b/sdk/azureactivedirectory/ci.yml new file mode 100644 index 000000000000..31a8df1b8efa --- /dev/null +++ b/sdk/azureactivedirectory/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/azureactivedirectory/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/azureactivedirectory/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: azureactivedirectory + Artifacts: + - name: azure-mgmt-azureactivedirectory + safeName: azuremgmtazureactivedirectory