From ee3766f6e8b8a014b14494424c7fd0190b7a3bef Mon Sep 17 00:00:00 2001 From: xichen Date: Thu, 10 Sep 2020 10:01:21 +0800 Subject: [PATCH 1/3] add automanage ci --- sdk/automanage/ci.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 sdk/automanage/ci.yml diff --git a/sdk/automanage/ci.yml b/sdk/automanage/ci.yml new file mode 100644 index 000000000000..ee8774e96be4 --- /dev/null +++ b/sdk/automanage/ci.yml @@ -0,0 +1,32 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - master + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/automanage/ + +pr: + branches: + include: + - master + - feature/* + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/automanage/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: automanage + Artifacts: + - name: azure_mgmt_automanage + safeName: azuremgmtautomanage From 81230e6c785882038a2d1dabff0e67038376190a Mon Sep 17 00:00:00 2001 From: xichen Date: Thu, 10 Sep 2020 10:03:11 +0800 Subject: [PATCH 2/3] auto generated sdk --- .../azure-mgmt-automanage/CHANGELOG.md | 5 + .../azure-mgmt-automanage/MANIFEST.in | 5 + .../azure-mgmt-automanage/README.md | 21 + .../azure-mgmt-automanage/azure/__init__.py | 1 + .../azure/mgmt/__init__.py | 1 + .../azure/mgmt/automanage/__init__.py | 19 + .../mgmt/automanage/_automanage_client.py | 84 ++ .../azure/mgmt/automanage/_configuration.py | 70 ++ .../azure/mgmt/automanage/_metadata.json | 56 ++ .../azure/mgmt/automanage/_version.py | 9 + .../azure/mgmt/automanage/aio/__init__.py | 10 + .../aio/_automanage_client_async.py | 78 ++ .../automanage/aio/_configuration_async.py | 66 ++ .../aio/operations_async/__init__.py | 19 + .../_accounts_operations_async.py | 416 +++++++++ ...on_profile_assignments_operations_async.py | 421 +++++++++ ...on_profile_preferences_operations_async.py | 416 +++++++++ .../aio/operations_async/_operations_async.py | 102 +++ .../azure/mgmt/automanage/models/__init__.py | 102 +++ .../models/_automanage_client_enums.py | 61 ++ .../azure/mgmt/automanage/models/_models.py | 760 ++++++++++++++++ .../mgmt/automanage/models/_models_py3.py | 828 ++++++++++++++++++ .../mgmt/automanage/operations/__init__.py | 19 + .../operations/_accounts_operations.py | 426 +++++++++ ...guration_profile_assignments_operations.py | 431 +++++++++ ...guration_profile_preferences_operations.py | 426 +++++++++ .../mgmt/automanage/operations/_operations.py | 107 +++ .../azure/mgmt/automanage/py.typed | 1 + .../azure-mgmt-automanage/sdk_packaging.toml | 8 + .../azure-mgmt-automanage/setup.cfg | 2 + sdk/automanage/azure-mgmt-automanage/setup.py | 90 ++ 31 files changed, 5060 insertions(+) create mode 100644 sdk/automanage/azure-mgmt-automanage/CHANGELOG.md create mode 100644 sdk/automanage/azure-mgmt-automanage/MANIFEST.in create mode 100644 sdk/automanage/azure-mgmt-automanage/README.md create mode 100644 sdk/automanage/azure-mgmt-automanage/azure/__init__.py create mode 100644 sdk/automanage/azure-mgmt-automanage/azure/mgmt/__init__.py create mode 100644 sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/__init__.py create mode 100644 sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/_automanage_client.py create mode 100644 sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/_configuration.py create mode 100644 sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/_metadata.json create mode 100644 sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/_version.py create mode 100644 sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/aio/__init__.py create mode 100644 sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/aio/_automanage_client_async.py create mode 100644 sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/aio/_configuration_async.py create mode 100644 sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/aio/operations_async/__init__.py create mode 100644 sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/aio/operations_async/_accounts_operations_async.py create mode 100644 sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/aio/operations_async/_configuration_profile_assignments_operations_async.py create mode 100644 sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/aio/operations_async/_configuration_profile_preferences_operations_async.py create mode 100644 sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/aio/operations_async/_operations_async.py create mode 100644 sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/models/__init__.py create mode 100644 sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/models/_automanage_client_enums.py create mode 100644 sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/models/_models.py create mode 100644 sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/models/_models_py3.py create mode 100644 sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/operations/__init__.py create mode 100644 sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/operations/_accounts_operations.py create mode 100644 sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/operations/_configuration_profile_assignments_operations.py create mode 100644 sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/operations/_configuration_profile_preferences_operations.py create mode 100644 sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/operations/_operations.py create mode 100644 sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/py.typed create mode 100644 sdk/automanage/azure-mgmt-automanage/sdk_packaging.toml create mode 100644 sdk/automanage/azure-mgmt-automanage/setup.cfg create mode 100644 sdk/automanage/azure-mgmt-automanage/setup.py diff --git a/sdk/automanage/azure-mgmt-automanage/CHANGELOG.md b/sdk/automanage/azure-mgmt-automanage/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/automanage/azure-mgmt-automanage/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/automanage/azure-mgmt-automanage/MANIFEST.in b/sdk/automanage/azure-mgmt-automanage/MANIFEST.in new file mode 100644 index 000000000000..a3cb07df8765 --- /dev/null +++ b/sdk/automanage/azure-mgmt-automanage/MANIFEST.in @@ -0,0 +1,5 @@ +recursive-include tests *.py *.yaml +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py + diff --git a/sdk/automanage/azure-mgmt-automanage/README.md b/sdk/automanage/azure-mgmt-automanage/README.md new file mode 100644 index 000000000000..ba3cf7ffbde6 --- /dev/null +++ b/sdk/automanage/azure-mgmt-automanage/README.md @@ -0,0 +1,21 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure MyService Management Client Library. +This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + + +# Usage + +For code examples, see [MyService Management](https://docs.microsoft.com/python/api/overview/azure/) +on docs.microsoft.com. + + +# 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-automanage%2FREADME.png) diff --git a/sdk/automanage/azure-mgmt-automanage/azure/__init__.py b/sdk/automanage/azure-mgmt-automanage/azure/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/automanage/azure-mgmt-automanage/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/automanage/azure-mgmt-automanage/azure/mgmt/__init__.py b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/__init__.py b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/__init__.py new file mode 100644 index 000000000000..e9400926d2ea --- /dev/null +++ b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/__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 ._automanage_client import AutomanageClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['AutomanageClient'] + +try: + from ._patch import patch_sdk + patch_sdk() +except ImportError: + pass diff --git a/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/_automanage_client.py b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/_automanage_client.py new file mode 100644 index 000000000000..a35de5853806 --- /dev/null +++ b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/_automanage_client.py @@ -0,0 +1,84 @@ +# 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 ._configuration import AutomanageClientConfiguration +from .operations import AccountsOperations +from .operations import ConfigurationProfileAssignmentsOperations +from .operations import ConfigurationProfilePreferencesOperations +from .operations import Operations +from . import models + + +class AutomanageClient(object): + """Automanage Client. + + :ivar accounts: AccountsOperations operations + :vartype accounts: automanage_client.operations.AccountsOperations + :ivar configuration_profile_assignments: ConfigurationProfileAssignmentsOperations operations + :vartype configuration_profile_assignments: automanage_client.operations.ConfigurationProfileAssignmentsOperations + :ivar configuration_profile_preferences: ConfigurationProfilePreferencesOperations operations + :vartype configuration_profile_preferences: automanage_client.operations.ConfigurationProfilePreferencesOperations + :ivar operations: Operations operations + :vartype operations: automanage_client.operations.Operations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = AutomanageClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.accounts = AccountsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.configuration_profile_assignments = ConfigurationProfileAssignmentsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.configuration_profile_preferences = ConfigurationProfilePreferencesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> AutomanageClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/_configuration.py b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/_configuration.py new file mode 100644 index 000000000000..1c10217f4124 --- /dev/null +++ b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/_configuration.py @@ -0,0 +1,70 @@ +# 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 ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class AutomanageClientConfiguration(Configuration): + """Configuration for AutomanageClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(AutomanageClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2020-06-30-preview" + self.credential_scopes = ['https://management.azure.com/.default'] + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + kwargs.setdefault('sdk_moniker', 'mgmt-automanage/{}'.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.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/automanage/azure-mgmt-automanage/azure/mgmt/automanage/_metadata.json b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/_metadata.json new file mode 100644 index 000000000000..3ce69338c090 --- /dev/null +++ b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/_metadata.json @@ -0,0 +1,56 @@ +{ + "chosen_version": "2020-06-30-preview", + "total_api_version_list": ["2020-06-30-preview"], + "client": { + "name": "AutomanageClient", + "filename": "_automanage_client", + "description": "Automanage Client." + }, + "global_parameters": { + "sync_method": { + "credential": { + "method_signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "method_signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "async_method": { + "credential": { + "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "method_signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id" + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"] + }, + "operation_groups": { + "accounts": "AccountsOperations", + "configuration_profile_assignments": "ConfigurationProfileAssignmentsOperations", + "configuration_profile_preferences": "ConfigurationProfilePreferencesOperations", + "operations": "Operations" + }, + "operation_mixins": { + }, + "sync_imports": "None", + "async_imports": "None" +} \ No newline at end of file diff --git a/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/_version.py b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/_version.py new file mode 100644 index 000000000000..95e84007ac63 --- /dev/null +++ b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/_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 = "0.1.0-preview" diff --git a/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/aio/__init__.py b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/aio/__init__.py new file mode 100644 index 000000000000..a724e312f9bb --- /dev/null +++ b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/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 ._automanage_client_async import AutomanageClient +__all__ = ['AutomanageClient'] diff --git a/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/aio/_automanage_client_async.py b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/aio/_automanage_client_async.py new file mode 100644 index 000000000000..e8d0de459d55 --- /dev/null +++ b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/aio/_automanage_client_async.py @@ -0,0 +1,78 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration_async import AutomanageClientConfiguration +from .operations_async import AccountsOperations +from .operations_async import ConfigurationProfileAssignmentsOperations +from .operations_async import ConfigurationProfilePreferencesOperations +from .operations_async import Operations +from .. import models + + +class AutomanageClient(object): + """Automanage Client. + + :ivar accounts: AccountsOperations operations + :vartype accounts: automanage_client.aio.operations_async.AccountsOperations + :ivar configuration_profile_assignments: ConfigurationProfileAssignmentsOperations operations + :vartype configuration_profile_assignments: automanage_client.aio.operations_async.ConfigurationProfileAssignmentsOperations + :ivar configuration_profile_preferences: ConfigurationProfilePreferencesOperations operations + :vartype configuration_profile_preferences: automanage_client.aio.operations_async.ConfigurationProfilePreferencesOperations + :ivar operations: Operations operations + :vartype operations: automanage_client.aio.operations_async.Operations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = AutomanageClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.accounts = AccountsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.configuration_profile_assignments = ConfigurationProfileAssignmentsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.configuration_profile_preferences = ConfigurationProfilePreferencesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "AutomanageClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/aio/_configuration_async.py b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/aio/_configuration_async.py new file mode 100644 index 000000000000..7c433b80ceb5 --- /dev/null +++ b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/aio/_configuration_async.py @@ -0,0 +1,66 @@ +# 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 .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class AutomanageClientConfiguration(Configuration): + """Configuration for AutomanageClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(AutomanageClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2020-06-30-preview" + self.credential_scopes = ['https://management.azure.com/.default'] + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + kwargs.setdefault('sdk_moniker', 'mgmt-automanage/{}'.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.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/automanage/azure-mgmt-automanage/azure/mgmt/automanage/aio/operations_async/__init__.py b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/aio/operations_async/__init__.py new file mode 100644 index 000000000000..6f24ade3b739 --- /dev/null +++ b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/aio/operations_async/__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 ._accounts_operations_async import AccountsOperations +from ._configuration_profile_assignments_operations_async import ConfigurationProfileAssignmentsOperations +from ._configuration_profile_preferences_operations_async import ConfigurationProfilePreferencesOperations +from ._operations_async import Operations + +__all__ = [ + 'AccountsOperations', + 'ConfigurationProfileAssignmentsOperations', + 'ConfigurationProfilePreferencesOperations', + 'Operations', +] diff --git a/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/aio/operations_async/_accounts_operations_async.py b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/aio/operations_async/_accounts_operations_async.py new file mode 100644 index 000000000000..f589ce7b5e54 --- /dev/null +++ b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/aio/operations_async/_accounts_operations_async.py @@ -0,0 +1,416 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import 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 + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AccountsOperations: + """AccountsOperations 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: ~automanage_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def create_or_update( + self, + account_name: str, + resource_group_name: str, + parameters: "models.Account", + **kwargs + ) -> "models.Account": + """Creates an Automanage Account. + + :param account_name: Name of the Automanage account. + :type account_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param parameters: Parameters supplied to create or update Automanage account. + :type parameters: ~automanage_client.models.Account + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Account, or the result of cls(response) + :rtype: ~automanage_client.models.Account + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Account"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-30-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'accountName': self._serialize.url("account_name", account_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Account') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Account', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Account', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/accounts/{accountName}'} # type: ignore + + async def get( + self, + account_name: str, + resource_group_name: str, + **kwargs + ) -> "models.Account": + """Get information about a Automanage account. + + :param account_name: The Automanage account name. + :type account_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Account, or the result of cls(response) + :rtype: ~automanage_client.models.Account + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Account"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-30-preview" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'accountName': self._serialize.url("account_name", account_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = 'application/json' + + 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(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Account', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/accounts/{accountName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + account_name: str, + **kwargs + ) -> None: + """Delete a Automanage account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: Name of the Automanage account. + :type account_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-30-preview" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/accounts/{accountName}'} # type: ignore + + async def update( + self, + account_name: str, + resource_group_name: str, + parameters: "models.AccountUpdate", + **kwargs + ) -> "models.Account": + """Updates an Automanage Account. + + :param account_name: Name of the Automanage account. + :type account_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param parameters: Parameters supplied to update Automanage account. + :type parameters: ~automanage_client.models.AccountUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Account, or the result of cls(response) + :rtype: ~automanage_client.models.Account + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Account"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-30-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'accountName': self._serialize.url("account_name", account_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'AccountUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Account', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/accounts/{accountName}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["models.AccountList"]: + """Retrieve a list of Automanage accounts within a given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AccountList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~automanage_client.models.AccountList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AccountList"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-30-preview" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AccountList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/accounts'} # type: ignore + + def list_by_subscription( + self, + **kwargs + ) -> AsyncIterable["models.AccountList"]: + """Retrieve a list of Automanage accounts within a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AccountList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~automanage_client.models.AccountList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AccountList"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-30-preview" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AccountList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Automanage/accounts'} # type: ignore diff --git a/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/aio/operations_async/_configuration_profile_assignments_operations_async.py b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/aio/operations_async/_configuration_profile_assignments_operations_async.py new file mode 100644 index 000000000000..407543075917 --- /dev/null +++ b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/aio/operations_async/_configuration_profile_assignments_operations_async.py @@ -0,0 +1,421 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ConfigurationProfileAssignmentsOperations: + """ConfigurationProfileAssignmentsOperations 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: ~automanage_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _create_or_update_initial( + self, + configuration_profile_assignment_name: str, + resource_group_name: str, + vm_name: str, + parameters: "models.ConfigurationProfileAssignment", + **kwargs + ) -> "models.ConfigurationProfileAssignment": + cls = kwargs.pop('cls', None) # type: ClsType["models.ConfigurationProfileAssignment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-30-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'configurationProfileAssignmentName': self._serialize.url("configuration_profile_assignment_name", configuration_profile_assignment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'vmName': self._serialize.url("vm_name", vm_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'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ConfigurationProfileAssignment') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigurationProfileAssignment', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ConfigurationProfileAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}'} # type: ignore + + async def begin_create_or_update( + self, + configuration_profile_assignment_name: str, + resource_group_name: str, + vm_name: str, + parameters: "models.ConfigurationProfileAssignment", + **kwargs + ) -> AsyncLROPoller["models.ConfigurationProfileAssignment"]: + """Creates an association between a VM and Automanage configuration profile. + + :param configuration_profile_assignment_name: Name of the configuration profile assignment. + Only default is supported. + :type configuration_profile_assignment_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param parameters: Parameters supplied to the create or update configuration profile + assignment. + :type parameters: ~automanage_client.models.ConfigurationProfileAssignment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigurationProfileAssignment or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~automanage_client.models.ConfigurationProfileAssignment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.ConfigurationProfileAssignment"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + configuration_profile_assignment_name=configuration_profile_assignment_name, + resource_group_name=resource_group_name, + vm_name=vm_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ConfigurationProfileAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + configuration_profile_assignment_name: str, + vm_name: str, + **kwargs + ) -> "models.ConfigurationProfileAssignment": + """Get information about a configuration profile assignment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param configuration_profile_assignment_name: The configuration profile assignment name. + :type configuration_profile_assignment_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigurationProfileAssignment, or the result of cls(response) + :rtype: ~automanage_client.models.ConfigurationProfileAssignment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ConfigurationProfileAssignment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-30-preview" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'configurationProfileAssignmentName': self._serialize.url("configuration_profile_assignment_name", configuration_profile_assignment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'vmName': self._serialize.url("vm_name", vm_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'] = 'application/json' + + 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(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConfigurationProfileAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + configuration_profile_assignment_name: str, + vm_name: str, + **kwargs + ) -> None: + """Delete a configuration profile assignment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param configuration_profile_assignment_name: Name of the configuration profile assignment. + :type configuration_profile_assignment_name: str + :param vm_name: The name of the virtual machine. + :type vm_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-30-preview" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'configurationProfileAssignmentName': self._serialize.url("configuration_profile_assignment_name", configuration_profile_assignment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'vmName': self._serialize.url("vm_name", vm_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] + + 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(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}'} # type: ignore + + def list( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["models.ConfigurationProfileAssignmentList"]: + """Get list of configuration profile assignments. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConfigurationProfileAssignmentList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~automanage_client.models.ConfigurationProfileAssignmentList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ConfigurationProfileAssignmentList"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-30-preview" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ConfigurationProfileAssignmentList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfileAssignments'} # type: ignore + + def list_by_subscription( + self, + **kwargs + ) -> AsyncIterable["models.ConfigurationProfileAssignmentList"]: + """Get list of configuration profile assignments under a given subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConfigurationProfileAssignmentList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~automanage_client.models.ConfigurationProfileAssignmentList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ConfigurationProfileAssignmentList"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-30-preview" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ConfigurationProfileAssignmentList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Automanage/configurationProfileAssignments'} # type: ignore diff --git a/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/aio/operations_async/_configuration_profile_preferences_operations_async.py b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/aio/operations_async/_configuration_profile_preferences_operations_async.py new file mode 100644 index 000000000000..f4e7c2bf76db --- /dev/null +++ b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/aio/operations_async/_configuration_profile_preferences_operations_async.py @@ -0,0 +1,416 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import 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 + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ConfigurationProfilePreferencesOperations: + """ConfigurationProfilePreferencesOperations 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: ~automanage_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def create_or_update( + self, + configuration_profile_preference_name: str, + resource_group_name: str, + parameters: "models.ConfigurationProfilePreference", + **kwargs + ) -> "models.ConfigurationProfilePreference": + """Creates a configuration profile preference. + + :param configuration_profile_preference_name: Name of the configuration profile preference. + :type configuration_profile_preference_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param parameters: Parameters supplied to create or update configuration profile preference. + :type parameters: ~automanage_client.models.ConfigurationProfilePreference + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigurationProfilePreference, or the result of cls(response) + :rtype: ~automanage_client.models.ConfigurationProfilePreference + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ConfigurationProfilePreference"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-30-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'configurationProfilePreferenceName': self._serialize.url("configuration_profile_preference_name", configuration_profile_preference_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ConfigurationProfilePreference') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigurationProfilePreference', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ConfigurationProfilePreference', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfilePreferences/{configurationProfilePreferenceName}'} # type: ignore + + async def get( + self, + configuration_profile_preference_name: str, + resource_group_name: str, + **kwargs + ) -> "models.ConfigurationProfilePreference": + """Get information about a configuration profile preference. + + :param configuration_profile_preference_name: The configuration profile preference name. + :type configuration_profile_preference_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigurationProfilePreference, or the result of cls(response) + :rtype: ~automanage_client.models.ConfigurationProfilePreference + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ConfigurationProfilePreference"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-30-preview" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'configurationProfilePreferenceName': self._serialize.url("configuration_profile_preference_name", configuration_profile_preference_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = 'application/json' + + 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(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConfigurationProfilePreference', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfilePreferences/{configurationProfilePreferenceName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + configuration_profile_preference_name: str, + **kwargs + ) -> None: + """Delete a configuration profile preference. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param configuration_profile_preference_name: Name of the configuration profile preference. + :type configuration_profile_preference_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-30-preview" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'configurationProfilePreferenceName': self._serialize.url("configuration_profile_preference_name", configuration_profile_preference_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfilePreferences/{configurationProfilePreferenceName}'} # type: ignore + + async def update( + self, + configuration_profile_preference_name: str, + resource_group_name: str, + parameters: "models.ConfigurationProfilePreferenceUpdate", + **kwargs + ) -> "models.ConfigurationProfilePreference": + """Updates a configuration profile preference. + + :param configuration_profile_preference_name: Name of the configuration profile preference. + :type configuration_profile_preference_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param parameters: Parameters supplied to create or update configuration profile preference. + :type parameters: ~automanage_client.models.ConfigurationProfilePreferenceUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigurationProfilePreference, or the result of cls(response) + :rtype: ~automanage_client.models.ConfigurationProfilePreference + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ConfigurationProfilePreference"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-30-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'configurationProfilePreferenceName': self._serialize.url("configuration_profile_preference_name", configuration_profile_preference_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ConfigurationProfilePreferenceUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConfigurationProfilePreference', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfilePreferences/{configurationProfilePreferenceName}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["models.ConfigurationProfilePreferenceList"]: + """Retrieve a list of configuration profile preferences within a given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConfigurationProfilePreferenceList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~automanage_client.models.ConfigurationProfilePreferenceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ConfigurationProfilePreferenceList"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-30-preview" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ConfigurationProfilePreferenceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfilePreferences'} # type: ignore + + def list_by_subscription( + self, + **kwargs + ) -> AsyncIterable["models.ConfigurationProfilePreferenceList"]: + """Retrieve a list of configuration profile preferences within a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConfigurationProfilePreferenceList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~automanage_client.models.ConfigurationProfilePreferenceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ConfigurationProfilePreferenceList"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-30-preview" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ConfigurationProfilePreferenceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Automanage/configurationProfilePreferences'} # type: ignore diff --git a/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/aio/operations_async/_operations_async.py b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/aio/operations_async/_operations_async.py new file mode 100644 index 000000000000..a584b47e9553 --- /dev/null +++ b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/aio/operations_async/_operations_async.py @@ -0,0 +1,102 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import 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 + +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: ~automanage_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs + ) -> AsyncIterable["models.OperationList"]: + """Lists all of the available Automanage REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~automanage_client.models.OperationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationList"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-30-preview" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Automanage/operations'} # type: ignore diff --git a/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/models/__init__.py b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/models/__init__.py new file mode 100644 index 000000000000..1bce4240a948 --- /dev/null +++ b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/models/__init__.py @@ -0,0 +1,102 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import Account + from ._models_py3 import AccountIdentity + from ._models_py3 import AccountList + from ._models_py3 import AccountUpdate + from ._models_py3 import ConfigurationProfileAssignment + from ._models_py3 import ConfigurationProfileAssignmentCompliance + from ._models_py3 import ConfigurationProfileAssignmentList + from ._models_py3 import ConfigurationProfileAssignmentProperties + from ._models_py3 import ConfigurationProfilePreference + from ._models_py3 import ConfigurationProfilePreferenceAntiMalware + from ._models_py3 import ConfigurationProfilePreferenceList + from ._models_py3 import ConfigurationProfilePreferenceProperties + from ._models_py3 import ConfigurationProfilePreferenceUpdate + from ._models_py3 import ConfigurationProfilePreferenceVmBackup + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorResponse + from ._models_py3 import ErrorResponseError + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationList + from ._models_py3 import ProxyResource + from ._models_py3 import Resource + from ._models_py3 import TrackedResource + from ._models_py3 import UpdateResource +except (SyntaxError, ImportError): + from ._models import Account # type: ignore + from ._models import AccountIdentity # type: ignore + from ._models import AccountList # type: ignore + from ._models import AccountUpdate # type: ignore + from ._models import ConfigurationProfileAssignment # type: ignore + from ._models import ConfigurationProfileAssignmentCompliance # type: ignore + from ._models import ConfigurationProfileAssignmentList # type: ignore + from ._models import ConfigurationProfileAssignmentProperties # type: ignore + from ._models import ConfigurationProfilePreference # type: ignore + from ._models import ConfigurationProfilePreferenceAntiMalware # type: ignore + from ._models import ConfigurationProfilePreferenceList # type: ignore + from ._models import ConfigurationProfilePreferenceProperties # type: ignore + from ._models import ConfigurationProfilePreferenceUpdate # type: ignore + from ._models import ConfigurationProfilePreferenceVmBackup # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import ErrorResponseError # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationList # type: ignore + from ._models import ProxyResource # type: ignore + from ._models import Resource # type: ignore + from ._models import TrackedResource # type: ignore + from ._models import UpdateResource # type: ignore + +from ._automanage_client_enums import ( + ConfigurationProfile, + EnableRealTimeProtection, + ProvisioningStatus, + ResourceIdentityType, + RunScheduledScan, + ScanType, + UpdateStatus, +) + +__all__ = [ + 'Account', + 'AccountIdentity', + 'AccountList', + 'AccountUpdate', + 'ConfigurationProfileAssignment', + 'ConfigurationProfileAssignmentCompliance', + 'ConfigurationProfileAssignmentList', + 'ConfigurationProfileAssignmentProperties', + 'ConfigurationProfilePreference', + 'ConfigurationProfilePreferenceAntiMalware', + 'ConfigurationProfilePreferenceList', + 'ConfigurationProfilePreferenceProperties', + 'ConfigurationProfilePreferenceUpdate', + 'ConfigurationProfilePreferenceVmBackup', + 'ErrorAdditionalInfo', + 'ErrorResponse', + 'ErrorResponseError', + 'Operation', + 'OperationDisplay', + 'OperationList', + 'ProxyResource', + 'Resource', + 'TrackedResource', + 'UpdateResource', + 'ConfigurationProfile', + 'EnableRealTimeProtection', + 'ProvisioningStatus', + 'ResourceIdentityType', + 'RunScheduledScan', + 'ScanType', + 'UpdateStatus', +] diff --git a/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/models/_automanage_client_enums.py b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/models/_automanage_client_enums.py new file mode 100644 index 000000000000..79304db864cd --- /dev/null +++ b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/models/_automanage_client_enums.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 enum import Enum + +class ConfigurationProfile(str, Enum): + """A value indicating configuration profile. + """ + + azure_virtual_machine_best_practices_dev_test = "Azure virtual machine best practices – Dev/Test" + azure_virtual_machine_best_practices_production = "Azure virtual machine best practices – Production" + +class EnableRealTimeProtection(str, Enum): + """Enables or disables Real Time Protection + """ + + true = "True" + false = "False" + +class ProvisioningStatus(str, Enum): + """The state of onboarding, which only appears in the response. + """ + + succeeded = "Succeeded" + failed = "Failed" + created = "Created" + +class ResourceIdentityType(str, Enum): + """The type of identity used for the Automanage account. Currently, the only supported type is + 'SystemAssigned', which implicitly creates an identity. + """ + + system_assigned = "SystemAssigned" + none = "None" + +class RunScheduledScan(str, Enum): + """Enables or disables a periodic scan for antimalware + """ + + true = "True" + false = "False" + +class ScanType(str, Enum): + """Type of scheduled scan + """ + + quick = "Quick" + full = "Full" + +class UpdateStatus(str, Enum): + """The state of compliance, which only appears in the response. + """ + + succeeded = "Succeeded" + failed = "Failed" + created = "Created" diff --git a/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/models/_models.py b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/models/_models.py new file mode 100644 index 000000000000..4a02132654d4 --- /dev/null +++ b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/models/_models.py @@ -0,0 +1,760 @@ +# 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 Resource(msrest.serialization.Model): + """Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class TrackedResource(Resource): + """The resource model definition for a ARM tracked top level resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.location = kwargs['location'] + + +class Account(TrackedResource): + """Definition of the Automanage account. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + :param identity: The identity of the Automanage account. + :type identity: ~automanage_client.models.AccountIdentity + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'AccountIdentity'}, + } + + def __init__( + self, + **kwargs + ): + super(Account, self).__init__(**kwargs) + self.identity = kwargs.get('identity', None) + + +class AccountIdentity(msrest.serialization.Model): + """Identity for the Automanage account. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of Automanage account identity. + :vartype principal_id: str + :ivar tenant_id: The tenant id associated with the Automanage account. + :vartype tenant_id: str + :param type: The type of identity used for the Automanage account. Currently, the only + supported type is 'SystemAssigned', which implicitly creates an identity. Possible values + include: "SystemAssigned", "None". + :type type: str or ~automanage_client.models.ResourceIdentityType + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AccountIdentity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = kwargs.get('type', None) + + +class AccountList(msrest.serialization.Model): + """The response of the list Account operation. + + :param value: Result of the list Account operation. + :type value: list[~automanage_client.models.Account] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Account]'}, + } + + def __init__( + self, + **kwargs + ): + super(AccountList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class UpdateResource(msrest.serialization.Model): + """Represents an update resource. + + :param tags: A set of tags. The tags of the resource. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(UpdateResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + +class AccountUpdate(UpdateResource): + """Definition of the Automanage account. + + :param tags: A set of tags. The tags of the resource. + :type tags: dict[str, str] + :param identity: The identity of the Automanage account. + :type identity: ~automanage_client.models.AccountIdentity + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'AccountIdentity'}, + } + + def __init__( + self, + **kwargs + ): + super(AccountUpdate, self).__init__(**kwargs) + self.identity = kwargs.get('identity', None) + + +class ConfigurationProfileAssignment(Resource): + """Configuration profile assignment is an association between a VM and automanage profile configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param properties: Properties of the configuration profile assignment. + :type properties: ~automanage_client.models.ConfigurationProfileAssignmentProperties + """ + + _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'}, + 'properties': {'key': 'properties', 'type': 'ConfigurationProfileAssignmentProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(ConfigurationProfileAssignment, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class ConfigurationProfileAssignmentCompliance(msrest.serialization.Model): + """The compliance status for the configuration profile assignment. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar update_status: The state of compliance, which only appears in the response. Possible + values include: "Succeeded", "Failed", "Created". + :vartype update_status: str or ~automanage_client.models.UpdateStatus + """ + + _validation = { + 'update_status': {'readonly': True}, + } + + _attribute_map = { + 'update_status': {'key': 'updateStatus', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ConfigurationProfileAssignmentCompliance, self).__init__(**kwargs) + self.update_status = None + + +class ConfigurationProfileAssignmentList(msrest.serialization.Model): + """The response of the list configuration profile assignment operation. + + :param value: Result of the list configuration profile assignment operation. + :type value: list[~automanage_client.models.ConfigurationProfileAssignment] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ConfigurationProfileAssignment]'}, + } + + def __init__( + self, + **kwargs + ): + super(ConfigurationProfileAssignmentList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class ConfigurationProfileAssignmentProperties(msrest.serialization.Model): + """Automanage configuration profile assignment properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param configuration_profile: A value indicating configuration profile. Possible values + include: "Azure virtual machine best practices – Dev/Test", "Azure virtual machine best + practices – Production". + :type configuration_profile: str or ~automanage_client.models.ConfigurationProfile + :param target_id: The target VM resource URI. + :type target_id: str + :param account_id: The Automanage account ARM Resource URI. + :type account_id: str + :param configuration_profile_preference_id: The configuration profile custom preferences ARM + resource URI. + :type configuration_profile_preference_id: str + :ivar provisioning_status: The state of onboarding, which only appears in the response. + Possible values include: "Succeeded", "Failed", "Created". + :vartype provisioning_status: str or ~automanage_client.models.ProvisioningStatus + :param compliance: The configuration setting for the configuration profile. + :type compliance: ~automanage_client.models.ConfigurationProfileAssignmentCompliance + """ + + _validation = { + 'provisioning_status': {'readonly': True}, + } + + _attribute_map = { + 'configuration_profile': {'key': 'configurationProfile', 'type': 'str'}, + 'target_id': {'key': 'targetId', 'type': 'str'}, + 'account_id': {'key': 'accountId', 'type': 'str'}, + 'configuration_profile_preference_id': {'key': 'configurationProfilePreferenceId', 'type': 'str'}, + 'provisioning_status': {'key': 'provisioningStatus', 'type': 'str'}, + 'compliance': {'key': 'compliance', 'type': 'ConfigurationProfileAssignmentCompliance'}, + } + + def __init__( + self, + **kwargs + ): + super(ConfigurationProfileAssignmentProperties, self).__init__(**kwargs) + self.configuration_profile = kwargs.get('configuration_profile', None) + self.target_id = kwargs.get('target_id', None) + self.account_id = kwargs.get('account_id', None) + self.configuration_profile_preference_id = kwargs.get('configuration_profile_preference_id', None) + self.provisioning_status = None + self.compliance = kwargs.get('compliance', None) + + +class ConfigurationProfilePreference(TrackedResource): + """Definition of the configuration profile preference. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + :param properties: Properties of the configuration profile preference. + :type properties: ~automanage_client.models.ConfigurationProfilePreferenceProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ConfigurationProfilePreferenceProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(ConfigurationProfilePreference, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class ConfigurationProfilePreferenceAntiMalware(msrest.serialization.Model): + """Automanage configuration profile Antimalware preferences. + + :param enable_real_time_protection: Enables or disables Real Time Protection. Possible values + include: "True", "False". + :type enable_real_time_protection: str or ~automanage_client.models.EnableRealTimeProtection + :param exclusions: Extensions, Paths and Processes that must be excluded from scan. + :type exclusions: object + :param run_scheduled_scan: Enables or disables a periodic scan for antimalware. Possible values + include: "True", "False". + :type run_scheduled_scan: str or ~automanage_client.models.RunScheduledScan + :param scan_type: Type of scheduled scan. Possible values include: "Quick", "Full". + :type scan_type: str or ~automanage_client.models.ScanType + :param scan_day: Schedule scan settings day. + :type scan_day: str + :param scan_time_in_minutes: Schedule scan settings time. + :type scan_time_in_minutes: str + """ + + _attribute_map = { + 'enable_real_time_protection': {'key': 'enableRealTimeProtection', 'type': 'str'}, + 'exclusions': {'key': 'exclusions', 'type': 'object'}, + 'run_scheduled_scan': {'key': 'runScheduledScan', 'type': 'str'}, + 'scan_type': {'key': 'scanType', 'type': 'str'}, + 'scan_day': {'key': 'scanDay', 'type': 'str'}, + 'scan_time_in_minutes': {'key': 'scanTimeInMinutes', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ConfigurationProfilePreferenceAntiMalware, self).__init__(**kwargs) + self.enable_real_time_protection = kwargs.get('enable_real_time_protection', None) + self.exclusions = kwargs.get('exclusions', None) + self.run_scheduled_scan = kwargs.get('run_scheduled_scan', None) + self.scan_type = kwargs.get('scan_type', None) + self.scan_day = kwargs.get('scan_day', None) + self.scan_time_in_minutes = kwargs.get('scan_time_in_minutes', None) + + +class ConfigurationProfilePreferenceList(msrest.serialization.Model): + """The response of the list ConfigurationProfilePreference operation. + + :param value: Result of the list ConfigurationProfilePreference operation. + :type value: list[~automanage_client.models.ConfigurationProfilePreference] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ConfigurationProfilePreference]'}, + } + + def __init__( + self, + **kwargs + ): + super(ConfigurationProfilePreferenceList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class ConfigurationProfilePreferenceProperties(msrest.serialization.Model): + """Automanage configuration profile preference properties. + + :param vm_backup: The custom preferences for Azure VM Backup. + :type vm_backup: ~automanage_client.models.ConfigurationProfilePreferenceVmBackup + :param anti_malware: The custom preferences for Azure Antimalware. + :type anti_malware: ~automanage_client.models.ConfigurationProfilePreferenceAntiMalware + """ + + _attribute_map = { + 'vm_backup': {'key': 'vmBackup', 'type': 'ConfigurationProfilePreferenceVmBackup'}, + 'anti_malware': {'key': 'antiMalware', 'type': 'ConfigurationProfilePreferenceAntiMalware'}, + } + + def __init__( + self, + **kwargs + ): + super(ConfigurationProfilePreferenceProperties, self).__init__(**kwargs) + self.vm_backup = kwargs.get('vm_backup', None) + self.anti_malware = kwargs.get('anti_malware', None) + + +class ConfigurationProfilePreferenceUpdate(UpdateResource): + """Definition of the configuration profile preference. + + :param tags: A set of tags. The tags of the resource. + :type tags: dict[str, str] + :param properties: Properties of the configuration profile preference. + :type properties: ~automanage_client.models.ConfigurationProfilePreferenceProperties + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'ConfigurationProfilePreferenceProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(ConfigurationProfilePreferenceUpdate, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class ConfigurationProfilePreferenceVmBackup(msrest.serialization.Model): + """Automanage configuration profile VM Backup preferences. + + :param time_zone: TimeZone optional input as string. For example: Pacific Standard Time. + :type time_zone: str + :param instant_rp_retention_range_in_days: Instant RP retention policy range in days. + :type instant_rp_retention_range_in_days: int + :param retention_policy: Retention policy with the details on backup copy retention ranges. + :type retention_policy: str + :param schedule_policy: Backup schedule specified as part of backup policy. + :type schedule_policy: str + """ + + _attribute_map = { + 'time_zone': {'key': 'timeZone', 'type': 'str'}, + 'instant_rp_retention_range_in_days': {'key': 'instantRpRetentionRangeInDays', 'type': 'int'}, + 'retention_policy': {'key': 'retentionPolicy', 'type': 'str'}, + 'schedule_policy': {'key': 'schedulePolicy', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ConfigurationProfilePreferenceVmBackup, self).__init__(**kwargs) + self.time_zone = kwargs.get('time_zone', None) + self.instant_rp_retention_range_in_days = kwargs.get('instant_rp_retention_range_in_days', None) + self.retention_policy = kwargs.get('retention_policy', None) + self.schedule_policy = kwargs.get('schedule_policy', None) + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorResponse(msrest.serialization.Model): + """The resource management error response. + + :param error: The error object. + :type error: ~automanage_client.models.ErrorResponseError + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponseError'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ErrorResponseError(msrest.serialization.Model): + """The error object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~automanage_client.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~automanage_client.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponseError, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class Operation(msrest.serialization.Model): + """Automanage REST API operation. + + :param name: Operation name: For ex. + providers/Microsoft.Automanage/configurationProfileAssignments/write or read. + :type name: str + :param is_data_action: Indicates whether the operation is a data action. + :type is_data_action: str + :param display: Provider, Resource, Operation and description values. + :type display: ~automanage_client.models.OperationDisplay + :param status_code: Service provider: Microsoft.Automanage. + :type status_code: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'status_code': {'key': 'properties.statusCode', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, 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.status_code = kwargs.get('status_code', None) + + +class OperationDisplay(msrest.serialization.Model): + """Provider, Resource, Operation and description values. + + :param provider: Service provider: Microsoft.Automanage. + :type provider: str + :param resource: Resource on which the operation is performed: For ex. + :type resource: str + :param operation: Operation type: Read, write, delete, etc. + :type operation: str + :param description: Description about operation. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + self.description = kwargs.get('description', None) + + +class OperationList(msrest.serialization.Model): + """The response model for the list of Automanage operations. + + :param value: List of Automanage operations supported by the Automanage resource provider. + :type value: list[~automanage_client.models.Operation] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class ProxyResource(Resource): + """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProxyResource, self).__init__(**kwargs) diff --git a/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/models/_models_py3.py b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/models/_models_py3.py new file mode 100644 index 000000000000..733188416af6 --- /dev/null +++ b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/models/_models_py3.py @@ -0,0 +1,828 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._automanage_client_enums import * + + +class Resource(msrest.serialization.Model): + """Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class TrackedResource(Resource): + """The resource model definition for a ARM tracked top level resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.tags = tags + self.location = location + + +class Account(TrackedResource): + """Definition of the Automanage account. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + :param identity: The identity of the Automanage account. + :type identity: ~automanage_client.models.AccountIdentity + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'AccountIdentity'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional["AccountIdentity"] = None, + **kwargs + ): + super(Account, self).__init__(tags=tags, location=location, **kwargs) + self.identity = identity + + +class AccountIdentity(msrest.serialization.Model): + """Identity for the Automanage account. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of Automanage account identity. + :vartype principal_id: str + :ivar tenant_id: The tenant id associated with the Automanage account. + :vartype tenant_id: str + :param type: The type of identity used for the Automanage account. Currently, the only + supported type is 'SystemAssigned', which implicitly creates an identity. Possible values + include: "SystemAssigned", "None". + :type type: str or ~automanage_client.models.ResourceIdentityType + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "ResourceIdentityType"]] = None, + **kwargs + ): + super(AccountIdentity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + + +class AccountList(msrest.serialization.Model): + """The response of the list Account operation. + + :param value: Result of the list Account operation. + :type value: list[~automanage_client.models.Account] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Account]'}, + } + + def __init__( + self, + *, + value: Optional[List["Account"]] = None, + **kwargs + ): + super(AccountList, self).__init__(**kwargs) + self.value = value + + +class UpdateResource(msrest.serialization.Model): + """Represents an update resource. + + :param tags: A set of tags. The tags of the resource. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(UpdateResource, self).__init__(**kwargs) + self.tags = tags + + +class AccountUpdate(UpdateResource): + """Definition of the Automanage account. + + :param tags: A set of tags. The tags of the resource. + :type tags: dict[str, str] + :param identity: The identity of the Automanage account. + :type identity: ~automanage_client.models.AccountIdentity + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'AccountIdentity'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["AccountIdentity"] = None, + **kwargs + ): + super(AccountUpdate, self).__init__(tags=tags, **kwargs) + self.identity = identity + + +class ConfigurationProfileAssignment(Resource): + """Configuration profile assignment is an association between a VM and automanage profile configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param properties: Properties of the configuration profile assignment. + :type properties: ~automanage_client.models.ConfigurationProfileAssignmentProperties + """ + + _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'}, + 'properties': {'key': 'properties', 'type': 'ConfigurationProfileAssignmentProperties'}, + } + + def __init__( + self, + *, + properties: Optional["ConfigurationProfileAssignmentProperties"] = None, + **kwargs + ): + super(ConfigurationProfileAssignment, self).__init__(**kwargs) + self.properties = properties + + +class ConfigurationProfileAssignmentCompliance(msrest.serialization.Model): + """The compliance status for the configuration profile assignment. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar update_status: The state of compliance, which only appears in the response. Possible + values include: "Succeeded", "Failed", "Created". + :vartype update_status: str or ~automanage_client.models.UpdateStatus + """ + + _validation = { + 'update_status': {'readonly': True}, + } + + _attribute_map = { + 'update_status': {'key': 'updateStatus', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ConfigurationProfileAssignmentCompliance, self).__init__(**kwargs) + self.update_status = None + + +class ConfigurationProfileAssignmentList(msrest.serialization.Model): + """The response of the list configuration profile assignment operation. + + :param value: Result of the list configuration profile assignment operation. + :type value: list[~automanage_client.models.ConfigurationProfileAssignment] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ConfigurationProfileAssignment]'}, + } + + def __init__( + self, + *, + value: Optional[List["ConfigurationProfileAssignment"]] = None, + **kwargs + ): + super(ConfigurationProfileAssignmentList, self).__init__(**kwargs) + self.value = value + + +class ConfigurationProfileAssignmentProperties(msrest.serialization.Model): + """Automanage configuration profile assignment properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param configuration_profile: A value indicating configuration profile. Possible values + include: "Azure virtual machine best practices – Dev/Test", "Azure virtual machine best + practices – Production". + :type configuration_profile: str or ~automanage_client.models.ConfigurationProfile + :param target_id: The target VM resource URI. + :type target_id: str + :param account_id: The Automanage account ARM Resource URI. + :type account_id: str + :param configuration_profile_preference_id: The configuration profile custom preferences ARM + resource URI. + :type configuration_profile_preference_id: str + :ivar provisioning_status: The state of onboarding, which only appears in the response. + Possible values include: "Succeeded", "Failed", "Created". + :vartype provisioning_status: str or ~automanage_client.models.ProvisioningStatus + :param compliance: The configuration setting for the configuration profile. + :type compliance: ~automanage_client.models.ConfigurationProfileAssignmentCompliance + """ + + _validation = { + 'provisioning_status': {'readonly': True}, + } + + _attribute_map = { + 'configuration_profile': {'key': 'configurationProfile', 'type': 'str'}, + 'target_id': {'key': 'targetId', 'type': 'str'}, + 'account_id': {'key': 'accountId', 'type': 'str'}, + 'configuration_profile_preference_id': {'key': 'configurationProfilePreferenceId', 'type': 'str'}, + 'provisioning_status': {'key': 'provisioningStatus', 'type': 'str'}, + 'compliance': {'key': 'compliance', 'type': 'ConfigurationProfileAssignmentCompliance'}, + } + + def __init__( + self, + *, + configuration_profile: Optional[Union[str, "ConfigurationProfile"]] = None, + target_id: Optional[str] = None, + account_id: Optional[str] = None, + configuration_profile_preference_id: Optional[str] = None, + compliance: Optional["ConfigurationProfileAssignmentCompliance"] = None, + **kwargs + ): + super(ConfigurationProfileAssignmentProperties, self).__init__(**kwargs) + self.configuration_profile = configuration_profile + self.target_id = target_id + self.account_id = account_id + self.configuration_profile_preference_id = configuration_profile_preference_id + self.provisioning_status = None + self.compliance = compliance + + +class ConfigurationProfilePreference(TrackedResource): + """Definition of the configuration profile preference. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + :param properties: Properties of the configuration profile preference. + :type properties: ~automanage_client.models.ConfigurationProfilePreferenceProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ConfigurationProfilePreferenceProperties'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["ConfigurationProfilePreferenceProperties"] = None, + **kwargs + ): + super(ConfigurationProfilePreference, self).__init__(tags=tags, location=location, **kwargs) + self.properties = properties + + +class ConfigurationProfilePreferenceAntiMalware(msrest.serialization.Model): + """Automanage configuration profile Antimalware preferences. + + :param enable_real_time_protection: Enables or disables Real Time Protection. Possible values + include: "True", "False". + :type enable_real_time_protection: str or ~automanage_client.models.EnableRealTimeProtection + :param exclusions: Extensions, Paths and Processes that must be excluded from scan. + :type exclusions: object + :param run_scheduled_scan: Enables or disables a periodic scan for antimalware. Possible values + include: "True", "False". + :type run_scheduled_scan: str or ~automanage_client.models.RunScheduledScan + :param scan_type: Type of scheduled scan. Possible values include: "Quick", "Full". + :type scan_type: str or ~automanage_client.models.ScanType + :param scan_day: Schedule scan settings day. + :type scan_day: str + :param scan_time_in_minutes: Schedule scan settings time. + :type scan_time_in_minutes: str + """ + + _attribute_map = { + 'enable_real_time_protection': {'key': 'enableRealTimeProtection', 'type': 'str'}, + 'exclusions': {'key': 'exclusions', 'type': 'object'}, + 'run_scheduled_scan': {'key': 'runScheduledScan', 'type': 'str'}, + 'scan_type': {'key': 'scanType', 'type': 'str'}, + 'scan_day': {'key': 'scanDay', 'type': 'str'}, + 'scan_time_in_minutes': {'key': 'scanTimeInMinutes', 'type': 'str'}, + } + + def __init__( + self, + *, + enable_real_time_protection: Optional[Union[str, "EnableRealTimeProtection"]] = None, + exclusions: Optional[object] = None, + run_scheduled_scan: Optional[Union[str, "RunScheduledScan"]] = None, + scan_type: Optional[Union[str, "ScanType"]] = None, + scan_day: Optional[str] = None, + scan_time_in_minutes: Optional[str] = None, + **kwargs + ): + super(ConfigurationProfilePreferenceAntiMalware, self).__init__(**kwargs) + self.enable_real_time_protection = enable_real_time_protection + self.exclusions = exclusions + self.run_scheduled_scan = run_scheduled_scan + self.scan_type = scan_type + self.scan_day = scan_day + self.scan_time_in_minutes = scan_time_in_minutes + + +class ConfigurationProfilePreferenceList(msrest.serialization.Model): + """The response of the list ConfigurationProfilePreference operation. + + :param value: Result of the list ConfigurationProfilePreference operation. + :type value: list[~automanage_client.models.ConfigurationProfilePreference] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ConfigurationProfilePreference]'}, + } + + def __init__( + self, + *, + value: Optional[List["ConfigurationProfilePreference"]] = None, + **kwargs + ): + super(ConfigurationProfilePreferenceList, self).__init__(**kwargs) + self.value = value + + +class ConfigurationProfilePreferenceProperties(msrest.serialization.Model): + """Automanage configuration profile preference properties. + + :param vm_backup: The custom preferences for Azure VM Backup. + :type vm_backup: ~automanage_client.models.ConfigurationProfilePreferenceVmBackup + :param anti_malware: The custom preferences for Azure Antimalware. + :type anti_malware: ~automanage_client.models.ConfigurationProfilePreferenceAntiMalware + """ + + _attribute_map = { + 'vm_backup': {'key': 'vmBackup', 'type': 'ConfigurationProfilePreferenceVmBackup'}, + 'anti_malware': {'key': 'antiMalware', 'type': 'ConfigurationProfilePreferenceAntiMalware'}, + } + + def __init__( + self, + *, + vm_backup: Optional["ConfigurationProfilePreferenceVmBackup"] = None, + anti_malware: Optional["ConfigurationProfilePreferenceAntiMalware"] = None, + **kwargs + ): + super(ConfigurationProfilePreferenceProperties, self).__init__(**kwargs) + self.vm_backup = vm_backup + self.anti_malware = anti_malware + + +class ConfigurationProfilePreferenceUpdate(UpdateResource): + """Definition of the configuration profile preference. + + :param tags: A set of tags. The tags of the resource. + :type tags: dict[str, str] + :param properties: Properties of the configuration profile preference. + :type properties: ~automanage_client.models.ConfigurationProfilePreferenceProperties + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'ConfigurationProfilePreferenceProperties'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + properties: Optional["ConfigurationProfilePreferenceProperties"] = None, + **kwargs + ): + super(ConfigurationProfilePreferenceUpdate, self).__init__(tags=tags, **kwargs) + self.properties = properties + + +class ConfigurationProfilePreferenceVmBackup(msrest.serialization.Model): + """Automanage configuration profile VM Backup preferences. + + :param time_zone: TimeZone optional input as string. For example: Pacific Standard Time. + :type time_zone: str + :param instant_rp_retention_range_in_days: Instant RP retention policy range in days. + :type instant_rp_retention_range_in_days: int + :param retention_policy: Retention policy with the details on backup copy retention ranges. + :type retention_policy: str + :param schedule_policy: Backup schedule specified as part of backup policy. + :type schedule_policy: str + """ + + _attribute_map = { + 'time_zone': {'key': 'timeZone', 'type': 'str'}, + 'instant_rp_retention_range_in_days': {'key': 'instantRpRetentionRangeInDays', 'type': 'int'}, + 'retention_policy': {'key': 'retentionPolicy', 'type': 'str'}, + 'schedule_policy': {'key': 'schedulePolicy', 'type': 'str'}, + } + + def __init__( + self, + *, + time_zone: Optional[str] = None, + instant_rp_retention_range_in_days: Optional[int] = None, + retention_policy: Optional[str] = None, + schedule_policy: Optional[str] = None, + **kwargs + ): + super(ConfigurationProfilePreferenceVmBackup, self).__init__(**kwargs) + self.time_zone = time_zone + self.instant_rp_retention_range_in_days = instant_rp_retention_range_in_days + self.retention_policy = retention_policy + self.schedule_policy = schedule_policy + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorResponse(msrest.serialization.Model): + """The resource management error response. + + :param error: The error object. + :type error: ~automanage_client.models.ErrorResponseError + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponseError'}, + } + + def __init__( + self, + *, + error: Optional["ErrorResponseError"] = None, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ErrorResponseError(msrest.serialization.Model): + """The error object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~automanage_client.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~automanage_client.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponseError, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class Operation(msrest.serialization.Model): + """Automanage REST API operation. + + :param name: Operation name: For ex. + providers/Microsoft.Automanage/configurationProfileAssignments/write or read. + :type name: str + :param is_data_action: Indicates whether the operation is a data action. + :type is_data_action: str + :param display: Provider, Resource, Operation and description values. + :type display: ~automanage_client.models.OperationDisplay + :param status_code: Service provider: Microsoft.Automanage. + :type status_code: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'status_code': {'key': 'properties.statusCode', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + is_data_action: Optional[str] = None, + display: Optional["OperationDisplay"] = None, + status_code: Optional[str] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = name + self.is_data_action = is_data_action + self.display = display + self.status_code = status_code + + +class OperationDisplay(msrest.serialization.Model): + """Provider, Resource, Operation and description values. + + :param provider: Service provider: Microsoft.Automanage. + :type provider: str + :param resource: Resource on which the operation is performed: For ex. + :type resource: str + :param operation: Operation type: Read, write, delete, etc. + :type operation: str + :param description: Description about operation. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class OperationList(msrest.serialization.Model): + """The response model for the list of Automanage operations. + + :param value: List of Automanage operations supported by the Automanage resource provider. + :type value: list[~automanage_client.models.Operation] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + } + + def __init__( + self, + *, + value: Optional[List["Operation"]] = None, + **kwargs + ): + super(OperationList, self).__init__(**kwargs) + self.value = value + + +class ProxyResource(Resource): + """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProxyResource, self).__init__(**kwargs) diff --git a/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/operations/__init__.py b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/operations/__init__.py new file mode 100644 index 000000000000..9520dfd09e18 --- /dev/null +++ b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/operations/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._accounts_operations import AccountsOperations +from ._configuration_profile_assignments_operations import ConfigurationProfileAssignmentsOperations +from ._configuration_profile_preferences_operations import ConfigurationProfilePreferencesOperations +from ._operations import Operations + +__all__ = [ + 'AccountsOperations', + 'ConfigurationProfileAssignmentsOperations', + 'ConfigurationProfilePreferencesOperations', + 'Operations', +] diff --git a/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/operations/_accounts_operations.py b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/operations/_accounts_operations.py new file mode 100644 index 000000000000..d97b79a4a8b1 --- /dev/null +++ b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/operations/_accounts_operations.py @@ -0,0 +1,426 @@ +# 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 HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class AccountsOperations(object): + """AccountsOperations 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: ~automanage_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def create_or_update( + self, + account_name, # type: str + resource_group_name, # type: str + parameters, # type: "models.Account" + **kwargs # type: Any + ): + # type: (...) -> "models.Account" + """Creates an Automanage Account. + + :param account_name: Name of the Automanage account. + :type account_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param parameters: Parameters supplied to create or update Automanage account. + :type parameters: ~automanage_client.models.Account + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Account, or the result of cls(response) + :rtype: ~automanage_client.models.Account + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Account"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-30-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'accountName': self._serialize.url("account_name", account_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Account') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Account', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Account', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/accounts/{accountName}'} # type: ignore + + def get( + self, + account_name, # type: str + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Account" + """Get information about a Automanage account. + + :param account_name: The Automanage account name. + :type account_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Account, or the result of cls(response) + :rtype: ~automanage_client.models.Account + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Account"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-30-preview" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'accountName': self._serialize.url("account_name", account_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = 'application/json' + + 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(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Account', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/accounts/{accountName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Delete a Automanage account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: Name of the Automanage account. + :type account_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-30-preview" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/accounts/{accountName}'} # type: ignore + + def update( + self, + account_name, # type: str + resource_group_name, # type: str + parameters, # type: "models.AccountUpdate" + **kwargs # type: Any + ): + # type: (...) -> "models.Account" + """Updates an Automanage Account. + + :param account_name: Name of the Automanage account. + :type account_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param parameters: Parameters supplied to update Automanage account. + :type parameters: ~automanage_client.models.AccountUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Account, or the result of cls(response) + :rtype: ~automanage_client.models.Account + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Account"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-30-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'accountName': self._serialize.url("account_name", account_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'AccountUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Account', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/accounts/{accountName}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.AccountList"] + """Retrieve a list of Automanage accounts within a given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AccountList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~automanage_client.models.AccountList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AccountList"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-30-preview" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('AccountList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/accounts'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.AccountList"] + """Retrieve a list of Automanage accounts within a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AccountList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~automanage_client.models.AccountList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AccountList"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-30-preview" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('AccountList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Automanage/accounts'} # type: ignore diff --git a/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/operations/_configuration_profile_assignments_operations.py b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/operations/_configuration_profile_assignments_operations.py new file mode 100644 index 000000000000..3ce28d9f8d6f --- /dev/null +++ b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/operations/_configuration_profile_assignments_operations.py @@ -0,0 +1,431 @@ +# 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 HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ConfigurationProfileAssignmentsOperations(object): + """ConfigurationProfileAssignmentsOperations 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: ~automanage_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _create_or_update_initial( + self, + configuration_profile_assignment_name, # type: str + resource_group_name, # type: str + vm_name, # type: str + parameters, # type: "models.ConfigurationProfileAssignment" + **kwargs # type: Any + ): + # type: (...) -> "models.ConfigurationProfileAssignment" + cls = kwargs.pop('cls', None) # type: ClsType["models.ConfigurationProfileAssignment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-30-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'configurationProfileAssignmentName': self._serialize.url("configuration_profile_assignment_name", configuration_profile_assignment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'vmName': self._serialize.url("vm_name", vm_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'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ConfigurationProfileAssignment') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigurationProfileAssignment', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ConfigurationProfileAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}'} # type: ignore + + def begin_create_or_update( + self, + configuration_profile_assignment_name, # type: str + resource_group_name, # type: str + vm_name, # type: str + parameters, # type: "models.ConfigurationProfileAssignment" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.ConfigurationProfileAssignment"] + """Creates an association between a VM and Automanage configuration profile. + + :param configuration_profile_assignment_name: Name of the configuration profile assignment. + Only default is supported. + :type configuration_profile_assignment_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param parameters: Parameters supplied to the create or update configuration profile + assignment. + :type parameters: ~automanage_client.models.ConfigurationProfileAssignment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigurationProfileAssignment or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~automanage_client.models.ConfigurationProfileAssignment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.ConfigurationProfileAssignment"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + configuration_profile_assignment_name=configuration_profile_assignment_name, + resource_group_name=resource_group_name, + vm_name=vm_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ConfigurationProfileAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + configuration_profile_assignment_name, # type: str + vm_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.ConfigurationProfileAssignment" + """Get information about a configuration profile assignment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param configuration_profile_assignment_name: The configuration profile assignment name. + :type configuration_profile_assignment_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigurationProfileAssignment, or the result of cls(response) + :rtype: ~automanage_client.models.ConfigurationProfileAssignment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ConfigurationProfileAssignment"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-30-preview" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'configurationProfileAssignmentName': self._serialize.url("configuration_profile_assignment_name", configuration_profile_assignment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'vmName': self._serialize.url("vm_name", vm_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'] = 'application/json' + + 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(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConfigurationProfileAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + configuration_profile_assignment_name, # type: str + vm_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Delete a configuration profile assignment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param configuration_profile_assignment_name: Name of the configuration profile assignment. + :type configuration_profile_assignment_name: str + :param vm_name: The name of the virtual machine. + :type vm_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-30-preview" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'configurationProfileAssignmentName': self._serialize.url("configuration_profile_assignment_name", configuration_profile_assignment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'vmName': self._serialize.url("vm_name", vm_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] + + 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(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ConfigurationProfileAssignmentList"] + """Get list of configuration profile assignments. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConfigurationProfileAssignmentList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~automanage_client.models.ConfigurationProfileAssignmentList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ConfigurationProfileAssignmentList"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-30-preview" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ConfigurationProfileAssignmentList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfileAssignments'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ConfigurationProfileAssignmentList"] + """Get list of configuration profile assignments under a given subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConfigurationProfileAssignmentList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~automanage_client.models.ConfigurationProfileAssignmentList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ConfigurationProfileAssignmentList"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-30-preview" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ConfigurationProfileAssignmentList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Automanage/configurationProfileAssignments'} # type: ignore diff --git a/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/operations/_configuration_profile_preferences_operations.py b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/operations/_configuration_profile_preferences_operations.py new file mode 100644 index 000000000000..094cc67131d5 --- /dev/null +++ b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/operations/_configuration_profile_preferences_operations.py @@ -0,0 +1,426 @@ +# 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 HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ConfigurationProfilePreferencesOperations(object): + """ConfigurationProfilePreferencesOperations 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: ~automanage_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def create_or_update( + self, + configuration_profile_preference_name, # type: str + resource_group_name, # type: str + parameters, # type: "models.ConfigurationProfilePreference" + **kwargs # type: Any + ): + # type: (...) -> "models.ConfigurationProfilePreference" + """Creates a configuration profile preference. + + :param configuration_profile_preference_name: Name of the configuration profile preference. + :type configuration_profile_preference_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param parameters: Parameters supplied to create or update configuration profile preference. + :type parameters: ~automanage_client.models.ConfigurationProfilePreference + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigurationProfilePreference, or the result of cls(response) + :rtype: ~automanage_client.models.ConfigurationProfilePreference + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ConfigurationProfilePreference"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-30-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'configurationProfilePreferenceName': self._serialize.url("configuration_profile_preference_name", configuration_profile_preference_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ConfigurationProfilePreference') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigurationProfilePreference', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ConfigurationProfilePreference', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfilePreferences/{configurationProfilePreferenceName}'} # type: ignore + + def get( + self, + configuration_profile_preference_name, # type: str + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.ConfigurationProfilePreference" + """Get information about a configuration profile preference. + + :param configuration_profile_preference_name: The configuration profile preference name. + :type configuration_profile_preference_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigurationProfilePreference, or the result of cls(response) + :rtype: ~automanage_client.models.ConfigurationProfilePreference + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ConfigurationProfilePreference"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-30-preview" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'configurationProfilePreferenceName': self._serialize.url("configuration_profile_preference_name", configuration_profile_preference_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = 'application/json' + + 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(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConfigurationProfilePreference', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfilePreferences/{configurationProfilePreferenceName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + configuration_profile_preference_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Delete a configuration profile preference. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param configuration_profile_preference_name: Name of the configuration profile preference. + :type configuration_profile_preference_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-30-preview" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'configurationProfilePreferenceName': self._serialize.url("configuration_profile_preference_name", configuration_profile_preference_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + 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(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfilePreferences/{configurationProfilePreferenceName}'} # type: ignore + + def update( + self, + configuration_profile_preference_name, # type: str + resource_group_name, # type: str + parameters, # type: "models.ConfigurationProfilePreferenceUpdate" + **kwargs # type: Any + ): + # type: (...) -> "models.ConfigurationProfilePreference" + """Updates a configuration profile preference. + + :param configuration_profile_preference_name: Name of the configuration profile preference. + :type configuration_profile_preference_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param parameters: Parameters supplied to create or update configuration profile preference. + :type parameters: ~automanage_client.models.ConfigurationProfilePreferenceUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigurationProfilePreference, or the result of cls(response) + :rtype: ~automanage_client.models.ConfigurationProfilePreference + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ConfigurationProfilePreference"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-30-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'configurationProfilePreferenceName': self._serialize.url("configuration_profile_preference_name", configuration_profile_preference_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ConfigurationProfilePreferenceUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConfigurationProfilePreference', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfilePreferences/{configurationProfilePreferenceName}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ConfigurationProfilePreferenceList"] + """Retrieve a list of configuration profile preferences within a given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConfigurationProfilePreferenceList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~automanage_client.models.ConfigurationProfilePreferenceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ConfigurationProfilePreferenceList"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-30-preview" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ConfigurationProfilePreferenceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfilePreferences'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ConfigurationProfilePreferenceList"] + """Retrieve a list of configuration profile preferences within a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConfigurationProfilePreferenceList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~automanage_client.models.ConfigurationProfilePreferenceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ConfigurationProfilePreferenceList"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-30-preview" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ConfigurationProfilePreferenceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Automanage/configurationProfilePreferences'} # type: ignore diff --git a/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/operations/_operations.py b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/operations/_operations.py new file mode 100644 index 000000000000..7aac97cd377a --- /dev/null +++ b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/operations/_operations.py @@ -0,0 +1,107 @@ +# 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 HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class Operations(object): + """Operations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~automanage_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.OperationList"] + """Lists all of the available Automanage REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~automanage_client.models.OperationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationList"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-30-preview" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Automanage/operations'} # type: ignore diff --git a/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/py.typed b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/automanage/azure-mgmt-automanage/sdk_packaging.toml b/sdk/automanage/azure-mgmt-automanage/sdk_packaging.toml new file mode 100644 index 000000000000..479ebb50c61d --- /dev/null +++ b/sdk/automanage/azure-mgmt-automanage/sdk_packaging.toml @@ -0,0 +1,8 @@ +[packaging] +package_name = "azure-mgmt-automanage" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = true diff --git a/sdk/automanage/azure-mgmt-automanage/setup.cfg b/sdk/automanage/azure-mgmt-automanage/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/automanage/azure-mgmt-automanage/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/automanage/azure-mgmt-automanage/setup.py b/sdk/automanage/azure-mgmt-automanage/setup.py new file mode 100644 index 000000000000..7f7d212bdb2c --- /dev/null +++ b/sdk/automanage/azure-mgmt-automanage/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-automanage" +PACKAGE_PPRINT_NAME = "MyService Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# azure v0.x is not compatible with this package +# azure v0.x used to have a __version__ attribute (newer versions don't) +try: + import azure + try: + ver = azure.__version__ + raise Exception( + 'This package is incompatible with azure=={}. '.format(ver) + + 'Uninstall it with "pip uninstall azure".' + ) + except AttributeError: + pass +except ImportError: + pass + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +with open('README.md', encoding='utf-8') as f: + readme = f.read() +with open('CHANGELOG.md', encoding='utf-8') as f: + changelog = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + '\n\n' + changelog, + long_description_content_type='text/markdown', + license='MIT License', + author='Microsoft Corporation', + author_email='azpysdkhelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python', + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + '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.5.0', + 'msrestazure>=0.4.32,<2.0.0', + 'azure-common~=1.1', + ], + extras_require={ + ":python_version<'3.0'": ['azure-mgmt-nspkg'], + } +) From 55e16a2ca54c96d72a8a21ecdb0309cb8b8046f3 Mon Sep 17 00:00:00 2001 From: xichen Date: Thu, 10 Sep 2020 10:08:05 +0800 Subject: [PATCH 3/3] add init --- sdk/automanage/azure-mgmt-automanage/CHANGELOG.md | 2 +- sdk/automanage/azure-mgmt-automanage/README.md | 4 ++-- .../azure-mgmt-automanage/azure/mgmt/automanage/_version.py | 2 +- sdk/automanage/azure-mgmt-automanage/dev_requirements.txt | 1 + sdk/automanage/azure-mgmt-automanage/sdk_packaging.toml | 2 +- sdk/automanage/azure-mgmt-automanage/setup.py | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) create mode 100644 sdk/automanage/azure-mgmt-automanage/dev_requirements.txt diff --git a/sdk/automanage/azure-mgmt-automanage/CHANGELOG.md b/sdk/automanage/azure-mgmt-automanage/CHANGELOG.md index 578ed6acf479..49a74ea2f6d4 100644 --- a/sdk/automanage/azure-mgmt-automanage/CHANGELOG.md +++ b/sdk/automanage/azure-mgmt-automanage/CHANGELOG.md @@ -1,5 +1,5 @@ # Release History -## 0.1.0 (1970-01-01) +## 1.0.0b1 (2020-09-10) * Initial Release diff --git a/sdk/automanage/azure-mgmt-automanage/README.md b/sdk/automanage/azure-mgmt-automanage/README.md index ba3cf7ffbde6..b7d922c6650f 100644 --- a/sdk/automanage/azure-mgmt-automanage/README.md +++ b/sdk/automanage/azure-mgmt-automanage/README.md @@ -1,13 +1,13 @@ # Microsoft Azure SDK for Python -This is the Microsoft Azure MyService Management Client Library. +This is the Microsoft Azure Auto Manage Management Client Library. This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). # Usage -For code examples, see [MyService Management](https://docs.microsoft.com/python/api/overview/azure/) +For code examples, see [Auto Manage Management](https://docs.microsoft.com/python/api/overview/azure/) on docs.microsoft.com. diff --git a/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/_version.py b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/_version.py index 95e84007ac63..e5754a47ce68 100644 --- a/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/_version.py +++ b/sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "0.1.0-preview" +VERSION = "1.0.0b1" diff --git a/sdk/automanage/azure-mgmt-automanage/dev_requirements.txt b/sdk/automanage/azure-mgmt-automanage/dev_requirements.txt new file mode 100644 index 000000000000..6ccb7f031ddd --- /dev/null +++ b/sdk/automanage/azure-mgmt-automanage/dev_requirements.txt @@ -0,0 +1 @@ +-e ../../../tools/azure-sdk-tools diff --git a/sdk/automanage/azure-mgmt-automanage/sdk_packaging.toml b/sdk/automanage/azure-mgmt-automanage/sdk_packaging.toml index 479ebb50c61d..0cbc63c7cc85 100644 --- a/sdk/automanage/azure-mgmt-automanage/sdk_packaging.toml +++ b/sdk/automanage/azure-mgmt-automanage/sdk_packaging.toml @@ -1,7 +1,7 @@ [packaging] package_name = "azure-mgmt-automanage" package_nspkg = "azure-mgmt-nspkg" -package_pprint_name = "MyService Management" +package_pprint_name = "Auto Manage Management" package_doc_id = "" is_stable = false is_arm = true diff --git a/sdk/automanage/azure-mgmt-automanage/setup.py b/sdk/automanage/azure-mgmt-automanage/setup.py index 7f7d212bdb2c..849edc567afc 100644 --- a/sdk/automanage/azure-mgmt-automanage/setup.py +++ b/sdk/automanage/azure-mgmt-automanage/setup.py @@ -13,7 +13,7 @@ # Change the PACKAGE_NAME only to change folder and different name PACKAGE_NAME = "azure-mgmt-automanage" -PACKAGE_PPRINT_NAME = "MyService Management" +PACKAGE_PPRINT_NAME = "Auto Manage Management" # a-b-c => a/b/c package_folder_path = PACKAGE_NAME.replace('-', '/')