From a2f24ff59c1ef66709a7e3ea595b32368fe5826c Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 24 Nov 2021 01:54:19 +0000 Subject: [PATCH] CodeGen from PR 16847 in Azure/azure-rest-api-specs Add Track2 release go tag (#16847) * Add Track2 release go tag * recover --- .../azure-mgmt-blueprint/CHANGELOG.md | 5 + .../azure-mgmt-blueprint/LICENSE.txt | 21 + .../azure-mgmt-blueprint/MANIFEST.in | 6 + sdk/blueprint/azure-mgmt-blueprint/README.md | 27 + sdk/blueprint/azure-mgmt-blueprint/_meta.json | 11 + .../azure-mgmt-blueprint/azure/__init__.py | 1 + .../azure/mgmt/__init__.py | 1 + .../azure/mgmt/blueprint/__init__.py | 19 + .../blueprint/_blueprint_management_client.py | 107 + .../azure/mgmt/blueprint/_configuration.py | 65 + .../azure/mgmt/blueprint/_metadata.json | 96 + .../azure/mgmt/blueprint/_version.py | 9 + .../azure/mgmt/blueprint/aio/__init__.py | 10 + .../aio/_blueprint_management_client.py | 100 + .../mgmt/blueprint/aio/_configuration.py | 61 + .../mgmt/blueprint/aio/operations/__init__.py | 23 + .../aio/operations/_artifacts_operations.py | 316 +++ .../_assignment_operations_operations.py | 180 ++ .../aio/operations/_assignments_operations.py | 365 +++ .../aio/operations/_blueprints_operations.py | 300 +++ .../_published_artifacts_operations.py | 188 ++ .../_published_blueprints_operations.py | 320 +++ .../azure/mgmt/blueprint/models/__init__.py | 168 ++ .../_blueprint_management_client_enums.py | 93 + .../azure/mgmt/blueprint/models/_models.py | 1882 +++++++++++++++ .../mgmt/blueprint/models/_models_py3.py | 2073 +++++++++++++++++ .../mgmt/blueprint/operations/__init__.py | 23 + .../operations/_artifacts_operations.py | 324 +++ .../_assignment_operations_operations.py | 186 ++ .../operations/_assignments_operations.py | 374 +++ .../operations/_blueprints_operations.py | 308 +++ .../_published_artifacts_operations.py | 194 ++ .../_published_blueprints_operations.py | 328 +++ .../azure/mgmt/blueprint/py.typed | 1 + .../azure-mgmt-blueprint/sdk_packaging.toml | 9 + sdk/blueprint/azure-mgmt-blueprint/setup.cfg | 2 + sdk/blueprint/azure-mgmt-blueprint/setup.py | 90 + sdk/blueprint/ci.yml | 33 + 38 files changed, 8319 insertions(+) create mode 100644 sdk/blueprint/azure-mgmt-blueprint/CHANGELOG.md create mode 100644 sdk/blueprint/azure-mgmt-blueprint/LICENSE.txt create mode 100644 sdk/blueprint/azure-mgmt-blueprint/MANIFEST.in create mode 100644 sdk/blueprint/azure-mgmt-blueprint/README.md create mode 100644 sdk/blueprint/azure-mgmt-blueprint/_meta.json create mode 100644 sdk/blueprint/azure-mgmt-blueprint/azure/__init__.py create mode 100644 sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/__init__.py create mode 100644 sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/__init__.py create mode 100644 sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/_blueprint_management_client.py create mode 100644 sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/_configuration.py create mode 100644 sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/_metadata.json create mode 100644 sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/_version.py create mode 100644 sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/__init__.py create mode 100644 sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/_blueprint_management_client.py create mode 100644 sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/_configuration.py create mode 100644 sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/operations/__init__.py create mode 100644 sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/operations/_artifacts_operations.py create mode 100644 sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/operations/_assignment_operations_operations.py create mode 100644 sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/operations/_assignments_operations.py create mode 100644 sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/operations/_blueprints_operations.py create mode 100644 sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/operations/_published_artifacts_operations.py create mode 100644 sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/operations/_published_blueprints_operations.py create mode 100644 sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/models/__init__.py create mode 100644 sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/models/_blueprint_management_client_enums.py create mode 100644 sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/models/_models.py create mode 100644 sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/models/_models_py3.py create mode 100644 sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/operations/__init__.py create mode 100644 sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/operations/_artifacts_operations.py create mode 100644 sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/operations/_assignment_operations_operations.py create mode 100644 sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/operations/_assignments_operations.py create mode 100644 sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/operations/_blueprints_operations.py create mode 100644 sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/operations/_published_artifacts_operations.py create mode 100644 sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/operations/_published_blueprints_operations.py create mode 100644 sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/py.typed create mode 100644 sdk/blueprint/azure-mgmt-blueprint/sdk_packaging.toml create mode 100644 sdk/blueprint/azure-mgmt-blueprint/setup.cfg create mode 100644 sdk/blueprint/azure-mgmt-blueprint/setup.py create mode 100644 sdk/blueprint/ci.yml diff --git a/sdk/blueprint/azure-mgmt-blueprint/CHANGELOG.md b/sdk/blueprint/azure-mgmt-blueprint/CHANGELOG.md new file mode 100644 index 0000000000000..578ed6acf4796 --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/blueprint/azure-mgmt-blueprint/LICENSE.txt b/sdk/blueprint/azure-mgmt-blueprint/LICENSE.txt new file mode 100644 index 0000000000000..2d3163745319c --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2021 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sdk/blueprint/azure-mgmt-blueprint/MANIFEST.in b/sdk/blueprint/azure-mgmt-blueprint/MANIFEST.in new file mode 100644 index 0000000000000..ef61eb0e35276 --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/MANIFEST.in @@ -0,0 +1,6 @@ +include _meta.json +recursive-include tests *.py *.yaml +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py +include LICENSE.txt diff --git a/sdk/blueprint/azure-mgmt-blueprint/README.md b/sdk/blueprint/azure-mgmt-blueprint/README.md new file mode 100644 index 0000000000000..2e03340de73bb --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/README.md @@ -0,0 +1,27 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure MyService Management Client Library. +This package has been tested with Python 2.7, 3.6+. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + + +# Usage + + +To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) + + + +For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) +Code samples for this package can be found at [MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-blueprint%2FREADME.png) diff --git a/sdk/blueprint/azure-mgmt-blueprint/_meta.json b/sdk/blueprint/azure-mgmt-blueprint/_meta.json new file mode 100644 index 0000000000000..6cea89484c0db --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.4.5", + "use": [ + "@autorest/python@5.8.4", + "@autorest/modelerfour@4.19.2" + ], + "commit": "6acc7e2e59b3777da22e417149d0c71d05054bff", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/blueprint/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", + "readme": "specification/blueprint/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/blueprint/azure-mgmt-blueprint/azure/__init__.py b/sdk/blueprint/azure-mgmt-blueprint/azure/__init__.py new file mode 100644 index 0000000000000..8db66d3d0f0f2 --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/__init__.py b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/__init__.py new file mode 100644 index 0000000000000..8db66d3d0f0f2 --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/__init__.py b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/__init__.py new file mode 100644 index 0000000000000..06433a3227bdc --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/__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 ._blueprint_management_client import BlueprintManagementClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['BlueprintManagementClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/_blueprint_management_client.py b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/_blueprint_management_client.py new file mode 100644 index 0000000000000..53edb643df2a1 --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/_blueprint_management_client.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 + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import BlueprintManagementClientConfiguration +from .operations import BlueprintsOperations +from .operations import ArtifactsOperations +from .operations import PublishedBlueprintsOperations +from .operations import PublishedArtifactsOperations +from .operations import AssignmentsOperations +from .operations import AssignmentOperationsOperations +from . import models + + +class BlueprintManagementClient(object): + """Blueprint Client. + + :ivar blueprints: BlueprintsOperations operations + :vartype blueprints: blueprint_management_client.operations.BlueprintsOperations + :ivar artifacts: ArtifactsOperations operations + :vartype artifacts: blueprint_management_client.operations.ArtifactsOperations + :ivar published_blueprints: PublishedBlueprintsOperations operations + :vartype published_blueprints: blueprint_management_client.operations.PublishedBlueprintsOperations + :ivar published_artifacts: PublishedArtifactsOperations operations + :vartype published_artifacts: blueprint_management_client.operations.PublishedArtifactsOperations + :ivar assignments: AssignmentsOperations operations + :vartype assignments: blueprint_management_client.operations.AssignmentsOperations + :ivar assignment_operations: AssignmentOperationsOperations operations + :vartype assignment_operations: blueprint_management_client.operations.AssignmentOperationsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param str base_url: Service URL + """ + + def __init__( + self, + credential, # type: "TokenCredential" + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = BlueprintManagementClientConfiguration(credential, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.blueprints = BlueprintsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.artifacts = ArtifactsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.published_blueprints = PublishedBlueprintsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.published_artifacts = PublishedArtifactsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.assignments = AssignmentsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.assignment_operations = AssignmentOperationsOperations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + http_request.url = self._client.format_url(http_request.url) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> BlueprintManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/_configuration.py b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/_configuration.py new file mode 100644 index 0000000000000..edb7f9da6d2f2 --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/_configuration.py @@ -0,0 +1,65 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class BlueprintManagementClientConfiguration(Configuration): + """Configuration for BlueprintManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + """ + + def __init__( + self, + credential, # type: "TokenCredential" + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + super(BlueprintManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.api_version = "2018-11-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-blueprint/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/_metadata.json b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/_metadata.json new file mode 100644 index 0000000000000..e7d6fcb927aea --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/_metadata.json @@ -0,0 +1,96 @@ +{ + "chosen_version": "2018-11-01-preview", + "total_api_version_list": ["2018-11-01-preview"], + "client": { + "name": "BlueprintManagementClient", + "filename": "_blueprint_management_client", + "description": "Blueprint Client.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": false, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"BlueprintManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"BlueprintManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + } + }, + "constant": { + }, + "call": "credential", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "blueprints": "BlueprintsOperations", + "artifacts": "ArtifactsOperations", + "published_blueprints": "PublishedBlueprintsOperations", + "published_artifacts": "PublishedArtifactsOperations", + "assignments": "AssignmentsOperations", + "assignment_operations": "AssignmentOperationsOperations" + } +} \ No newline at end of file diff --git a/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/_version.py b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/_version.py new file mode 100644 index 0000000000000..e5754a47ce68f --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/__init__.py b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/__init__.py new file mode 100644 index 0000000000000..d7910f736604c --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/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 ._blueprint_management_client import BlueprintManagementClient +__all__ = ['BlueprintManagementClient'] diff --git a/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/_blueprint_management_client.py b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/_blueprint_management_client.py new file mode 100644 index 0000000000000..44f0dbb15f65d --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/_blueprint_management_client.py @@ -0,0 +1,100 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import BlueprintManagementClientConfiguration +from .operations import BlueprintsOperations +from .operations import ArtifactsOperations +from .operations import PublishedBlueprintsOperations +from .operations import PublishedArtifactsOperations +from .operations import AssignmentsOperations +from .operations import AssignmentOperationsOperations +from .. import models + + +class BlueprintManagementClient(object): + """Blueprint Client. + + :ivar blueprints: BlueprintsOperations operations + :vartype blueprints: blueprint_management_client.aio.operations.BlueprintsOperations + :ivar artifacts: ArtifactsOperations operations + :vartype artifacts: blueprint_management_client.aio.operations.ArtifactsOperations + :ivar published_blueprints: PublishedBlueprintsOperations operations + :vartype published_blueprints: blueprint_management_client.aio.operations.PublishedBlueprintsOperations + :ivar published_artifacts: PublishedArtifactsOperations operations + :vartype published_artifacts: blueprint_management_client.aio.operations.PublishedArtifactsOperations + :ivar assignments: AssignmentsOperations operations + :vartype assignments: blueprint_management_client.aio.operations.AssignmentsOperations + :ivar assignment_operations: AssignmentOperationsOperations operations + :vartype assignment_operations: blueprint_management_client.aio.operations.AssignmentOperationsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param str base_url: Service URL + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = BlueprintManagementClientConfiguration(credential, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.blueprints = BlueprintsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.artifacts = ArtifactsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.published_blueprints = PublishedBlueprintsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.published_artifacts = PublishedArtifactsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.assignments = AssignmentsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.assignment_operations = AssignmentOperationsOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + http_request.url = self._client.format_url(http_request.url) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "BlueprintManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/_configuration.py b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/_configuration.py new file mode 100644 index 0000000000000..ae8b89fcf6b83 --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/_configuration.py @@ -0,0 +1,61 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class BlueprintManagementClientConfiguration(Configuration): + """Configuration for BlueprintManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + super(BlueprintManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.api_version = "2018-11-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-blueprint/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/operations/__init__.py b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/operations/__init__.py new file mode 100644 index 0000000000000..b5c4b8a1b2c27 --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/operations/__init__.py @@ -0,0 +1,23 @@ +# 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 ._blueprints_operations import BlueprintsOperations +from ._artifacts_operations import ArtifactsOperations +from ._published_blueprints_operations import PublishedBlueprintsOperations +from ._published_artifacts_operations import PublishedArtifactsOperations +from ._assignments_operations import AssignmentsOperations +from ._assignment_operations_operations import AssignmentOperationsOperations + +__all__ = [ + 'BlueprintsOperations', + 'ArtifactsOperations', + 'PublishedBlueprintsOperations', + 'PublishedArtifactsOperations', + 'AssignmentsOperations', + 'AssignmentOperationsOperations', +] diff --git a/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/operations/_artifacts_operations.py b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/operations/_artifacts_operations.py new file mode 100644 index 0000000000000..760d9fe39234a --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/operations/_artifacts_operations.py @@ -0,0 +1,316 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ArtifactsOperations: + """ArtifactsOperations 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: ~blueprint_management_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, + resource_scope: str, + blueprint_name: str, + artifact_name: str, + artifact: "_models.Artifact", + **kwargs: Any + ) -> "_models.Artifact": + """Create or update blueprint artifact. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param blueprint_name: Name of the blueprint definition. + :type blueprint_name: str + :param artifact_name: Name of the blueprint artifact. + :type artifact_name: str + :param artifact: Blueprint artifact to create or update. + :type artifact: ~blueprint_management_client.models.Artifact + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Artifact, or the result of cls(response) + :rtype: ~blueprint_management_client.models.Artifact + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Artifact"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'blueprintName': self._serialize.url("blueprint_name", blueprint_name, 'str'), + 'artifactName': self._serialize.url("artifact_name", artifact_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(artifact, 'Artifact') + 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 [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Artifact', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/artifacts/{artifactName}'} # type: ignore + + async def get( + self, + resource_scope: str, + blueprint_name: str, + artifact_name: str, + **kwargs: Any + ) -> "_models.Artifact": + """Get a blueprint artifact. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param blueprint_name: Name of the blueprint definition. + :type blueprint_name: str + :param artifact_name: Name of the blueprint artifact. + :type artifact_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Artifact, or the result of cls(response) + :rtype: ~blueprint_management_client.models.Artifact + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Artifact"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'blueprintName': self._serialize.url("blueprint_name", blueprint_name, 'str'), + 'artifactName': self._serialize.url("artifact_name", artifact_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Artifact', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/artifacts/{artifactName}'} # type: ignore + + async def delete( + self, + resource_scope: str, + blueprint_name: str, + artifact_name: str, + **kwargs: Any + ) -> Optional["_models.Artifact"]: + """Delete a blueprint artifact. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param blueprint_name: Name of the blueprint definition. + :type blueprint_name: str + :param artifact_name: Name of the blueprint artifact. + :type artifact_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Artifact, or the result of cls(response) + :rtype: ~blueprint_management_client.models.Artifact or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Artifact"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'blueprintName': self._serialize.url("blueprint_name", blueprint_name, 'str'), + 'artifactName': self._serialize.url("artifact_name", artifact_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Artifact', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + delete.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/artifacts/{artifactName}'} # type: ignore + + def list( + self, + resource_scope: str, + blueprint_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ArtifactList"]: + """List artifacts for a given blueprint definition. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param blueprint_name: Name of the blueprint definition. + :type blueprint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ArtifactList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~blueprint_management_client.models.ArtifactList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArtifactList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'blueprintName': self._serialize.url("blueprint_name", blueprint_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ArtifactList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/artifacts'} # type: ignore diff --git a/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/operations/_assignment_operations_operations.py b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/operations/_assignment_operations_operations.py new file mode 100644 index 0000000000000..bdb569f01f43e --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/operations/_assignment_operations_operations.py @@ -0,0 +1,180 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AssignmentOperationsOperations: + """AssignmentOperationsOperations 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: ~blueprint_management_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, + resource_scope: str, + assignment_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.AssignmentOperationList"]: + """List operations for given blueprint assignment within a subscription or a management group. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param assignment_name: Name of the blueprint assignment. + :type assignment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AssignmentOperationList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~blueprint_management_client.models.AssignmentOperationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AssignmentOperationList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'assignmentName': self._serialize.url("assignment_name", assignment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AssignmentOperationList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprintAssignments/{assignmentName}/assignmentOperations'} # type: ignore + + async def get( + self, + resource_scope: str, + assignment_name: str, + assignment_operation_name: str, + **kwargs: Any + ) -> "_models.AssignmentOperation": + """Get a blueprint assignment operation. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param assignment_name: Name of the blueprint assignment. + :type assignment_name: str + :param assignment_operation_name: Name of the blueprint assignment operation. + :type assignment_operation_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AssignmentOperation, or the result of cls(response) + :rtype: ~blueprint_management_client.models.AssignmentOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AssignmentOperation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'assignmentName': self._serialize.url("assignment_name", assignment_name, 'str'), + 'assignmentOperationName': self._serialize.url("assignment_operation_name", assignment_operation_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AssignmentOperation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprintAssignments/{assignmentName}/assignmentOperations/{assignmentOperationName}'} # type: ignore diff --git a/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/operations/_assignments_operations.py b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/operations/_assignments_operations.py new file mode 100644 index 0000000000000..dc4ff90ca0579 --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/operations/_assignments_operations.py @@ -0,0 +1,365 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AssignmentsOperations: + """AssignmentsOperations 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: ~blueprint_management_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, + resource_scope: str, + assignment_name: str, + assignment: "_models.Assignment", + **kwargs: Any + ) -> "_models.Assignment": + """Create or update a blueprint assignment. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param assignment_name: Name of the blueprint assignment. + :type assignment_name: str + :param assignment: Blueprint assignment object to save. + :type assignment: ~blueprint_management_client.models.Assignment + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Assignment, or the result of cls(response) + :rtype: ~blueprint_management_client.models.Assignment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Assignment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'assignmentName': self._serialize.url("assignment_name", assignment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(assignment, 'Assignment') + 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 [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Assignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprintAssignments/{assignmentName}'} # type: ignore + + async def get( + self, + resource_scope: str, + assignment_name: str, + **kwargs: Any + ) -> "_models.Assignment": + """Get a blueprint assignment. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param assignment_name: Name of the blueprint assignment. + :type assignment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Assignment, or the result of cls(response) + :rtype: ~blueprint_management_client.models.Assignment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Assignment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'assignmentName': self._serialize.url("assignment_name", assignment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Assignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprintAssignments/{assignmentName}'} # type: ignore + + async def delete( + self, + resource_scope: str, + assignment_name: str, + delete_behavior: Optional[Union[str, "_models.AssignmentDeleteBehavior"]] = None, + **kwargs: Any + ) -> Optional["_models.Assignment"]: + """Delete a blueprint assignment. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param assignment_name: Name of the blueprint assignment. + :type assignment_name: str + :param delete_behavior: When deleteBehavior=all, the resources that were created by the + blueprint assignment will be deleted. + :type delete_behavior: str or ~blueprint_management_client.models.AssignmentDeleteBehavior + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Assignment, or the result of cls(response) + :rtype: ~blueprint_management_client.models.Assignment or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Assignment"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'assignmentName': self._serialize.url("assignment_name", assignment_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') + if delete_behavior is not None: + query_parameters['deleteBehavior'] = self._serialize.query("delete_behavior", delete_behavior, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 202: + deserialized = self._deserialize('Assignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + delete.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprintAssignments/{assignmentName}'} # type: ignore + + async def who_is_blueprint( + self, + resource_scope: str, + assignment_name: str, + **kwargs: Any + ) -> "_models.WhoIsBlueprintContract": + """Get Blueprints service SPN objectId. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param assignment_name: Name of the blueprint assignment. + :type assignment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WhoIsBlueprintContract, or the result of cls(response) + :rtype: ~blueprint_management_client.models.WhoIsBlueprintContract + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WhoIsBlueprintContract"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.who_is_blueprint.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'assignmentName': self._serialize.url("assignment_name", assignment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('WhoIsBlueprintContract', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + who_is_blueprint.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprintAssignments/{assignmentName}/whoIsBlueprint'} # type: ignore + + def list( + self, + resource_scope: str, + **kwargs: Any + ) -> AsyncIterable["_models.AssignmentList"]: + """List blueprint assignments within a subscription or a management group. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AssignmentList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~blueprint_management_client.models.AssignmentList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AssignmentList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + } + 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('AssignmentList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprintAssignments'} # type: ignore diff --git a/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/operations/_blueprints_operations.py b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/operations/_blueprints_operations.py new file mode 100644 index 0000000000000..b2804b4a01654 --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/operations/_blueprints_operations.py @@ -0,0 +1,300 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class BlueprintsOperations: + """BlueprintsOperations 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: ~blueprint_management_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, + resource_scope: str, + blueprint_name: str, + blueprint: "_models.Blueprint", + **kwargs: Any + ) -> "_models.Blueprint": + """Create or update a blueprint definition. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param blueprint_name: Name of the blueprint definition. + :type blueprint_name: str + :param blueprint: Blueprint definition. + :type blueprint: ~blueprint_management_client.models.Blueprint + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Blueprint, or the result of cls(response) + :rtype: ~blueprint_management_client.models.Blueprint + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Blueprint"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'blueprintName': self._serialize.url("blueprint_name", blueprint_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(blueprint, 'Blueprint') + 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 [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Blueprint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}'} # type: ignore + + async def get( + self, + resource_scope: str, + blueprint_name: str, + **kwargs: Any + ) -> "_models.Blueprint": + """Get a blueprint definition. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param blueprint_name: Name of the blueprint definition. + :type blueprint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Blueprint, or the result of cls(response) + :rtype: ~blueprint_management_client.models.Blueprint + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Blueprint"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'blueprintName': self._serialize.url("blueprint_name", blueprint_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Blueprint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}'} # type: ignore + + async def delete( + self, + resource_scope: str, + blueprint_name: str, + **kwargs: Any + ) -> Optional["_models.Blueprint"]: + """Delete a blueprint definition. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param blueprint_name: Name of the blueprint definition. + :type blueprint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Blueprint, or the result of cls(response) + :rtype: ~blueprint_management_client.models.Blueprint or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Blueprint"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'blueprintName': self._serialize.url("blueprint_name", blueprint_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Blueprint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + delete.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}'} # type: ignore + + def list( + self, + resource_scope: str, + **kwargs: Any + ) -> AsyncIterable["_models.BlueprintList"]: + """List blueprint definitions. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BlueprintList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~blueprint_management_client.models.BlueprintList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BlueprintList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + } + 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('BlueprintList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprints'} # type: ignore diff --git a/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/operations/_published_artifacts_operations.py b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/operations/_published_artifacts_operations.py new file mode 100644 index 0000000000000..48a0402fb715d --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/operations/_published_artifacts_operations.py @@ -0,0 +1,188 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PublishedArtifactsOperations: + """PublishedArtifactsOperations 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: ~blueprint_management_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 get( + self, + resource_scope: str, + blueprint_name: str, + version_id: str, + artifact_name: str, + **kwargs: Any + ) -> "_models.Artifact": + """Get an artifact for a published blueprint definition. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param blueprint_name: Name of the blueprint definition. + :type blueprint_name: str + :param version_id: Version of the published blueprint definition. + :type version_id: str + :param artifact_name: Name of the blueprint artifact. + :type artifact_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Artifact, or the result of cls(response) + :rtype: ~blueprint_management_client.models.Artifact + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Artifact"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'blueprintName': self._serialize.url("blueprint_name", blueprint_name, 'str'), + 'versionId': self._serialize.url("version_id", version_id, 'str'), + 'artifactName': self._serialize.url("artifact_name", artifact_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Artifact', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/versions/{versionId}/artifacts/{artifactName}'} # type: ignore + + def list( + self, + resource_scope: str, + blueprint_name: str, + version_id: str, + **kwargs: Any + ) -> AsyncIterable["_models.ArtifactList"]: + """List artifacts for a version of a published blueprint definition. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param blueprint_name: Name of the blueprint definition. + :type blueprint_name: str + :param version_id: Version of the published blueprint definition. + :type version_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ArtifactList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~blueprint_management_client.models.ArtifactList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArtifactList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'blueprintName': self._serialize.url("blueprint_name", blueprint_name, 'str'), + 'versionId': self._serialize.url("version_id", version_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ArtifactList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/versions/{versionId}/artifacts'} # type: ignore diff --git a/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/operations/_published_blueprints_operations.py b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/operations/_published_blueprints_operations.py new file mode 100644 index 0000000000000..f7429fcd096d9 --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/aio/operations/_published_blueprints_operations.py @@ -0,0 +1,320 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PublishedBlueprintsOperations: + """PublishedBlueprintsOperations 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: ~blueprint_management_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( + self, + resource_scope: str, + blueprint_name: str, + version_id: str, + published_blueprint: Optional["_models.PublishedBlueprint"] = None, + **kwargs: Any + ) -> "_models.PublishedBlueprint": + """Publish a new version of the blueprint definition with the latest artifacts. Published + blueprint definitions are immutable. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param blueprint_name: Name of the blueprint definition. + :type blueprint_name: str + :param version_id: Version of the published blueprint definition. + :type version_id: str + :param published_blueprint: Published Blueprint to create or update. + :type published_blueprint: ~blueprint_management_client.models.PublishedBlueprint + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublishedBlueprint, or the result of cls(response) + :rtype: ~blueprint_management_client.models.PublishedBlueprint + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PublishedBlueprint"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'blueprintName': self._serialize.url("blueprint_name", blueprint_name, 'str'), + 'versionId': self._serialize.url("version_id", version_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if published_blueprint is not None: + body_content = self._serialize.body(published_blueprint, 'PublishedBlueprint') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PublishedBlueprint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/versions/{versionId}'} # type: ignore + + async def get( + self, + resource_scope: str, + blueprint_name: str, + version_id: str, + **kwargs: Any + ) -> "_models.PublishedBlueprint": + """Get a published version of a blueprint definition. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param blueprint_name: Name of the blueprint definition. + :type blueprint_name: str + :param version_id: Version of the published blueprint definition. + :type version_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublishedBlueprint, or the result of cls(response) + :rtype: ~blueprint_management_client.models.PublishedBlueprint + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PublishedBlueprint"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'blueprintName': self._serialize.url("blueprint_name", blueprint_name, 'str'), + 'versionId': self._serialize.url("version_id", version_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PublishedBlueprint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/versions/{versionId}'} # type: ignore + + async def delete( + self, + resource_scope: str, + blueprint_name: str, + version_id: str, + **kwargs: Any + ) -> Optional["_models.PublishedBlueprint"]: + """Delete a published version of a blueprint definition. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param blueprint_name: Name of the blueprint definition. + :type blueprint_name: str + :param version_id: Version of the published blueprint definition. + :type version_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublishedBlueprint, or the result of cls(response) + :rtype: ~blueprint_management_client.models.PublishedBlueprint or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PublishedBlueprint"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'blueprintName': self._serialize.url("blueprint_name", blueprint_name, 'str'), + 'versionId': self._serialize.url("version_id", version_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PublishedBlueprint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + delete.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/versions/{versionId}'} # type: ignore + + def list( + self, + resource_scope: str, + blueprint_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.PublishedBlueprintList"]: + """List published versions of given blueprint definition. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param blueprint_name: Name of the blueprint definition. + :type blueprint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PublishedBlueprintList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~blueprint_management_client.models.PublishedBlueprintList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PublishedBlueprintList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'blueprintName': self._serialize.url("blueprint_name", blueprint_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PublishedBlueprintList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/versions'} # type: ignore diff --git a/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/models/__init__.py b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/models/__init__.py new file mode 100644 index 0000000000000..724efb5dfabd9 --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/models/__init__.py @@ -0,0 +1,168 @@ +# 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 Artifact + from ._models_py3 import ArtifactList + from ._models_py3 import ArtifactPropertiesBase + from ._models_py3 import Assignment + from ._models_py3 import AssignmentDeploymentJob + from ._models_py3 import AssignmentDeploymentJobResult + from ._models_py3 import AssignmentJobCreatedResource + from ._models_py3 import AssignmentList + from ._models_py3 import AssignmentLockSettings + from ._models_py3 import AssignmentOperation + from ._models_py3 import AssignmentOperationList + from ._models_py3 import AssignmentProperties + from ._models_py3 import AssignmentStatus + from ._models_py3 import AzureResourceBase + from ._models_py3 import AzureResourceManagerError + from ._models_py3 import Blueprint + from ._models_py3 import BlueprintList + from ._models_py3 import BlueprintProperties + from ._models_py3 import BlueprintResourcePropertiesBase + from ._models_py3 import BlueprintResourceStatusBase + from ._models_py3 import BlueprintStatus + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorResponse + from ._models_py3 import KeyVaultReference + from ._models_py3 import ManagedServiceIdentity + from ._models_py3 import ParameterDefinition + from ._models_py3 import ParameterValue + from ._models_py3 import PolicyAssignmentArtifact + from ._models_py3 import PolicyAssignmentArtifactProperties + from ._models_py3 import PublishedBlueprint + from ._models_py3 import PublishedBlueprintList + from ._models_py3 import PublishedBlueprintProperties + from ._models_py3 import ResourceGroupDefinition + from ._models_py3 import ResourceGroupValue + from ._models_py3 import ResourceProviderOperation + from ._models_py3 import ResourceProviderOperationDisplay + from ._models_py3 import ResourceProviderOperationList + from ._models_py3 import RoleAssignmentArtifact + from ._models_py3 import RoleAssignmentArtifactProperties + from ._models_py3 import SecretValueReference + from ._models_py3 import SharedBlueprintProperties + from ._models_py3 import TemplateArtifact + from ._models_py3 import TemplateArtifactProperties + from ._models_py3 import TrackedResource + from ._models_py3 import UserAssignedIdentity + from ._models_py3 import WhoIsBlueprintContract +except (SyntaxError, ImportError): + from ._models import Artifact # type: ignore + from ._models import ArtifactList # type: ignore + from ._models import ArtifactPropertiesBase # type: ignore + from ._models import Assignment # type: ignore + from ._models import AssignmentDeploymentJob # type: ignore + from ._models import AssignmentDeploymentJobResult # type: ignore + from ._models import AssignmentJobCreatedResource # type: ignore + from ._models import AssignmentList # type: ignore + from ._models import AssignmentLockSettings # type: ignore + from ._models import AssignmentOperation # type: ignore + from ._models import AssignmentOperationList # type: ignore + from ._models import AssignmentProperties # type: ignore + from ._models import AssignmentStatus # type: ignore + from ._models import AzureResourceBase # type: ignore + from ._models import AzureResourceManagerError # type: ignore + from ._models import Blueprint # type: ignore + from ._models import BlueprintList # type: ignore + from ._models import BlueprintProperties # type: ignore + from ._models import BlueprintResourcePropertiesBase # type: ignore + from ._models import BlueprintResourceStatusBase # type: ignore + from ._models import BlueprintStatus # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import KeyVaultReference # type: ignore + from ._models import ManagedServiceIdentity # type: ignore + from ._models import ParameterDefinition # type: ignore + from ._models import ParameterValue # type: ignore + from ._models import PolicyAssignmentArtifact # type: ignore + from ._models import PolicyAssignmentArtifactProperties # type: ignore + from ._models import PublishedBlueprint # type: ignore + from ._models import PublishedBlueprintList # type: ignore + from ._models import PublishedBlueprintProperties # type: ignore + from ._models import ResourceGroupDefinition # type: ignore + from ._models import ResourceGroupValue # type: ignore + from ._models import ResourceProviderOperation # type: ignore + from ._models import ResourceProviderOperationDisplay # type: ignore + from ._models import ResourceProviderOperationList # type: ignore + from ._models import RoleAssignmentArtifact # type: ignore + from ._models import RoleAssignmentArtifactProperties # type: ignore + from ._models import SecretValueReference # type: ignore + from ._models import SharedBlueprintProperties # type: ignore + from ._models import TemplateArtifact # type: ignore + from ._models import TemplateArtifactProperties # type: ignore + from ._models import TrackedResource # type: ignore + from ._models import UserAssignedIdentity # type: ignore + from ._models import WhoIsBlueprintContract # type: ignore + +from ._blueprint_management_client_enums import ( + ArtifactKind, + AssignmentDeleteBehavior, + AssignmentLockMode, + AssignmentProvisioningState, + BlueprintTargetScope, + ManagedServiceIdentityType, + TemplateParameterType, +) + +__all__ = [ + 'Artifact', + 'ArtifactList', + 'ArtifactPropertiesBase', + 'Assignment', + 'AssignmentDeploymentJob', + 'AssignmentDeploymentJobResult', + 'AssignmentJobCreatedResource', + 'AssignmentList', + 'AssignmentLockSettings', + 'AssignmentOperation', + 'AssignmentOperationList', + 'AssignmentProperties', + 'AssignmentStatus', + 'AzureResourceBase', + 'AzureResourceManagerError', + 'Blueprint', + 'BlueprintList', + 'BlueprintProperties', + 'BlueprintResourcePropertiesBase', + 'BlueprintResourceStatusBase', + 'BlueprintStatus', + 'ErrorAdditionalInfo', + 'ErrorResponse', + 'KeyVaultReference', + 'ManagedServiceIdentity', + 'ParameterDefinition', + 'ParameterValue', + 'PolicyAssignmentArtifact', + 'PolicyAssignmentArtifactProperties', + 'PublishedBlueprint', + 'PublishedBlueprintList', + 'PublishedBlueprintProperties', + 'ResourceGroupDefinition', + 'ResourceGroupValue', + 'ResourceProviderOperation', + 'ResourceProviderOperationDisplay', + 'ResourceProviderOperationList', + 'RoleAssignmentArtifact', + 'RoleAssignmentArtifactProperties', + 'SecretValueReference', + 'SharedBlueprintProperties', + 'TemplateArtifact', + 'TemplateArtifactProperties', + 'TrackedResource', + 'UserAssignedIdentity', + 'WhoIsBlueprintContract', + 'ArtifactKind', + 'AssignmentDeleteBehavior', + 'AssignmentLockMode', + 'AssignmentProvisioningState', + 'BlueprintTargetScope', + 'ManagedServiceIdentityType', + 'TemplateParameterType', +] diff --git a/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/models/_blueprint_management_client_enums.py b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/models/_blueprint_management_client_enums.py new file mode 100644 index 0000000000000..7ecda0cbf4f06 --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/models/_blueprint_management_client_enums.py @@ -0,0 +1,93 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class ArtifactKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the kind of blueprint artifact. + """ + + TEMPLATE = "template" + ROLE_ASSIGNMENT = "roleAssignment" + POLICY_ASSIGNMENT = "policyAssignment" + +class AssignmentDeleteBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + NONE = "none" + ALL = "all" + +class AssignmentLockMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Lock mode. + """ + + NONE = "None" + ALL_RESOURCES_READ_ONLY = "AllResourcesReadOnly" + ALL_RESOURCES_DO_NOT_DELETE = "AllResourcesDoNotDelete" + +class AssignmentProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """State of the blueprint assignment. + """ + + CREATING = "creating" + VALIDATING = "validating" + WAITING = "waiting" + DEPLOYING = "deploying" + CANCELLING = "cancelling" + LOCKING = "locking" + SUCCEEDED = "succeeded" + FAILED = "failed" + CANCELED = "canceled" + DELETING = "deleting" + +class BlueprintTargetScope(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The scope where this blueprint definition can be assigned. + """ + + #: The blueprint targets a subscription during blueprint assignment. + SUBSCRIPTION = "subscription" + #: The blueprint targets a management group during blueprint assignment. This is reserved for + #: future use. + MANAGEMENT_GROUP = "managementGroup" + +class ManagedServiceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of the managed identity. + """ + + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + +class TemplateParameterType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Allowed data types for Resource Manager template parameters. + """ + + STRING = "string" + ARRAY = "array" + BOOL = "bool" + INT = "int" + OBJECT = "object" + SECURE_OBJECT = "secureObject" + SECURE_STRING = "secureString" diff --git a/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/models/_models.py b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/models/_models.py new file mode 100644 index 0000000000000..502eb647fbe6f --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/models/_models.py @@ -0,0 +1,1882 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import msrest.serialization + + +class AzureResourceBase(msrest.serialization.Model): + """Common properties for all Azure resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar type: Type of this resource. + :vartype type: str + :ivar name: Name of this resource. + :vartype name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AzureResourceBase, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + + +class Artifact(AzureResourceBase): + """Represents a blueprint artifact. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: PolicyAssignmentArtifact, RoleAssignmentArtifact, TemplateArtifact. + + 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: String Id used to locate any resource on Azure. + :vartype id: str + :ivar type: Type of this resource. + :vartype type: str + :ivar name: Name of this resource. + :vartype name: str + :param kind: Required. Specifies the kind of blueprint artifact.Constant filled by server. + Possible values include: "template", "roleAssignment", "policyAssignment". + :type kind: str or ~blueprint_management_client.models.ArtifactKind + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + 'kind': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + _subtype_map = { + 'kind': {'policyAssignment': 'PolicyAssignmentArtifact', 'roleAssignment': 'RoleAssignmentArtifact', 'template': 'TemplateArtifact'} + } + + def __init__( + self, + **kwargs + ): + super(Artifact, self).__init__(**kwargs) + self.kind = 'Artifact' # type: str + + +class ArtifactList(msrest.serialization.Model): + """List of blueprint artifacts. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of blueprint artifacts. + :type value: list[~blueprint_management_client.models.Artifact] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Artifact]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ArtifactList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class ArtifactPropertiesBase(msrest.serialization.Model): + """Common properties shared by different artifacts. + + :param depends_on: Artifacts which need to be deployed before the specified artifact. + :type depends_on: list[str] + """ + + _attribute_map = { + 'depends_on': {'key': 'dependsOn', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(ArtifactPropertiesBase, self).__init__(**kwargs) + self.depends_on = kwargs.get('depends_on', None) + + +class TrackedResource(AzureResourceBase): + """Common properties for all Azure tracked resources. + + 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: String Id used to locate any resource on Azure. + :vartype id: str + :ivar type: Type of this resource. + :vartype type: str + :ivar name: Name of this resource. + :vartype name: str + :param location: Required. The location of this blueprint assignment. + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.location = kwargs['location'] + + +class Assignment(TrackedResource): + """Represents a blueprint assignment. + + 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: String Id used to locate any resource on Azure. + :vartype id: str + :ivar type: Type of this resource. + :vartype type: str + :ivar name: Name of this resource. + :vartype name: str + :param location: Required. The location of this blueprint assignment. + :type location: str + :param identity: Required. Managed identity for this blueprint assignment. + :type identity: ~blueprint_management_client.models.ManagedServiceIdentity + :param display_name: One-liner string explain this resource. + :type display_name: str + :param description: Multi-line explain this resource. + :type description: str + :param blueprint_id: ID of the published version of a blueprint definition. + :type blueprint_id: str + :param scope: The target subscription scope of the blueprint assignment (format: + '/subscriptions/{subscriptionId}'). For management group level assignments, the property is + required. + :type scope: str + :param parameters: Required. Blueprint assignment parameter values. + :type parameters: dict[str, ~blueprint_management_client.models.ParameterValue] + :param resource_groups: Required. Names and locations of resource group placeholders. + :type resource_groups: dict[str, ~blueprint_management_client.models.ResourceGroupValue] + :ivar status: Status of blueprint assignment. This field is readonly. + :vartype status: ~blueprint_management_client.models.AssignmentStatus + :param locks: Defines how resources deployed by a blueprint assignment are locked. + :type locks: ~blueprint_management_client.models.AssignmentLockSettings + :ivar provisioning_state: State of the blueprint assignment. Possible values include: + "creating", "validating", "waiting", "deploying", "cancelling", "locking", "succeeded", + "failed", "canceled", "deleting". + :vartype provisioning_state: str or + ~blueprint_management_client.models.AssignmentProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + 'location': {'required': True}, + 'identity': {'required': True}, + 'display_name': {'max_length': 256, 'min_length': 0}, + 'description': {'max_length': 500, 'min_length': 0}, + 'parameters': {'required': True}, + 'resource_groups': {'required': True}, + 'status': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'blueprint_id': {'key': 'properties.blueprintId', 'type': 'str'}, + 'scope': {'key': 'properties.scope', 'type': 'str'}, + 'parameters': {'key': 'properties.parameters', 'type': '{ParameterValue}'}, + 'resource_groups': {'key': 'properties.resourceGroups', 'type': '{ResourceGroupValue}'}, + 'status': {'key': 'properties.status', 'type': 'AssignmentStatus'}, + 'locks': {'key': 'properties.locks', 'type': 'AssignmentLockSettings'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Assignment, self).__init__(**kwargs) + self.identity = kwargs['identity'] + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.blueprint_id = kwargs.get('blueprint_id', None) + self.scope = kwargs.get('scope', None) + self.parameters = kwargs['parameters'] + self.resource_groups = kwargs['resource_groups'] + self.status = None + self.locks = kwargs.get('locks', None) + self.provisioning_state = None + + +class AssignmentDeploymentJob(msrest.serialization.Model): + """Represents individual job in given blueprint assignment operation. + + :param kind: Kind of job. + :type kind: str + :param action: Name of the action performed in this job. + :type action: str + :param job_id: Id of this job. + :type job_id: str + :param job_state: State of this job. + :type job_state: str + :param result: Deployment job result. + :type result: ~blueprint_management_client.models.AssignmentDeploymentJobResult + :param history: Result of this deployment job for each retry. + :type history: list[~blueprint_management_client.models.AssignmentDeploymentJobResult] + :param request_uri: Reference to deployment job resource id. + :type request_uri: str + """ + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'str'}, + 'job_id': {'key': 'jobId', 'type': 'str'}, + 'job_state': {'key': 'jobState', 'type': 'str'}, + 'result': {'key': 'result', 'type': 'AssignmentDeploymentJobResult'}, + 'history': {'key': 'history', 'type': '[AssignmentDeploymentJobResult]'}, + 'request_uri': {'key': 'requestUri', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AssignmentDeploymentJob, self).__init__(**kwargs) + self.kind = kwargs.get('kind', None) + self.action = kwargs.get('action', None) + self.job_id = kwargs.get('job_id', None) + self.job_state = kwargs.get('job_state', None) + self.result = kwargs.get('result', None) + self.history = kwargs.get('history', None) + self.request_uri = kwargs.get('request_uri', None) + + +class AssignmentDeploymentJobResult(msrest.serialization.Model): + """Result of each individual deployment in a blueprint assignment. + + :param error: Contains error details if deployment job failed. + :type error: ~blueprint_management_client.models.AzureResourceManagerError + :param resources: Resources created as result of the deployment job. + :type resources: list[~blueprint_management_client.models.AssignmentJobCreatedResource] + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'AzureResourceManagerError'}, + 'resources': {'key': 'resources', 'type': '[AssignmentJobCreatedResource]'}, + } + + def __init__( + self, + **kwargs + ): + super(AssignmentDeploymentJobResult, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + self.resources = kwargs.get('resources', None) + + +class AssignmentJobCreatedResource(AzureResourceBase): + """Azure resource created from deployment job. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar type: Type of this resource. + :vartype type: str + :ivar name: Name of this resource. + :vartype name: str + :param properties: Additional properties in a dictionary. + :type properties: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(AssignmentJobCreatedResource, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class AssignmentList(msrest.serialization.Model): + """List of blueprint assignments. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of blueprint assignments. + :type value: list[~blueprint_management_client.models.Assignment] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Assignment]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AssignmentList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class AssignmentLockSettings(msrest.serialization.Model): + """Defines how resources deployed by a blueprint assignment are locked. + + :param mode: Lock mode. Possible values include: "None", "AllResourcesReadOnly", + "AllResourcesDoNotDelete". + :type mode: str or ~blueprint_management_client.models.AssignmentLockMode + :param excluded_principals: List of AAD principals excluded from blueprint locks. Up to 5 + principals are permitted. + :type excluded_principals: list[str] + :param excluded_actions: + List of management operations that are excluded from blueprint locks. Up to 200 actions are permitted. + If the lock mode is set to 'AllResourcesReadOnly', then the following actions are automatically + appended to 'excludedActions': '*/read', + 'Microsoft.Network/virtualNetworks/subnets/join/action' and + 'Microsoft.Authorization/locks/delete'. If the lock mode is set to 'AllResourcesDoNotDelete', + then the following actions are automatically appended to 'excludedActions': + 'Microsoft.Authorization/locks/delete'. Duplicate actions will get removed. + :type excluded_actions: list[str] + """ + + _attribute_map = { + 'mode': {'key': 'mode', 'type': 'str'}, + 'excluded_principals': {'key': 'excludedPrincipals', 'type': '[str]'}, + 'excluded_actions': {'key': 'excludedActions', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(AssignmentLockSettings, self).__init__(**kwargs) + self.mode = kwargs.get('mode', None) + self.excluded_principals = kwargs.get('excluded_principals', None) + self.excluded_actions = kwargs.get('excluded_actions', None) + + +class AssignmentOperation(AzureResourceBase): + """Represents underlying deployment detail for each update to the blueprint assignment. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar type: Type of this resource. + :vartype type: str + :ivar name: Name of this resource. + :vartype name: str + :param blueprint_version: The published version of the blueprint definition used for the + blueprint assignment operation. + :type blueprint_version: str + :param assignment_state: State of this blueprint assignment operation. + :type assignment_state: str + :param time_created: Create time of this blueprint assignment operation. + :type time_created: str + :param time_started: Start time of the underlying deployment. + :type time_started: str + :param time_finished: Finish time of the overall underlying deployments. + :type time_finished: str + :param deployments: List of jobs in this blueprint assignment operation. + :type deployments: list[~blueprint_management_client.models.AssignmentDeploymentJob] + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'blueprint_version': {'key': 'properties.blueprintVersion', 'type': 'str'}, + 'assignment_state': {'key': 'properties.assignmentState', 'type': 'str'}, + 'time_created': {'key': 'properties.timeCreated', 'type': 'str'}, + 'time_started': {'key': 'properties.timeStarted', 'type': 'str'}, + 'time_finished': {'key': 'properties.timeFinished', 'type': 'str'}, + 'deployments': {'key': 'properties.deployments', 'type': '[AssignmentDeploymentJob]'}, + } + + def __init__( + self, + **kwargs + ): + super(AssignmentOperation, self).__init__(**kwargs) + self.blueprint_version = kwargs.get('blueprint_version', None) + self.assignment_state = kwargs.get('assignment_state', None) + self.time_created = kwargs.get('time_created', None) + self.time_started = kwargs.get('time_started', None) + self.time_finished = kwargs.get('time_finished', None) + self.deployments = kwargs.get('deployments', None) + + +class AssignmentOperationList(msrest.serialization.Model): + """List of AssignmentOperation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of AssignmentOperation. + :type value: list[~blueprint_management_client.models.AssignmentOperation] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AssignmentOperation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AssignmentOperationList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class BlueprintResourcePropertiesBase(msrest.serialization.Model): + """Shared properties between all blueprint resources. + + :param display_name: One-liner string explain this resource. + :type display_name: str + :param description: Multi-line explain this resource. + :type description: str + """ + + _validation = { + 'display_name': {'max_length': 256, 'min_length': 0}, + 'description': {'max_length': 500, 'min_length': 0}, + } + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(BlueprintResourcePropertiesBase, self).__init__(**kwargs) + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + + +class AssignmentProperties(BlueprintResourcePropertiesBase): + """Detailed properties for a blueprint assignment. + + 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. + + :param display_name: One-liner string explain this resource. + :type display_name: str + :param description: Multi-line explain this resource. + :type description: str + :param blueprint_id: ID of the published version of a blueprint definition. + :type blueprint_id: str + :param scope: The target subscription scope of the blueprint assignment (format: + '/subscriptions/{subscriptionId}'). For management group level assignments, the property is + required. + :type scope: str + :param parameters: Required. Blueprint assignment parameter values. + :type parameters: dict[str, ~blueprint_management_client.models.ParameterValue] + :param resource_groups: Required. Names and locations of resource group placeholders. + :type resource_groups: dict[str, ~blueprint_management_client.models.ResourceGroupValue] + :ivar status: Status of blueprint assignment. This field is readonly. + :vartype status: ~blueprint_management_client.models.AssignmentStatus + :param locks: Defines how resources deployed by a blueprint assignment are locked. + :type locks: ~blueprint_management_client.models.AssignmentLockSettings + :ivar provisioning_state: State of the blueprint assignment. Possible values include: + "creating", "validating", "waiting", "deploying", "cancelling", "locking", "succeeded", + "failed", "canceled", "deleting". + :vartype provisioning_state: str or + ~blueprint_management_client.models.AssignmentProvisioningState + """ + + _validation = { + 'display_name': {'max_length': 256, 'min_length': 0}, + 'description': {'max_length': 500, 'min_length': 0}, + 'parameters': {'required': True}, + 'resource_groups': {'required': True}, + 'status': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'blueprint_id': {'key': 'blueprintId', 'type': 'str'}, + 'scope': {'key': 'scope', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': '{ParameterValue}'}, + 'resource_groups': {'key': 'resourceGroups', 'type': '{ResourceGroupValue}'}, + 'status': {'key': 'status', 'type': 'AssignmentStatus'}, + 'locks': {'key': 'locks', 'type': 'AssignmentLockSettings'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AssignmentProperties, self).__init__(**kwargs) + self.blueprint_id = kwargs.get('blueprint_id', None) + self.scope = kwargs.get('scope', None) + self.parameters = kwargs['parameters'] + self.resource_groups = kwargs['resource_groups'] + self.status = None + self.locks = kwargs.get('locks', None) + self.provisioning_state = None + + +class BlueprintResourceStatusBase(msrest.serialization.Model): + """Shared status properties between all blueprint resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar time_created: Creation time of this blueprint definition. + :vartype time_created: ~datetime.datetime + :ivar last_modified: Last modified time of this blueprint definition. + :vartype last_modified: ~datetime.datetime + """ + + _validation = { + 'time_created': {'readonly': True}, + 'last_modified': {'readonly': True}, + } + + _attribute_map = { + 'time_created': {'key': 'timeCreated', 'type': 'iso-8601'}, + 'last_modified': {'key': 'lastModified', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(BlueprintResourceStatusBase, self).__init__(**kwargs) + self.time_created = None + self.last_modified = None + + +class AssignmentStatus(BlueprintResourceStatusBase): + """The status of a blueprint assignment. This field is readonly. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar time_created: Creation time of this blueprint definition. + :vartype time_created: ~datetime.datetime + :ivar last_modified: Last modified time of this blueprint definition. + :vartype last_modified: ~datetime.datetime + :ivar managed_resources: List of resources that were created by the blueprint assignment. + :vartype managed_resources: list[str] + """ + + _validation = { + 'time_created': {'readonly': True}, + 'last_modified': {'readonly': True}, + 'managed_resources': {'readonly': True}, + } + + _attribute_map = { + 'time_created': {'key': 'timeCreated', 'type': 'iso-8601'}, + 'last_modified': {'key': 'lastModified', 'type': 'iso-8601'}, + 'managed_resources': {'key': 'managedResources', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(AssignmentStatus, self).__init__(**kwargs) + self.managed_resources = None + + +class AzureResourceManagerError(msrest.serialization.Model): + """Error code and message. + + :param code: Error code. + :type code: str + :param message: Error message. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AzureResourceManagerError, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class Blueprint(AzureResourceBase): + """Represents a Blueprint definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar type: Type of this resource. + :vartype type: str + :ivar name: Name of this resource. + :vartype name: str + :param display_name: One-liner string explain this resource. + :type display_name: str + :param description: Multi-line explain this resource. + :type description: str + :ivar status: Status of the blueprint. This field is readonly. + :vartype status: ~blueprint_management_client.models.BlueprintStatus + :param target_scope: The scope where this blueprint definition can be assigned. Possible values + include: "subscription", "managementGroup". + :type target_scope: str or ~blueprint_management_client.models.BlueprintTargetScope + :param parameters: Parameters required by this blueprint definition. + :type parameters: dict[str, ~blueprint_management_client.models.ParameterDefinition] + :param resource_groups: Resource group placeholders defined by this blueprint definition. + :type resource_groups: dict[str, ~blueprint_management_client.models.ResourceGroupDefinition] + :param versions: Published versions of this blueprint definition. + :type versions: any + :ivar layout: Layout view of the blueprint definition for UI reference. + :vartype layout: any + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + 'display_name': {'max_length': 256, 'min_length': 0}, + 'description': {'max_length': 500, 'min_length': 0}, + 'status': {'readonly': True}, + 'layout': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'BlueprintStatus'}, + 'target_scope': {'key': 'properties.targetScope', 'type': 'str'}, + 'parameters': {'key': 'properties.parameters', 'type': '{ParameterDefinition}'}, + 'resource_groups': {'key': 'properties.resourceGroups', 'type': '{ResourceGroupDefinition}'}, + 'versions': {'key': 'properties.versions', 'type': 'object'}, + 'layout': {'key': 'properties.layout', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(Blueprint, self).__init__(**kwargs) + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.status = None + self.target_scope = kwargs.get('target_scope', None) + self.parameters = kwargs.get('parameters', None) + self.resource_groups = kwargs.get('resource_groups', None) + self.versions = kwargs.get('versions', None) + self.layout = None + + +class BlueprintList(msrest.serialization.Model): + """List of blueprint definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of blueprint definitions. + :type value: list[~blueprint_management_client.models.Blueprint] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Blueprint]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(BlueprintList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class SharedBlueprintProperties(BlueprintResourcePropertiesBase): + """Shared Schema for both blueprintProperties and publishedBlueprintProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param display_name: One-liner string explain this resource. + :type display_name: str + :param description: Multi-line explain this resource. + :type description: str + :ivar status: Status of the blueprint. This field is readonly. + :vartype status: ~blueprint_management_client.models.BlueprintStatus + :param target_scope: The scope where this blueprint definition can be assigned. Possible values + include: "subscription", "managementGroup". + :type target_scope: str or ~blueprint_management_client.models.BlueprintTargetScope + :param parameters: Parameters required by this blueprint definition. + :type parameters: dict[str, ~blueprint_management_client.models.ParameterDefinition] + :param resource_groups: Resource group placeholders defined by this blueprint definition. + :type resource_groups: dict[str, ~blueprint_management_client.models.ResourceGroupDefinition] + """ + + _validation = { + 'display_name': {'max_length': 256, 'min_length': 0}, + 'description': {'max_length': 500, 'min_length': 0}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'BlueprintStatus'}, + 'target_scope': {'key': 'targetScope', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': '{ParameterDefinition}'}, + 'resource_groups': {'key': 'resourceGroups', 'type': '{ResourceGroupDefinition}'}, + } + + def __init__( + self, + **kwargs + ): + super(SharedBlueprintProperties, self).__init__(**kwargs) + self.status = None + self.target_scope = kwargs.get('target_scope', None) + self.parameters = kwargs.get('parameters', None) + self.resource_groups = kwargs.get('resource_groups', None) + + +class BlueprintProperties(SharedBlueprintProperties): + """Schema for blueprint definition properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param display_name: One-liner string explain this resource. + :type display_name: str + :param description: Multi-line explain this resource. + :type description: str + :ivar status: Status of the blueprint. This field is readonly. + :vartype status: ~blueprint_management_client.models.BlueprintStatus + :param target_scope: The scope where this blueprint definition can be assigned. Possible values + include: "subscription", "managementGroup". + :type target_scope: str or ~blueprint_management_client.models.BlueprintTargetScope + :param parameters: Parameters required by this blueprint definition. + :type parameters: dict[str, ~blueprint_management_client.models.ParameterDefinition] + :param resource_groups: Resource group placeholders defined by this blueprint definition. + :type resource_groups: dict[str, ~blueprint_management_client.models.ResourceGroupDefinition] + :param versions: Published versions of this blueprint definition. + :type versions: any + :ivar layout: Layout view of the blueprint definition for UI reference. + :vartype layout: any + """ + + _validation = { + 'display_name': {'max_length': 256, 'min_length': 0}, + 'description': {'max_length': 500, 'min_length': 0}, + 'status': {'readonly': True}, + 'layout': {'readonly': True}, + } + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'BlueprintStatus'}, + 'target_scope': {'key': 'targetScope', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': '{ParameterDefinition}'}, + 'resource_groups': {'key': 'resourceGroups', 'type': '{ResourceGroupDefinition}'}, + 'versions': {'key': 'versions', 'type': 'object'}, + 'layout': {'key': 'layout', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(BlueprintProperties, self).__init__(**kwargs) + self.versions = kwargs.get('versions', None) + self.layout = None + + +class BlueprintStatus(BlueprintResourceStatusBase): + """The status of the blueprint. This field is readonly. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar time_created: Creation time of this blueprint definition. + :vartype time_created: ~datetime.datetime + :ivar last_modified: Last modified time of this blueprint definition. + :vartype last_modified: ~datetime.datetime + """ + + _validation = { + 'time_created': {'readonly': True}, + 'last_modified': {'readonly': True}, + } + + _attribute_map = { + 'time_created': {'key': 'timeCreated', 'type': 'iso-8601'}, + 'last_modified': {'key': 'lastModified', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(BlueprintStatus, self).__init__(**kwargs) + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~blueprint_management_client.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~blueprint_management_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(ErrorResponse, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class KeyVaultReference(msrest.serialization.Model): + """Specifies the link to a Key Vault. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Azure resource ID of the Key Vault. + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(KeyVaultReference, self).__init__(**kwargs) + self.id = kwargs['id'] + + +class ManagedServiceIdentity(msrest.serialization.Model): + """Managed identity generic object. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Type of the managed identity. Possible values include: "None", + "SystemAssigned", "UserAssigned". + :type type: str or ~blueprint_management_client.models.ManagedServiceIdentityType + :param principal_id: Azure Active Directory principal ID associated with this Identity. + :type principal_id: str + :param tenant_id: ID of the Azure Active Directory. + :type tenant_id: str + :param user_assigned_identities: The list of user-assigned managed identities associated with + the resource. Key is the Azure resource Id of the managed identity. + :type user_assigned_identities: dict[str, + ~blueprint_management_client.models.UserAssignedIdentity] + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentity}'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagedServiceIdentity, self).__init__(**kwargs) + self.type = kwargs['type'] + self.principal_id = kwargs.get('principal_id', None) + self.tenant_id = kwargs.get('tenant_id', None) + self.user_assigned_identities = kwargs.get('user_assigned_identities', None) + + +class ParameterDefinition(msrest.serialization.Model): + """Represent a parameter with constrains and metadata. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Allowed data types for Resource Manager template parameters. Possible + values include: "string", "array", "bool", "int", "object", "secureObject", "secureString". + :type type: str or ~blueprint_management_client.models.TemplateParameterType + :param default_value: Default Value for this parameter. + :type default_value: any + :param allowed_values: Array of allowed values for this parameter. + :type allowed_values: list[any] + :param display_name: DisplayName of this parameter/resourceGroup. + :type display_name: str + :param description: Description of this parameter/resourceGroup. + :type description: str + :param strong_type: StrongType for UI to render rich experience during blueprint assignment. + Supported strong types are resourceType, principalId and location. + :type strong_type: str + """ + + _validation = { + 'type': {'required': True}, + 'display_name': {'max_length': 256, 'min_length': 0}, + 'description': {'max_length': 500, 'min_length': 0}, + 'strong_type': {'max_length': 64, 'min_length': 0}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'default_value': {'key': 'defaultValue', 'type': 'object'}, + 'allowed_values': {'key': 'allowedValues', 'type': '[object]'}, + 'display_name': {'key': 'metadata.displayName', 'type': 'str'}, + 'description': {'key': 'metadata.description', 'type': 'str'}, + 'strong_type': {'key': 'metadata.strongType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ParameterDefinition, self).__init__(**kwargs) + self.type = kwargs['type'] + self.default_value = kwargs.get('default_value', None) + self.allowed_values = kwargs.get('allowed_values', None) + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.strong_type = kwargs.get('strong_type', None) + + +class ParameterValue(msrest.serialization.Model): + """Value for the specified parameter. Can be either 'value' or 'reference' but not both. + + :param value: Parameter value. Any valid JSON value is allowed including objects, arrays, + strings, numbers and booleans. + :type value: any + :param reference: Parameter value as reference type. + :type reference: ~blueprint_management_client.models.SecretValueReference + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'object'}, + 'reference': {'key': 'reference', 'type': 'SecretValueReference'}, + } + + def __init__( + self, + **kwargs + ): + super(ParameterValue, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.reference = kwargs.get('reference', None) + + +class PolicyAssignmentArtifact(Artifact): + """Blueprint artifact that applies a Policy assignment. + + 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: String Id used to locate any resource on Azure. + :vartype id: str + :ivar type: Type of this resource. + :vartype type: str + :ivar name: Name of this resource. + :vartype name: str + :param kind: Required. Specifies the kind of blueprint artifact.Constant filled by server. + Possible values include: "template", "roleAssignment", "policyAssignment". + :type kind: str or ~blueprint_management_client.models.ArtifactKind + :param display_name: One-liner string explain this resource. + :type display_name: str + :param description: Multi-line explain this resource. + :type description: str + :param depends_on: Artifacts which need to be deployed before the specified artifact. + :type depends_on: list[str] + :param policy_definition_id: Required. Azure resource ID of the policy definition. + :type policy_definition_id: str + :param parameters: Required. Parameter values for the policy definition. + :type parameters: dict[str, ~blueprint_management_client.models.ParameterValue] + :param resource_group: Name of the resource group placeholder to which the policy will be + assigned. + :type resource_group: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + 'kind': {'required': True}, + 'display_name': {'max_length': 256, 'min_length': 0}, + 'description': {'max_length': 500, 'min_length': 0}, + 'policy_definition_id': {'required': True}, + 'parameters': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'depends_on': {'key': 'properties.dependsOn', 'type': '[str]'}, + 'policy_definition_id': {'key': 'properties.policyDefinitionId', 'type': 'str'}, + 'parameters': {'key': 'properties.parameters', 'type': '{ParameterValue}'}, + 'resource_group': {'key': 'properties.resourceGroup', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PolicyAssignmentArtifact, self).__init__(**kwargs) + self.kind = 'policyAssignment' # type: str + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.depends_on = kwargs.get('depends_on', None) + self.policy_definition_id = kwargs['policy_definition_id'] + self.parameters = kwargs['parameters'] + self.resource_group = kwargs.get('resource_group', None) + + +class PolicyAssignmentArtifactProperties(BlueprintResourcePropertiesBase, ArtifactPropertiesBase): + """Properties of a Policy assignment blueprint artifact. + + All required parameters must be populated in order to send to Azure. + + :param depends_on: Artifacts which need to be deployed before the specified artifact. + :type depends_on: list[str] + :param display_name: One-liner string explain this resource. + :type display_name: str + :param description: Multi-line explain this resource. + :type description: str + :param policy_definition_id: Required. Azure resource ID of the policy definition. + :type policy_definition_id: str + :param parameters: Required. Parameter values for the policy definition. + :type parameters: dict[str, ~blueprint_management_client.models.ParameterValue] + :param resource_group: Name of the resource group placeholder to which the policy will be + assigned. + :type resource_group: str + """ + + _validation = { + 'display_name': {'max_length': 256, 'min_length': 0}, + 'description': {'max_length': 500, 'min_length': 0}, + 'policy_definition_id': {'required': True}, + 'parameters': {'required': True}, + } + + _attribute_map = { + 'depends_on': {'key': 'dependsOn', 'type': '[str]'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'policy_definition_id': {'key': 'policyDefinitionId', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': '{ParameterValue}'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PolicyAssignmentArtifactProperties, self).__init__(**kwargs) + self.depends_on = kwargs.get('depends_on', None) + self.policy_definition_id = kwargs['policy_definition_id'] + self.parameters = kwargs['parameters'] + self.resource_group = kwargs.get('resource_group', None) + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.policy_definition_id = kwargs['policy_definition_id'] + self.parameters = kwargs['parameters'] + self.resource_group = kwargs.get('resource_group', None) + + +class PublishedBlueprint(AzureResourceBase): + """Represents a published blueprint. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar type: Type of this resource. + :vartype type: str + :ivar name: Name of this resource. + :vartype name: str + :param display_name: One-liner string explain this resource. + :type display_name: str + :param description: Multi-line explain this resource. + :type description: str + :ivar status: Status of the blueprint. This field is readonly. + :vartype status: ~blueprint_management_client.models.BlueprintStatus + :param target_scope: The scope where this blueprint definition can be assigned. Possible values + include: "subscription", "managementGroup". + :type target_scope: str or ~blueprint_management_client.models.BlueprintTargetScope + :param parameters: Parameters required by this blueprint definition. + :type parameters: dict[str, ~blueprint_management_client.models.ParameterDefinition] + :param resource_groups: Resource group placeholders defined by this blueprint definition. + :type resource_groups: dict[str, ~blueprint_management_client.models.ResourceGroupDefinition] + :param blueprint_name: Name of the published blueprint definition. + :type blueprint_name: str + :param change_notes: Version-specific change notes. + :type change_notes: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + 'display_name': {'max_length': 256, 'min_length': 0}, + 'description': {'max_length': 500, 'min_length': 0}, + 'status': {'readonly': True}, + 'change_notes': {'max_length': 500, 'min_length': 0}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'BlueprintStatus'}, + 'target_scope': {'key': 'properties.targetScope', 'type': 'str'}, + 'parameters': {'key': 'properties.parameters', 'type': '{ParameterDefinition}'}, + 'resource_groups': {'key': 'properties.resourceGroups', 'type': '{ResourceGroupDefinition}'}, + 'blueprint_name': {'key': 'properties.blueprintName', 'type': 'str'}, + 'change_notes': {'key': 'properties.changeNotes', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PublishedBlueprint, self).__init__(**kwargs) + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.status = None + self.target_scope = kwargs.get('target_scope', None) + self.parameters = kwargs.get('parameters', None) + self.resource_groups = kwargs.get('resource_groups', None) + self.blueprint_name = kwargs.get('blueprint_name', None) + self.change_notes = kwargs.get('change_notes', None) + + +class PublishedBlueprintList(msrest.serialization.Model): + """List of published blueprint definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of published blueprint definitions. + :type value: list[~blueprint_management_client.models.PublishedBlueprint] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PublishedBlueprint]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PublishedBlueprintList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class PublishedBlueprintProperties(SharedBlueprintProperties): + """Schema for published blueprint definition properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param display_name: One-liner string explain this resource. + :type display_name: str + :param description: Multi-line explain this resource. + :type description: str + :ivar status: Status of the blueprint. This field is readonly. + :vartype status: ~blueprint_management_client.models.BlueprintStatus + :param target_scope: The scope where this blueprint definition can be assigned. Possible values + include: "subscription", "managementGroup". + :type target_scope: str or ~blueprint_management_client.models.BlueprintTargetScope + :param parameters: Parameters required by this blueprint definition. + :type parameters: dict[str, ~blueprint_management_client.models.ParameterDefinition] + :param resource_groups: Resource group placeholders defined by this blueprint definition. + :type resource_groups: dict[str, ~blueprint_management_client.models.ResourceGroupDefinition] + :param blueprint_name: Name of the published blueprint definition. + :type blueprint_name: str + :param change_notes: Version-specific change notes. + :type change_notes: str + """ + + _validation = { + 'display_name': {'max_length': 256, 'min_length': 0}, + 'description': {'max_length': 500, 'min_length': 0}, + 'status': {'readonly': True}, + 'change_notes': {'max_length': 500, 'min_length': 0}, + } + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'BlueprintStatus'}, + 'target_scope': {'key': 'targetScope', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': '{ParameterDefinition}'}, + 'resource_groups': {'key': 'resourceGroups', 'type': '{ResourceGroupDefinition}'}, + 'blueprint_name': {'key': 'blueprintName', 'type': 'str'}, + 'change_notes': {'key': 'changeNotes', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PublishedBlueprintProperties, self).__init__(**kwargs) + self.blueprint_name = kwargs.get('blueprint_name', None) + self.change_notes = kwargs.get('change_notes', None) + + +class ResourceGroupDefinition(msrest.serialization.Model): + """Represents an Azure resource group in a blueprint definition. + + :param name: Name of this resourceGroup. Leave empty if the resource group name will be + specified during the blueprint assignment. + :type name: str + :param location: Location of this resourceGroup. Leave empty if the resource group location + will be specified during the blueprint assignment. + :type location: str + :param depends_on: Artifacts which need to be deployed before this resource group. + :type depends_on: list[str] + :param tags: A set of tags. Tags to be assigned to this resource group. + :type tags: dict[str, str] + :param display_name: DisplayName of this parameter/resourceGroup. + :type display_name: str + :param description: Description of this parameter/resourceGroup. + :type description: str + :param strong_type: StrongType for UI to render rich experience during blueprint assignment. + Supported strong types are resourceType, principalId and location. + :type strong_type: str + """ + + _validation = { + 'display_name': {'max_length': 256, 'min_length': 0}, + 'description': {'max_length': 500, 'min_length': 0}, + 'strong_type': {'max_length': 64, 'min_length': 0}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'depends_on': {'key': 'dependsOn', 'type': '[str]'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'display_name': {'key': 'metadata.displayName', 'type': 'str'}, + 'description': {'key': 'metadata.description', 'type': 'str'}, + 'strong_type': {'key': 'metadata.strongType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceGroupDefinition, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.location = kwargs.get('location', None) + self.depends_on = kwargs.get('depends_on', None) + self.tags = kwargs.get('tags', None) + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.strong_type = kwargs.get('strong_type', None) + + +class ResourceGroupValue(msrest.serialization.Model): + """Represents an Azure resource group. + + :param name: Name of the resource group. + :type name: str + :param location: Location of the resource group. + :type location: str + """ + + _validation = { + 'name': {'max_length': 90, 'min_length': 1}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceGroupValue, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.location = kwargs.get('location', None) + + +class ResourceProviderOperation(msrest.serialization.Model): + """Supported operations of this resource provider. + + :param name: Operation name, in format of {provider}/{resource}/{operation}. + :type name: str + :param display: Display metadata associated with the operation. + :type display: ~blueprint_management_client.models.ResourceProviderOperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'ResourceProviderOperationDisplay'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceProviderOperation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display = kwargs.get('display', None) + + +class ResourceProviderOperationDisplay(msrest.serialization.Model): + """Display metadata associated with the operation. + + :param provider: Resource provider: Microsoft Blueprint. + :type provider: str + :param resource: Resource on which the operation is performed. + :type resource: str + :param operation: Type of operation: get, read, delete, etc. + :type operation: str + :param description: Description of this 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(ResourceProviderOperationDisplay, 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 ResourceProviderOperationList(msrest.serialization.Model): + """Results of the request to list operations. + + :param value: List of operations supported by this resource provider. + :type value: list[~blueprint_management_client.models.ResourceProviderOperation] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceProviderOperation]'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceProviderOperationList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class RoleAssignmentArtifact(Artifact): + """Blueprint artifact that applies a Role assignment. + + 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: String Id used to locate any resource on Azure. + :vartype id: str + :ivar type: Type of this resource. + :vartype type: str + :ivar name: Name of this resource. + :vartype name: str + :param kind: Required. Specifies the kind of blueprint artifact.Constant filled by server. + Possible values include: "template", "roleAssignment", "policyAssignment". + :type kind: str or ~blueprint_management_client.models.ArtifactKind + :param display_name: One-liner string explain this resource. + :type display_name: str + :param description: Multi-line explain this resource. + :type description: str + :param depends_on: Artifacts which need to be deployed before the specified artifact. + :type depends_on: list[str] + :param role_definition_id: Required. Azure resource ID of the RoleDefinition. + :type role_definition_id: str + :param principal_ids: Required. Array of user or group identities in Azure Active Directory. + The roleDefinition will apply to each identity. + :type principal_ids: any + :param resource_group: RoleAssignment will be scope to this resourceGroup. If empty, it scopes + to the subscription. + :type resource_group: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + 'kind': {'required': True}, + 'display_name': {'max_length': 256, 'min_length': 0}, + 'description': {'max_length': 500, 'min_length': 0}, + 'role_definition_id': {'required': True}, + 'principal_ids': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'depends_on': {'key': 'properties.dependsOn', 'type': '[str]'}, + 'role_definition_id': {'key': 'properties.roleDefinitionId', 'type': 'str'}, + 'principal_ids': {'key': 'properties.principalIds', 'type': 'object'}, + 'resource_group': {'key': 'properties.resourceGroup', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RoleAssignmentArtifact, self).__init__(**kwargs) + self.kind = 'roleAssignment' # type: str + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.depends_on = kwargs.get('depends_on', None) + self.role_definition_id = kwargs['role_definition_id'] + self.principal_ids = kwargs['principal_ids'] + self.resource_group = kwargs.get('resource_group', None) + + +class RoleAssignmentArtifactProperties(BlueprintResourcePropertiesBase, ArtifactPropertiesBase): + """Properties of a Role assignment blueprint artifact. + + All required parameters must be populated in order to send to Azure. + + :param depends_on: Artifacts which need to be deployed before the specified artifact. + :type depends_on: list[str] + :param display_name: One-liner string explain this resource. + :type display_name: str + :param description: Multi-line explain this resource. + :type description: str + :param role_definition_id: Required. Azure resource ID of the RoleDefinition. + :type role_definition_id: str + :param principal_ids: Required. Array of user or group identities in Azure Active Directory. + The roleDefinition will apply to each identity. + :type principal_ids: any + :param resource_group: RoleAssignment will be scope to this resourceGroup. If empty, it scopes + to the subscription. + :type resource_group: str + """ + + _validation = { + 'display_name': {'max_length': 256, 'min_length': 0}, + 'description': {'max_length': 500, 'min_length': 0}, + 'role_definition_id': {'required': True}, + 'principal_ids': {'required': True}, + } + + _attribute_map = { + 'depends_on': {'key': 'dependsOn', 'type': '[str]'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'role_definition_id': {'key': 'roleDefinitionId', 'type': 'str'}, + 'principal_ids': {'key': 'principalIds', 'type': 'object'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RoleAssignmentArtifactProperties, self).__init__(**kwargs) + self.depends_on = kwargs.get('depends_on', None) + self.role_definition_id = kwargs['role_definition_id'] + self.principal_ids = kwargs['principal_ids'] + self.resource_group = kwargs.get('resource_group', None) + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.role_definition_id = kwargs['role_definition_id'] + self.principal_ids = kwargs['principal_ids'] + self.resource_group = kwargs.get('resource_group', None) + + +class SecretValueReference(msrest.serialization.Model): + """Reference to a Key Vault secret. + + All required parameters must be populated in order to send to Azure. + + :param key_vault: Required. Specifies the reference to a given Azure Key Vault. + :type key_vault: ~blueprint_management_client.models.KeyVaultReference + :param secret_name: Required. Name of the secret. + :type secret_name: str + :param secret_version: The version of the secret to use. If left blank, the latest version of + the secret is used. + :type secret_version: str + """ + + _validation = { + 'key_vault': {'required': True}, + 'secret_name': {'required': True}, + } + + _attribute_map = { + 'key_vault': {'key': 'keyVault', 'type': 'KeyVaultReference'}, + 'secret_name': {'key': 'secretName', 'type': 'str'}, + 'secret_version': {'key': 'secretVersion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SecretValueReference, self).__init__(**kwargs) + self.key_vault = kwargs['key_vault'] + self.secret_name = kwargs['secret_name'] + self.secret_version = kwargs.get('secret_version', None) + + +class TemplateArtifact(Artifact): + """Blueprint artifact that deploys a Resource Manager template. + + 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: String Id used to locate any resource on Azure. + :vartype id: str + :ivar type: Type of this resource. + :vartype type: str + :ivar name: Name of this resource. + :vartype name: str + :param kind: Required. Specifies the kind of blueprint artifact.Constant filled by server. + Possible values include: "template", "roleAssignment", "policyAssignment". + :type kind: str or ~blueprint_management_client.models.ArtifactKind + :param display_name: One-liner string explain this resource. + :type display_name: str + :param description: Multi-line explain this resource. + :type description: str + :param depends_on: Artifacts which need to be deployed before the specified artifact. + :type depends_on: list[str] + :param template: Required. The Resource Manager template blueprint artifact body. + :type template: any + :param resource_group: If applicable, the name of the resource group placeholder to which the + Resource Manager template blueprint artifact will be deployed. + :type resource_group: str + :param parameters: Required. Resource Manager template blueprint artifact parameter values. + :type parameters: dict[str, ~blueprint_management_client.models.ParameterValue] + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + 'kind': {'required': True}, + 'display_name': {'max_length': 256, 'min_length': 0}, + 'description': {'max_length': 500, 'min_length': 0}, + 'template': {'required': True}, + 'parameters': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'depends_on': {'key': 'properties.dependsOn', 'type': '[str]'}, + 'template': {'key': 'properties.template', 'type': 'object'}, + 'resource_group': {'key': 'properties.resourceGroup', 'type': 'str'}, + 'parameters': {'key': 'properties.parameters', 'type': '{ParameterValue}'}, + } + + def __init__( + self, + **kwargs + ): + super(TemplateArtifact, self).__init__(**kwargs) + self.kind = 'template' # type: str + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.depends_on = kwargs.get('depends_on', None) + self.template = kwargs['template'] + self.resource_group = kwargs.get('resource_group', None) + self.parameters = kwargs['parameters'] + + +class TemplateArtifactProperties(BlueprintResourcePropertiesBase, ArtifactPropertiesBase): + """Properties of a Resource Manager template blueprint artifact. + + All required parameters must be populated in order to send to Azure. + + :param depends_on: Artifacts which need to be deployed before the specified artifact. + :type depends_on: list[str] + :param display_name: One-liner string explain this resource. + :type display_name: str + :param description: Multi-line explain this resource. + :type description: str + :param template: Required. The Resource Manager template blueprint artifact body. + :type template: any + :param resource_group: If applicable, the name of the resource group placeholder to which the + Resource Manager template blueprint artifact will be deployed. + :type resource_group: str + :param parameters: Required. Resource Manager template blueprint artifact parameter values. + :type parameters: dict[str, ~blueprint_management_client.models.ParameterValue] + """ + + _validation = { + 'display_name': {'max_length': 256, 'min_length': 0}, + 'description': {'max_length': 500, 'min_length': 0}, + 'template': {'required': True}, + 'parameters': {'required': True}, + } + + _attribute_map = { + 'depends_on': {'key': 'dependsOn', 'type': '[str]'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'template': {'key': 'template', 'type': 'object'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': '{ParameterValue}'}, + } + + def __init__( + self, + **kwargs + ): + super(TemplateArtifactProperties, self).__init__(**kwargs) + self.depends_on = kwargs.get('depends_on', None) + self.template = kwargs['template'] + self.resource_group = kwargs.get('resource_group', None) + self.parameters = kwargs['parameters'] + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.template = kwargs['template'] + self.resource_group = kwargs.get('resource_group', None) + self.parameters = kwargs['parameters'] + + +class UserAssignedIdentity(msrest.serialization.Model): + """User-assigned managed identity. + + :param principal_id: Azure Active Directory principal ID associated with this Identity. + :type principal_id: str + :param client_id: Client App Id associated with this identity. + :type client_id: str + """ + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UserAssignedIdentity, self).__init__(**kwargs) + self.principal_id = kwargs.get('principal_id', None) + self.client_id = kwargs.get('client_id', None) + + +class WhoIsBlueprintContract(msrest.serialization.Model): + """Response schema for querying the Azure Blueprints service principal in the tenant. + + :param object_id: AAD object Id of the Azure Blueprints service principal in the tenant. + :type object_id: str + """ + + _attribute_map = { + 'object_id': {'key': 'objectId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WhoIsBlueprintContract, self).__init__(**kwargs) + self.object_id = kwargs.get('object_id', None) diff --git a/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/models/_models_py3.py b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/models/_models_py3.py new file mode 100644 index 0000000000000..3ec1fe1ecb685 --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/models/_models_py3.py @@ -0,0 +1,2073 @@ +# 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, Dict, List, Optional, Union + +import msrest.serialization + +from ._blueprint_management_client_enums import * + + +class AzureResourceBase(msrest.serialization.Model): + """Common properties for all Azure resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar type: Type of this resource. + :vartype type: str + :ivar name: Name of this resource. + :vartype name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AzureResourceBase, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + + +class Artifact(AzureResourceBase): + """Represents a blueprint artifact. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: PolicyAssignmentArtifact, RoleAssignmentArtifact, TemplateArtifact. + + 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: String Id used to locate any resource on Azure. + :vartype id: str + :ivar type: Type of this resource. + :vartype type: str + :ivar name: Name of this resource. + :vartype name: str + :param kind: Required. Specifies the kind of blueprint artifact.Constant filled by server. + Possible values include: "template", "roleAssignment", "policyAssignment". + :type kind: str or ~blueprint_management_client.models.ArtifactKind + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + 'kind': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + _subtype_map = { + 'kind': {'policyAssignment': 'PolicyAssignmentArtifact', 'roleAssignment': 'RoleAssignmentArtifact', 'template': 'TemplateArtifact'} + } + + def __init__( + self, + **kwargs + ): + super(Artifact, self).__init__(**kwargs) + self.kind = 'Artifact' # type: str + + +class ArtifactList(msrest.serialization.Model): + """List of blueprint artifacts. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of blueprint artifacts. + :type value: list[~blueprint_management_client.models.Artifact] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Artifact]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Artifact"]] = None, + **kwargs + ): + super(ArtifactList, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ArtifactPropertiesBase(msrest.serialization.Model): + """Common properties shared by different artifacts. + + :param depends_on: Artifacts which need to be deployed before the specified artifact. + :type depends_on: list[str] + """ + + _attribute_map = { + 'depends_on': {'key': 'dependsOn', 'type': '[str]'}, + } + + def __init__( + self, + *, + depends_on: Optional[List[str]] = None, + **kwargs + ): + super(ArtifactPropertiesBase, self).__init__(**kwargs) + self.depends_on = depends_on + + +class TrackedResource(AzureResourceBase): + """Common properties for all Azure tracked resources. + + 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: String Id used to locate any resource on Azure. + :vartype id: str + :ivar type: Type of this resource. + :vartype type: str + :ivar name: Name of this resource. + :vartype name: str + :param location: Required. The location of this blueprint assignment. + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.location = location + + +class Assignment(TrackedResource): + """Represents a blueprint assignment. + + 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: String Id used to locate any resource on Azure. + :vartype id: str + :ivar type: Type of this resource. + :vartype type: str + :ivar name: Name of this resource. + :vartype name: str + :param location: Required. The location of this blueprint assignment. + :type location: str + :param identity: Required. Managed identity for this blueprint assignment. + :type identity: ~blueprint_management_client.models.ManagedServiceIdentity + :param display_name: One-liner string explain this resource. + :type display_name: str + :param description: Multi-line explain this resource. + :type description: str + :param blueprint_id: ID of the published version of a blueprint definition. + :type blueprint_id: str + :param scope: The target subscription scope of the blueprint assignment (format: + '/subscriptions/{subscriptionId}'). For management group level assignments, the property is + required. + :type scope: str + :param parameters: Required. Blueprint assignment parameter values. + :type parameters: dict[str, ~blueprint_management_client.models.ParameterValue] + :param resource_groups: Required. Names and locations of resource group placeholders. + :type resource_groups: dict[str, ~blueprint_management_client.models.ResourceGroupValue] + :ivar status: Status of blueprint assignment. This field is readonly. + :vartype status: ~blueprint_management_client.models.AssignmentStatus + :param locks: Defines how resources deployed by a blueprint assignment are locked. + :type locks: ~blueprint_management_client.models.AssignmentLockSettings + :ivar provisioning_state: State of the blueprint assignment. Possible values include: + "creating", "validating", "waiting", "deploying", "cancelling", "locking", "succeeded", + "failed", "canceled", "deleting". + :vartype provisioning_state: str or + ~blueprint_management_client.models.AssignmentProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + 'location': {'required': True}, + 'identity': {'required': True}, + 'display_name': {'max_length': 256, 'min_length': 0}, + 'description': {'max_length': 500, 'min_length': 0}, + 'parameters': {'required': True}, + 'resource_groups': {'required': True}, + 'status': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'blueprint_id': {'key': 'properties.blueprintId', 'type': 'str'}, + 'scope': {'key': 'properties.scope', 'type': 'str'}, + 'parameters': {'key': 'properties.parameters', 'type': '{ParameterValue}'}, + 'resource_groups': {'key': 'properties.resourceGroups', 'type': '{ResourceGroupValue}'}, + 'status': {'key': 'properties.status', 'type': 'AssignmentStatus'}, + 'locks': {'key': 'properties.locks', 'type': 'AssignmentLockSettings'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + identity: "ManagedServiceIdentity", + parameters: Dict[str, "ParameterValue"], + resource_groups: Dict[str, "ResourceGroupValue"], + display_name: Optional[str] = None, + description: Optional[str] = None, + blueprint_id: Optional[str] = None, + scope: Optional[str] = None, + locks: Optional["AssignmentLockSettings"] = None, + **kwargs + ): + super(Assignment, self).__init__(location=location, **kwargs) + self.identity = identity + self.display_name = display_name + self.description = description + self.blueprint_id = blueprint_id + self.scope = scope + self.parameters = parameters + self.resource_groups = resource_groups + self.status = None + self.locks = locks + self.provisioning_state = None + + +class AssignmentDeploymentJob(msrest.serialization.Model): + """Represents individual job in given blueprint assignment operation. + + :param kind: Kind of job. + :type kind: str + :param action: Name of the action performed in this job. + :type action: str + :param job_id: Id of this job. + :type job_id: str + :param job_state: State of this job. + :type job_state: str + :param result: Deployment job result. + :type result: ~blueprint_management_client.models.AssignmentDeploymentJobResult + :param history: Result of this deployment job for each retry. + :type history: list[~blueprint_management_client.models.AssignmentDeploymentJobResult] + :param request_uri: Reference to deployment job resource id. + :type request_uri: str + """ + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'str'}, + 'job_id': {'key': 'jobId', 'type': 'str'}, + 'job_state': {'key': 'jobState', 'type': 'str'}, + 'result': {'key': 'result', 'type': 'AssignmentDeploymentJobResult'}, + 'history': {'key': 'history', 'type': '[AssignmentDeploymentJobResult]'}, + 'request_uri': {'key': 'requestUri', 'type': 'str'}, + } + + def __init__( + self, + *, + kind: Optional[str] = None, + action: Optional[str] = None, + job_id: Optional[str] = None, + job_state: Optional[str] = None, + result: Optional["AssignmentDeploymentJobResult"] = None, + history: Optional[List["AssignmentDeploymentJobResult"]] = None, + request_uri: Optional[str] = None, + **kwargs + ): + super(AssignmentDeploymentJob, self).__init__(**kwargs) + self.kind = kind + self.action = action + self.job_id = job_id + self.job_state = job_state + self.result = result + self.history = history + self.request_uri = request_uri + + +class AssignmentDeploymentJobResult(msrest.serialization.Model): + """Result of each individual deployment in a blueprint assignment. + + :param error: Contains error details if deployment job failed. + :type error: ~blueprint_management_client.models.AzureResourceManagerError + :param resources: Resources created as result of the deployment job. + :type resources: list[~blueprint_management_client.models.AssignmentJobCreatedResource] + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'AzureResourceManagerError'}, + 'resources': {'key': 'resources', 'type': '[AssignmentJobCreatedResource]'}, + } + + def __init__( + self, + *, + error: Optional["AzureResourceManagerError"] = None, + resources: Optional[List["AssignmentJobCreatedResource"]] = None, + **kwargs + ): + super(AssignmentDeploymentJobResult, self).__init__(**kwargs) + self.error = error + self.resources = resources + + +class AssignmentJobCreatedResource(AzureResourceBase): + """Azure resource created from deployment job. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar type: Type of this resource. + :vartype type: str + :ivar name: Name of this resource. + :vartype name: str + :param properties: Additional properties in a dictionary. + :type properties: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + } + + def __init__( + self, + *, + properties: Optional[Dict[str, str]] = None, + **kwargs + ): + super(AssignmentJobCreatedResource, self).__init__(**kwargs) + self.properties = properties + + +class AssignmentList(msrest.serialization.Model): + """List of blueprint assignments. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of blueprint assignments. + :type value: list[~blueprint_management_client.models.Assignment] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Assignment]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Assignment"]] = None, + **kwargs + ): + super(AssignmentList, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class AssignmentLockSettings(msrest.serialization.Model): + """Defines how resources deployed by a blueprint assignment are locked. + + :param mode: Lock mode. Possible values include: "None", "AllResourcesReadOnly", + "AllResourcesDoNotDelete". + :type mode: str or ~blueprint_management_client.models.AssignmentLockMode + :param excluded_principals: List of AAD principals excluded from blueprint locks. Up to 5 + principals are permitted. + :type excluded_principals: list[str] + :param excluded_actions: + List of management operations that are excluded from blueprint locks. Up to 200 actions are permitted. + If the lock mode is set to 'AllResourcesReadOnly', then the following actions are automatically + appended to 'excludedActions': '*/read', + 'Microsoft.Network/virtualNetworks/subnets/join/action' and + 'Microsoft.Authorization/locks/delete'. If the lock mode is set to 'AllResourcesDoNotDelete', + then the following actions are automatically appended to 'excludedActions': + 'Microsoft.Authorization/locks/delete'. Duplicate actions will get removed. + :type excluded_actions: list[str] + """ + + _attribute_map = { + 'mode': {'key': 'mode', 'type': 'str'}, + 'excluded_principals': {'key': 'excludedPrincipals', 'type': '[str]'}, + 'excluded_actions': {'key': 'excludedActions', 'type': '[str]'}, + } + + def __init__( + self, + *, + mode: Optional[Union[str, "AssignmentLockMode"]] = None, + excluded_principals: Optional[List[str]] = None, + excluded_actions: Optional[List[str]] = None, + **kwargs + ): + super(AssignmentLockSettings, self).__init__(**kwargs) + self.mode = mode + self.excluded_principals = excluded_principals + self.excluded_actions = excluded_actions + + +class AssignmentOperation(AzureResourceBase): + """Represents underlying deployment detail for each update to the blueprint assignment. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar type: Type of this resource. + :vartype type: str + :ivar name: Name of this resource. + :vartype name: str + :param blueprint_version: The published version of the blueprint definition used for the + blueprint assignment operation. + :type blueprint_version: str + :param assignment_state: State of this blueprint assignment operation. + :type assignment_state: str + :param time_created: Create time of this blueprint assignment operation. + :type time_created: str + :param time_started: Start time of the underlying deployment. + :type time_started: str + :param time_finished: Finish time of the overall underlying deployments. + :type time_finished: str + :param deployments: List of jobs in this blueprint assignment operation. + :type deployments: list[~blueprint_management_client.models.AssignmentDeploymentJob] + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'blueprint_version': {'key': 'properties.blueprintVersion', 'type': 'str'}, + 'assignment_state': {'key': 'properties.assignmentState', 'type': 'str'}, + 'time_created': {'key': 'properties.timeCreated', 'type': 'str'}, + 'time_started': {'key': 'properties.timeStarted', 'type': 'str'}, + 'time_finished': {'key': 'properties.timeFinished', 'type': 'str'}, + 'deployments': {'key': 'properties.deployments', 'type': '[AssignmentDeploymentJob]'}, + } + + def __init__( + self, + *, + blueprint_version: Optional[str] = None, + assignment_state: Optional[str] = None, + time_created: Optional[str] = None, + time_started: Optional[str] = None, + time_finished: Optional[str] = None, + deployments: Optional[List["AssignmentDeploymentJob"]] = None, + **kwargs + ): + super(AssignmentOperation, self).__init__(**kwargs) + self.blueprint_version = blueprint_version + self.assignment_state = assignment_state + self.time_created = time_created + self.time_started = time_started + self.time_finished = time_finished + self.deployments = deployments + + +class AssignmentOperationList(msrest.serialization.Model): + """List of AssignmentOperation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of AssignmentOperation. + :type value: list[~blueprint_management_client.models.AssignmentOperation] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AssignmentOperation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["AssignmentOperation"]] = None, + **kwargs + ): + super(AssignmentOperationList, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class BlueprintResourcePropertiesBase(msrest.serialization.Model): + """Shared properties between all blueprint resources. + + :param display_name: One-liner string explain this resource. + :type display_name: str + :param description: Multi-line explain this resource. + :type description: str + """ + + _validation = { + 'display_name': {'max_length': 256, 'min_length': 0}, + 'description': {'max_length': 500, 'min_length': 0}, + } + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + display_name: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + super(BlueprintResourcePropertiesBase, self).__init__(**kwargs) + self.display_name = display_name + self.description = description + + +class AssignmentProperties(BlueprintResourcePropertiesBase): + """Detailed properties for a blueprint assignment. + + 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. + + :param display_name: One-liner string explain this resource. + :type display_name: str + :param description: Multi-line explain this resource. + :type description: str + :param blueprint_id: ID of the published version of a blueprint definition. + :type blueprint_id: str + :param scope: The target subscription scope of the blueprint assignment (format: + '/subscriptions/{subscriptionId}'). For management group level assignments, the property is + required. + :type scope: str + :param parameters: Required. Blueprint assignment parameter values. + :type parameters: dict[str, ~blueprint_management_client.models.ParameterValue] + :param resource_groups: Required. Names and locations of resource group placeholders. + :type resource_groups: dict[str, ~blueprint_management_client.models.ResourceGroupValue] + :ivar status: Status of blueprint assignment. This field is readonly. + :vartype status: ~blueprint_management_client.models.AssignmentStatus + :param locks: Defines how resources deployed by a blueprint assignment are locked. + :type locks: ~blueprint_management_client.models.AssignmentLockSettings + :ivar provisioning_state: State of the blueprint assignment. Possible values include: + "creating", "validating", "waiting", "deploying", "cancelling", "locking", "succeeded", + "failed", "canceled", "deleting". + :vartype provisioning_state: str or + ~blueprint_management_client.models.AssignmentProvisioningState + """ + + _validation = { + 'display_name': {'max_length': 256, 'min_length': 0}, + 'description': {'max_length': 500, 'min_length': 0}, + 'parameters': {'required': True}, + 'resource_groups': {'required': True}, + 'status': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'blueprint_id': {'key': 'blueprintId', 'type': 'str'}, + 'scope': {'key': 'scope', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': '{ParameterValue}'}, + 'resource_groups': {'key': 'resourceGroups', 'type': '{ResourceGroupValue}'}, + 'status': {'key': 'status', 'type': 'AssignmentStatus'}, + 'locks': {'key': 'locks', 'type': 'AssignmentLockSettings'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + parameters: Dict[str, "ParameterValue"], + resource_groups: Dict[str, "ResourceGroupValue"], + display_name: Optional[str] = None, + description: Optional[str] = None, + blueprint_id: Optional[str] = None, + scope: Optional[str] = None, + locks: Optional["AssignmentLockSettings"] = None, + **kwargs + ): + super(AssignmentProperties, self).__init__(display_name=display_name, description=description, **kwargs) + self.blueprint_id = blueprint_id + self.scope = scope + self.parameters = parameters + self.resource_groups = resource_groups + self.status = None + self.locks = locks + self.provisioning_state = None + + +class BlueprintResourceStatusBase(msrest.serialization.Model): + """Shared status properties between all blueprint resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar time_created: Creation time of this blueprint definition. + :vartype time_created: ~datetime.datetime + :ivar last_modified: Last modified time of this blueprint definition. + :vartype last_modified: ~datetime.datetime + """ + + _validation = { + 'time_created': {'readonly': True}, + 'last_modified': {'readonly': True}, + } + + _attribute_map = { + 'time_created': {'key': 'timeCreated', 'type': 'iso-8601'}, + 'last_modified': {'key': 'lastModified', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(BlueprintResourceStatusBase, self).__init__(**kwargs) + self.time_created = None + self.last_modified = None + + +class AssignmentStatus(BlueprintResourceStatusBase): + """The status of a blueprint assignment. This field is readonly. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar time_created: Creation time of this blueprint definition. + :vartype time_created: ~datetime.datetime + :ivar last_modified: Last modified time of this blueprint definition. + :vartype last_modified: ~datetime.datetime + :ivar managed_resources: List of resources that were created by the blueprint assignment. + :vartype managed_resources: list[str] + """ + + _validation = { + 'time_created': {'readonly': True}, + 'last_modified': {'readonly': True}, + 'managed_resources': {'readonly': True}, + } + + _attribute_map = { + 'time_created': {'key': 'timeCreated', 'type': 'iso-8601'}, + 'last_modified': {'key': 'lastModified', 'type': 'iso-8601'}, + 'managed_resources': {'key': 'managedResources', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(AssignmentStatus, self).__init__(**kwargs) + self.managed_resources = None + + +class AzureResourceManagerError(msrest.serialization.Model): + """Error code and message. + + :param code: Error code. + :type code: str + :param message: Error message. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): + super(AzureResourceManagerError, self).__init__(**kwargs) + self.code = code + self.message = message + + +class Blueprint(AzureResourceBase): + """Represents a Blueprint definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar type: Type of this resource. + :vartype type: str + :ivar name: Name of this resource. + :vartype name: str + :param display_name: One-liner string explain this resource. + :type display_name: str + :param description: Multi-line explain this resource. + :type description: str + :ivar status: Status of the blueprint. This field is readonly. + :vartype status: ~blueprint_management_client.models.BlueprintStatus + :param target_scope: The scope where this blueprint definition can be assigned. Possible values + include: "subscription", "managementGroup". + :type target_scope: str or ~blueprint_management_client.models.BlueprintTargetScope + :param parameters: Parameters required by this blueprint definition. + :type parameters: dict[str, ~blueprint_management_client.models.ParameterDefinition] + :param resource_groups: Resource group placeholders defined by this blueprint definition. + :type resource_groups: dict[str, ~blueprint_management_client.models.ResourceGroupDefinition] + :param versions: Published versions of this blueprint definition. + :type versions: any + :ivar layout: Layout view of the blueprint definition for UI reference. + :vartype layout: any + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + 'display_name': {'max_length': 256, 'min_length': 0}, + 'description': {'max_length': 500, 'min_length': 0}, + 'status': {'readonly': True}, + 'layout': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'BlueprintStatus'}, + 'target_scope': {'key': 'properties.targetScope', 'type': 'str'}, + 'parameters': {'key': 'properties.parameters', 'type': '{ParameterDefinition}'}, + 'resource_groups': {'key': 'properties.resourceGroups', 'type': '{ResourceGroupDefinition}'}, + 'versions': {'key': 'properties.versions', 'type': 'object'}, + 'layout': {'key': 'properties.layout', 'type': 'object'}, + } + + def __init__( + self, + *, + display_name: Optional[str] = None, + description: Optional[str] = None, + target_scope: Optional[Union[str, "BlueprintTargetScope"]] = None, + parameters: Optional[Dict[str, "ParameterDefinition"]] = None, + resource_groups: Optional[Dict[str, "ResourceGroupDefinition"]] = None, + versions: Optional[Any] = None, + **kwargs + ): + super(Blueprint, self).__init__(**kwargs) + self.display_name = display_name + self.description = description + self.status = None + self.target_scope = target_scope + self.parameters = parameters + self.resource_groups = resource_groups + self.versions = versions + self.layout = None + + +class BlueprintList(msrest.serialization.Model): + """List of blueprint definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of blueprint definitions. + :type value: list[~blueprint_management_client.models.Blueprint] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Blueprint]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Blueprint"]] = None, + **kwargs + ): + super(BlueprintList, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class SharedBlueprintProperties(BlueprintResourcePropertiesBase): + """Shared Schema for both blueprintProperties and publishedBlueprintProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param display_name: One-liner string explain this resource. + :type display_name: str + :param description: Multi-line explain this resource. + :type description: str + :ivar status: Status of the blueprint. This field is readonly. + :vartype status: ~blueprint_management_client.models.BlueprintStatus + :param target_scope: The scope where this blueprint definition can be assigned. Possible values + include: "subscription", "managementGroup". + :type target_scope: str or ~blueprint_management_client.models.BlueprintTargetScope + :param parameters: Parameters required by this blueprint definition. + :type parameters: dict[str, ~blueprint_management_client.models.ParameterDefinition] + :param resource_groups: Resource group placeholders defined by this blueprint definition. + :type resource_groups: dict[str, ~blueprint_management_client.models.ResourceGroupDefinition] + """ + + _validation = { + 'display_name': {'max_length': 256, 'min_length': 0}, + 'description': {'max_length': 500, 'min_length': 0}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'BlueprintStatus'}, + 'target_scope': {'key': 'targetScope', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': '{ParameterDefinition}'}, + 'resource_groups': {'key': 'resourceGroups', 'type': '{ResourceGroupDefinition}'}, + } + + def __init__( + self, + *, + display_name: Optional[str] = None, + description: Optional[str] = None, + target_scope: Optional[Union[str, "BlueprintTargetScope"]] = None, + parameters: Optional[Dict[str, "ParameterDefinition"]] = None, + resource_groups: Optional[Dict[str, "ResourceGroupDefinition"]] = None, + **kwargs + ): + super(SharedBlueprintProperties, self).__init__(display_name=display_name, description=description, **kwargs) + self.status = None + self.target_scope = target_scope + self.parameters = parameters + self.resource_groups = resource_groups + + +class BlueprintProperties(SharedBlueprintProperties): + """Schema for blueprint definition properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param display_name: One-liner string explain this resource. + :type display_name: str + :param description: Multi-line explain this resource. + :type description: str + :ivar status: Status of the blueprint. This field is readonly. + :vartype status: ~blueprint_management_client.models.BlueprintStatus + :param target_scope: The scope where this blueprint definition can be assigned. Possible values + include: "subscription", "managementGroup". + :type target_scope: str or ~blueprint_management_client.models.BlueprintTargetScope + :param parameters: Parameters required by this blueprint definition. + :type parameters: dict[str, ~blueprint_management_client.models.ParameterDefinition] + :param resource_groups: Resource group placeholders defined by this blueprint definition. + :type resource_groups: dict[str, ~blueprint_management_client.models.ResourceGroupDefinition] + :param versions: Published versions of this blueprint definition. + :type versions: any + :ivar layout: Layout view of the blueprint definition for UI reference. + :vartype layout: any + """ + + _validation = { + 'display_name': {'max_length': 256, 'min_length': 0}, + 'description': {'max_length': 500, 'min_length': 0}, + 'status': {'readonly': True}, + 'layout': {'readonly': True}, + } + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'BlueprintStatus'}, + 'target_scope': {'key': 'targetScope', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': '{ParameterDefinition}'}, + 'resource_groups': {'key': 'resourceGroups', 'type': '{ResourceGroupDefinition}'}, + 'versions': {'key': 'versions', 'type': 'object'}, + 'layout': {'key': 'layout', 'type': 'object'}, + } + + def __init__( + self, + *, + display_name: Optional[str] = None, + description: Optional[str] = None, + target_scope: Optional[Union[str, "BlueprintTargetScope"]] = None, + parameters: Optional[Dict[str, "ParameterDefinition"]] = None, + resource_groups: Optional[Dict[str, "ResourceGroupDefinition"]] = None, + versions: Optional[Any] = None, + **kwargs + ): + super(BlueprintProperties, self).__init__(display_name=display_name, description=description, target_scope=target_scope, parameters=parameters, resource_groups=resource_groups, **kwargs) + self.versions = versions + self.layout = None + + +class BlueprintStatus(BlueprintResourceStatusBase): + """The status of the blueprint. This field is readonly. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar time_created: Creation time of this blueprint definition. + :vartype time_created: ~datetime.datetime + :ivar last_modified: Last modified time of this blueprint definition. + :vartype last_modified: ~datetime.datetime + """ + + _validation = { + 'time_created': {'readonly': True}, + 'last_modified': {'readonly': True}, + } + + _attribute_map = { + 'time_created': {'key': 'timeCreated', 'type': 'iso-8601'}, + 'last_modified': {'key': 'lastModified', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(BlueprintStatus, self).__init__(**kwargs) + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~blueprint_management_client.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~blueprint_management_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(ErrorResponse, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class KeyVaultReference(msrest.serialization.Model): + """Specifies the link to a Key Vault. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Azure resource ID of the Key Vault. + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: str, + **kwargs + ): + super(KeyVaultReference, self).__init__(**kwargs) + self.id = id + + +class ManagedServiceIdentity(msrest.serialization.Model): + """Managed identity generic object. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Type of the managed identity. Possible values include: "None", + "SystemAssigned", "UserAssigned". + :type type: str or ~blueprint_management_client.models.ManagedServiceIdentityType + :param principal_id: Azure Active Directory principal ID associated with this Identity. + :type principal_id: str + :param tenant_id: ID of the Azure Active Directory. + :type tenant_id: str + :param user_assigned_identities: The list of user-assigned managed identities associated with + the resource. Key is the Azure resource Id of the managed identity. + :type user_assigned_identities: dict[str, + ~blueprint_management_client.models.UserAssignedIdentity] + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentity}'}, + } + + def __init__( + self, + *, + type: Union[str, "ManagedServiceIdentityType"], + principal_id: Optional[str] = None, + tenant_id: Optional[str] = None, + user_assigned_identities: Optional[Dict[str, "UserAssignedIdentity"]] = None, + **kwargs + ): + super(ManagedServiceIdentity, self).__init__(**kwargs) + self.type = type + self.principal_id = principal_id + self.tenant_id = tenant_id + self.user_assigned_identities = user_assigned_identities + + +class ParameterDefinition(msrest.serialization.Model): + """Represent a parameter with constrains and metadata. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Allowed data types for Resource Manager template parameters. Possible + values include: "string", "array", "bool", "int", "object", "secureObject", "secureString". + :type type: str or ~blueprint_management_client.models.TemplateParameterType + :param default_value: Default Value for this parameter. + :type default_value: any + :param allowed_values: Array of allowed values for this parameter. + :type allowed_values: list[any] + :param display_name: DisplayName of this parameter/resourceGroup. + :type display_name: str + :param description: Description of this parameter/resourceGroup. + :type description: str + :param strong_type: StrongType for UI to render rich experience during blueprint assignment. + Supported strong types are resourceType, principalId and location. + :type strong_type: str + """ + + _validation = { + 'type': {'required': True}, + 'display_name': {'max_length': 256, 'min_length': 0}, + 'description': {'max_length': 500, 'min_length': 0}, + 'strong_type': {'max_length': 64, 'min_length': 0}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'default_value': {'key': 'defaultValue', 'type': 'object'}, + 'allowed_values': {'key': 'allowedValues', 'type': '[object]'}, + 'display_name': {'key': 'metadata.displayName', 'type': 'str'}, + 'description': {'key': 'metadata.description', 'type': 'str'}, + 'strong_type': {'key': 'metadata.strongType', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Union[str, "TemplateParameterType"], + default_value: Optional[Any] = None, + allowed_values: Optional[List[Any]] = None, + display_name: Optional[str] = None, + description: Optional[str] = None, + strong_type: Optional[str] = None, + **kwargs + ): + super(ParameterDefinition, self).__init__(**kwargs) + self.type = type + self.default_value = default_value + self.allowed_values = allowed_values + self.display_name = display_name + self.description = description + self.strong_type = strong_type + + +class ParameterValue(msrest.serialization.Model): + """Value for the specified parameter. Can be either 'value' or 'reference' but not both. + + :param value: Parameter value. Any valid JSON value is allowed including objects, arrays, + strings, numbers and booleans. + :type value: any + :param reference: Parameter value as reference type. + :type reference: ~blueprint_management_client.models.SecretValueReference + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'object'}, + 'reference': {'key': 'reference', 'type': 'SecretValueReference'}, + } + + def __init__( + self, + *, + value: Optional[Any] = None, + reference: Optional["SecretValueReference"] = None, + **kwargs + ): + super(ParameterValue, self).__init__(**kwargs) + self.value = value + self.reference = reference + + +class PolicyAssignmentArtifact(Artifact): + """Blueprint artifact that applies a Policy assignment. + + 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: String Id used to locate any resource on Azure. + :vartype id: str + :ivar type: Type of this resource. + :vartype type: str + :ivar name: Name of this resource. + :vartype name: str + :param kind: Required. Specifies the kind of blueprint artifact.Constant filled by server. + Possible values include: "template", "roleAssignment", "policyAssignment". + :type kind: str or ~blueprint_management_client.models.ArtifactKind + :param display_name: One-liner string explain this resource. + :type display_name: str + :param description: Multi-line explain this resource. + :type description: str + :param depends_on: Artifacts which need to be deployed before the specified artifact. + :type depends_on: list[str] + :param policy_definition_id: Required. Azure resource ID of the policy definition. + :type policy_definition_id: str + :param parameters: Required. Parameter values for the policy definition. + :type parameters: dict[str, ~blueprint_management_client.models.ParameterValue] + :param resource_group: Name of the resource group placeholder to which the policy will be + assigned. + :type resource_group: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + 'kind': {'required': True}, + 'display_name': {'max_length': 256, 'min_length': 0}, + 'description': {'max_length': 500, 'min_length': 0}, + 'policy_definition_id': {'required': True}, + 'parameters': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'depends_on': {'key': 'properties.dependsOn', 'type': '[str]'}, + 'policy_definition_id': {'key': 'properties.policyDefinitionId', 'type': 'str'}, + 'parameters': {'key': 'properties.parameters', 'type': '{ParameterValue}'}, + 'resource_group': {'key': 'properties.resourceGroup', 'type': 'str'}, + } + + def __init__( + self, + *, + policy_definition_id: str, + parameters: Dict[str, "ParameterValue"], + display_name: Optional[str] = None, + description: Optional[str] = None, + depends_on: Optional[List[str]] = None, + resource_group: Optional[str] = None, + **kwargs + ): + super(PolicyAssignmentArtifact, self).__init__(**kwargs) + self.kind = 'policyAssignment' # type: str + self.display_name = display_name + self.description = description + self.depends_on = depends_on + self.policy_definition_id = policy_definition_id + self.parameters = parameters + self.resource_group = resource_group + + +class PolicyAssignmentArtifactProperties(BlueprintResourcePropertiesBase, ArtifactPropertiesBase): + """Properties of a Policy assignment blueprint artifact. + + All required parameters must be populated in order to send to Azure. + + :param depends_on: Artifacts which need to be deployed before the specified artifact. + :type depends_on: list[str] + :param display_name: One-liner string explain this resource. + :type display_name: str + :param description: Multi-line explain this resource. + :type description: str + :param policy_definition_id: Required. Azure resource ID of the policy definition. + :type policy_definition_id: str + :param parameters: Required. Parameter values for the policy definition. + :type parameters: dict[str, ~blueprint_management_client.models.ParameterValue] + :param resource_group: Name of the resource group placeholder to which the policy will be + assigned. + :type resource_group: str + """ + + _validation = { + 'display_name': {'max_length': 256, 'min_length': 0}, + 'description': {'max_length': 500, 'min_length': 0}, + 'policy_definition_id': {'required': True}, + 'parameters': {'required': True}, + } + + _attribute_map = { + 'depends_on': {'key': 'dependsOn', 'type': '[str]'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'policy_definition_id': {'key': 'policyDefinitionId', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': '{ParameterValue}'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + } + + def __init__( + self, + *, + policy_definition_id: str, + parameters: Dict[str, "ParameterValue"], + depends_on: Optional[List[str]] = None, + display_name: Optional[str] = None, + description: Optional[str] = None, + resource_group: Optional[str] = None, + **kwargs + ): + super(PolicyAssignmentArtifactProperties, self).__init__(display_name=display_name, description=description, depends_on=depends_on, **kwargs) + self.depends_on = depends_on + self.policy_definition_id = policy_definition_id + self.parameters = parameters + self.resource_group = resource_group + self.display_name = display_name + self.description = description + self.policy_definition_id = policy_definition_id + self.parameters = parameters + self.resource_group = resource_group + + +class PublishedBlueprint(AzureResourceBase): + """Represents a published blueprint. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar type: Type of this resource. + :vartype type: str + :ivar name: Name of this resource. + :vartype name: str + :param display_name: One-liner string explain this resource. + :type display_name: str + :param description: Multi-line explain this resource. + :type description: str + :ivar status: Status of the blueprint. This field is readonly. + :vartype status: ~blueprint_management_client.models.BlueprintStatus + :param target_scope: The scope where this blueprint definition can be assigned. Possible values + include: "subscription", "managementGroup". + :type target_scope: str or ~blueprint_management_client.models.BlueprintTargetScope + :param parameters: Parameters required by this blueprint definition. + :type parameters: dict[str, ~blueprint_management_client.models.ParameterDefinition] + :param resource_groups: Resource group placeholders defined by this blueprint definition. + :type resource_groups: dict[str, ~blueprint_management_client.models.ResourceGroupDefinition] + :param blueprint_name: Name of the published blueprint definition. + :type blueprint_name: str + :param change_notes: Version-specific change notes. + :type change_notes: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + 'display_name': {'max_length': 256, 'min_length': 0}, + 'description': {'max_length': 500, 'min_length': 0}, + 'status': {'readonly': True}, + 'change_notes': {'max_length': 500, 'min_length': 0}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'BlueprintStatus'}, + 'target_scope': {'key': 'properties.targetScope', 'type': 'str'}, + 'parameters': {'key': 'properties.parameters', 'type': '{ParameterDefinition}'}, + 'resource_groups': {'key': 'properties.resourceGroups', 'type': '{ResourceGroupDefinition}'}, + 'blueprint_name': {'key': 'properties.blueprintName', 'type': 'str'}, + 'change_notes': {'key': 'properties.changeNotes', 'type': 'str'}, + } + + def __init__( + self, + *, + display_name: Optional[str] = None, + description: Optional[str] = None, + target_scope: Optional[Union[str, "BlueprintTargetScope"]] = None, + parameters: Optional[Dict[str, "ParameterDefinition"]] = None, + resource_groups: Optional[Dict[str, "ResourceGroupDefinition"]] = None, + blueprint_name: Optional[str] = None, + change_notes: Optional[str] = None, + **kwargs + ): + super(PublishedBlueprint, self).__init__(**kwargs) + self.display_name = display_name + self.description = description + self.status = None + self.target_scope = target_scope + self.parameters = parameters + self.resource_groups = resource_groups + self.blueprint_name = blueprint_name + self.change_notes = change_notes + + +class PublishedBlueprintList(msrest.serialization.Model): + """List of published blueprint definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of published blueprint definitions. + :type value: list[~blueprint_management_client.models.PublishedBlueprint] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PublishedBlueprint]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["PublishedBlueprint"]] = None, + **kwargs + ): + super(PublishedBlueprintList, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class PublishedBlueprintProperties(SharedBlueprintProperties): + """Schema for published blueprint definition properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param display_name: One-liner string explain this resource. + :type display_name: str + :param description: Multi-line explain this resource. + :type description: str + :ivar status: Status of the blueprint. This field is readonly. + :vartype status: ~blueprint_management_client.models.BlueprintStatus + :param target_scope: The scope where this blueprint definition can be assigned. Possible values + include: "subscription", "managementGroup". + :type target_scope: str or ~blueprint_management_client.models.BlueprintTargetScope + :param parameters: Parameters required by this blueprint definition. + :type parameters: dict[str, ~blueprint_management_client.models.ParameterDefinition] + :param resource_groups: Resource group placeholders defined by this blueprint definition. + :type resource_groups: dict[str, ~blueprint_management_client.models.ResourceGroupDefinition] + :param blueprint_name: Name of the published blueprint definition. + :type blueprint_name: str + :param change_notes: Version-specific change notes. + :type change_notes: str + """ + + _validation = { + 'display_name': {'max_length': 256, 'min_length': 0}, + 'description': {'max_length': 500, 'min_length': 0}, + 'status': {'readonly': True}, + 'change_notes': {'max_length': 500, 'min_length': 0}, + } + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'BlueprintStatus'}, + 'target_scope': {'key': 'targetScope', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': '{ParameterDefinition}'}, + 'resource_groups': {'key': 'resourceGroups', 'type': '{ResourceGroupDefinition}'}, + 'blueprint_name': {'key': 'blueprintName', 'type': 'str'}, + 'change_notes': {'key': 'changeNotes', 'type': 'str'}, + } + + def __init__( + self, + *, + display_name: Optional[str] = None, + description: Optional[str] = None, + target_scope: Optional[Union[str, "BlueprintTargetScope"]] = None, + parameters: Optional[Dict[str, "ParameterDefinition"]] = None, + resource_groups: Optional[Dict[str, "ResourceGroupDefinition"]] = None, + blueprint_name: Optional[str] = None, + change_notes: Optional[str] = None, + **kwargs + ): + super(PublishedBlueprintProperties, self).__init__(display_name=display_name, description=description, target_scope=target_scope, parameters=parameters, resource_groups=resource_groups, **kwargs) + self.blueprint_name = blueprint_name + self.change_notes = change_notes + + +class ResourceGroupDefinition(msrest.serialization.Model): + """Represents an Azure resource group in a blueprint definition. + + :param name: Name of this resourceGroup. Leave empty if the resource group name will be + specified during the blueprint assignment. + :type name: str + :param location: Location of this resourceGroup. Leave empty if the resource group location + will be specified during the blueprint assignment. + :type location: str + :param depends_on: Artifacts which need to be deployed before this resource group. + :type depends_on: list[str] + :param tags: A set of tags. Tags to be assigned to this resource group. + :type tags: dict[str, str] + :param display_name: DisplayName of this parameter/resourceGroup. + :type display_name: str + :param description: Description of this parameter/resourceGroup. + :type description: str + :param strong_type: StrongType for UI to render rich experience during blueprint assignment. + Supported strong types are resourceType, principalId and location. + :type strong_type: str + """ + + _validation = { + 'display_name': {'max_length': 256, 'min_length': 0}, + 'description': {'max_length': 500, 'min_length': 0}, + 'strong_type': {'max_length': 64, 'min_length': 0}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'depends_on': {'key': 'dependsOn', 'type': '[str]'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'display_name': {'key': 'metadata.displayName', 'type': 'str'}, + 'description': {'key': 'metadata.description', 'type': 'str'}, + 'strong_type': {'key': 'metadata.strongType', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + location: Optional[str] = None, + depends_on: Optional[List[str]] = None, + tags: Optional[Dict[str, str]] = None, + display_name: Optional[str] = None, + description: Optional[str] = None, + strong_type: Optional[str] = None, + **kwargs + ): + super(ResourceGroupDefinition, self).__init__(**kwargs) + self.name = name + self.location = location + self.depends_on = depends_on + self.tags = tags + self.display_name = display_name + self.description = description + self.strong_type = strong_type + + +class ResourceGroupValue(msrest.serialization.Model): + """Represents an Azure resource group. + + :param name: Name of the resource group. + :type name: str + :param location: Location of the resource group. + :type location: str + """ + + _validation = { + 'name': {'max_length': 90, 'min_length': 1}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + location: Optional[str] = None, + **kwargs + ): + super(ResourceGroupValue, self).__init__(**kwargs) + self.name = name + self.location = location + + +class ResourceProviderOperation(msrest.serialization.Model): + """Supported operations of this resource provider. + + :param name: Operation name, in format of {provider}/{resource}/{operation}. + :type name: str + :param display: Display metadata associated with the operation. + :type display: ~blueprint_management_client.models.ResourceProviderOperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'ResourceProviderOperationDisplay'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["ResourceProviderOperationDisplay"] = None, + **kwargs + ): + super(ResourceProviderOperation, self).__init__(**kwargs) + self.name = name + self.display = display + + +class ResourceProviderOperationDisplay(msrest.serialization.Model): + """Display metadata associated with the operation. + + :param provider: Resource provider: Microsoft Blueprint. + :type provider: str + :param resource: Resource on which the operation is performed. + :type resource: str + :param operation: Type of operation: get, read, delete, etc. + :type operation: str + :param description: Description of this 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(ResourceProviderOperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class ResourceProviderOperationList(msrest.serialization.Model): + """Results of the request to list operations. + + :param value: List of operations supported by this resource provider. + :type value: list[~blueprint_management_client.models.ResourceProviderOperation] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceProviderOperation]'}, + } + + def __init__( + self, + *, + value: Optional[List["ResourceProviderOperation"]] = None, + **kwargs + ): + super(ResourceProviderOperationList, self).__init__(**kwargs) + self.value = value + + +class RoleAssignmentArtifact(Artifact): + """Blueprint artifact that applies a Role assignment. + + 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: String Id used to locate any resource on Azure. + :vartype id: str + :ivar type: Type of this resource. + :vartype type: str + :ivar name: Name of this resource. + :vartype name: str + :param kind: Required. Specifies the kind of blueprint artifact.Constant filled by server. + Possible values include: "template", "roleAssignment", "policyAssignment". + :type kind: str or ~blueprint_management_client.models.ArtifactKind + :param display_name: One-liner string explain this resource. + :type display_name: str + :param description: Multi-line explain this resource. + :type description: str + :param depends_on: Artifacts which need to be deployed before the specified artifact. + :type depends_on: list[str] + :param role_definition_id: Required. Azure resource ID of the RoleDefinition. + :type role_definition_id: str + :param principal_ids: Required. Array of user or group identities in Azure Active Directory. + The roleDefinition will apply to each identity. + :type principal_ids: any + :param resource_group: RoleAssignment will be scope to this resourceGroup. If empty, it scopes + to the subscription. + :type resource_group: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + 'kind': {'required': True}, + 'display_name': {'max_length': 256, 'min_length': 0}, + 'description': {'max_length': 500, 'min_length': 0}, + 'role_definition_id': {'required': True}, + 'principal_ids': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'depends_on': {'key': 'properties.dependsOn', 'type': '[str]'}, + 'role_definition_id': {'key': 'properties.roleDefinitionId', 'type': 'str'}, + 'principal_ids': {'key': 'properties.principalIds', 'type': 'object'}, + 'resource_group': {'key': 'properties.resourceGroup', 'type': 'str'}, + } + + def __init__( + self, + *, + role_definition_id: str, + principal_ids: Any, + display_name: Optional[str] = None, + description: Optional[str] = None, + depends_on: Optional[List[str]] = None, + resource_group: Optional[str] = None, + **kwargs + ): + super(RoleAssignmentArtifact, self).__init__(**kwargs) + self.kind = 'roleAssignment' # type: str + self.display_name = display_name + self.description = description + self.depends_on = depends_on + self.role_definition_id = role_definition_id + self.principal_ids = principal_ids + self.resource_group = resource_group + + +class RoleAssignmentArtifactProperties(BlueprintResourcePropertiesBase, ArtifactPropertiesBase): + """Properties of a Role assignment blueprint artifact. + + All required parameters must be populated in order to send to Azure. + + :param depends_on: Artifacts which need to be deployed before the specified artifact. + :type depends_on: list[str] + :param display_name: One-liner string explain this resource. + :type display_name: str + :param description: Multi-line explain this resource. + :type description: str + :param role_definition_id: Required. Azure resource ID of the RoleDefinition. + :type role_definition_id: str + :param principal_ids: Required. Array of user or group identities in Azure Active Directory. + The roleDefinition will apply to each identity. + :type principal_ids: any + :param resource_group: RoleAssignment will be scope to this resourceGroup. If empty, it scopes + to the subscription. + :type resource_group: str + """ + + _validation = { + 'display_name': {'max_length': 256, 'min_length': 0}, + 'description': {'max_length': 500, 'min_length': 0}, + 'role_definition_id': {'required': True}, + 'principal_ids': {'required': True}, + } + + _attribute_map = { + 'depends_on': {'key': 'dependsOn', 'type': '[str]'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'role_definition_id': {'key': 'roleDefinitionId', 'type': 'str'}, + 'principal_ids': {'key': 'principalIds', 'type': 'object'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + } + + def __init__( + self, + *, + role_definition_id: str, + principal_ids: Any, + depends_on: Optional[List[str]] = None, + display_name: Optional[str] = None, + description: Optional[str] = None, + resource_group: Optional[str] = None, + **kwargs + ): + super(RoleAssignmentArtifactProperties, self).__init__(display_name=display_name, description=description, depends_on=depends_on, **kwargs) + self.depends_on = depends_on + self.role_definition_id = role_definition_id + self.principal_ids = principal_ids + self.resource_group = resource_group + self.display_name = display_name + self.description = description + self.role_definition_id = role_definition_id + self.principal_ids = principal_ids + self.resource_group = resource_group + + +class SecretValueReference(msrest.serialization.Model): + """Reference to a Key Vault secret. + + All required parameters must be populated in order to send to Azure. + + :param key_vault: Required. Specifies the reference to a given Azure Key Vault. + :type key_vault: ~blueprint_management_client.models.KeyVaultReference + :param secret_name: Required. Name of the secret. + :type secret_name: str + :param secret_version: The version of the secret to use. If left blank, the latest version of + the secret is used. + :type secret_version: str + """ + + _validation = { + 'key_vault': {'required': True}, + 'secret_name': {'required': True}, + } + + _attribute_map = { + 'key_vault': {'key': 'keyVault', 'type': 'KeyVaultReference'}, + 'secret_name': {'key': 'secretName', 'type': 'str'}, + 'secret_version': {'key': 'secretVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + key_vault: "KeyVaultReference", + secret_name: str, + secret_version: Optional[str] = None, + **kwargs + ): + super(SecretValueReference, self).__init__(**kwargs) + self.key_vault = key_vault + self.secret_name = secret_name + self.secret_version = secret_version + + +class TemplateArtifact(Artifact): + """Blueprint artifact that deploys a Resource Manager template. + + 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: String Id used to locate any resource on Azure. + :vartype id: str + :ivar type: Type of this resource. + :vartype type: str + :ivar name: Name of this resource. + :vartype name: str + :param kind: Required. Specifies the kind of blueprint artifact.Constant filled by server. + Possible values include: "template", "roleAssignment", "policyAssignment". + :type kind: str or ~blueprint_management_client.models.ArtifactKind + :param display_name: One-liner string explain this resource. + :type display_name: str + :param description: Multi-line explain this resource. + :type description: str + :param depends_on: Artifacts which need to be deployed before the specified artifact. + :type depends_on: list[str] + :param template: Required. The Resource Manager template blueprint artifact body. + :type template: any + :param resource_group: If applicable, the name of the resource group placeholder to which the + Resource Manager template blueprint artifact will be deployed. + :type resource_group: str + :param parameters: Required. Resource Manager template blueprint artifact parameter values. + :type parameters: dict[str, ~blueprint_management_client.models.ParameterValue] + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + 'kind': {'required': True}, + 'display_name': {'max_length': 256, 'min_length': 0}, + 'description': {'max_length': 500, 'min_length': 0}, + 'template': {'required': True}, + 'parameters': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'depends_on': {'key': 'properties.dependsOn', 'type': '[str]'}, + 'template': {'key': 'properties.template', 'type': 'object'}, + 'resource_group': {'key': 'properties.resourceGroup', 'type': 'str'}, + 'parameters': {'key': 'properties.parameters', 'type': '{ParameterValue}'}, + } + + def __init__( + self, + *, + template: Any, + parameters: Dict[str, "ParameterValue"], + display_name: Optional[str] = None, + description: Optional[str] = None, + depends_on: Optional[List[str]] = None, + resource_group: Optional[str] = None, + **kwargs + ): + super(TemplateArtifact, self).__init__(**kwargs) + self.kind = 'template' # type: str + self.display_name = display_name + self.description = description + self.depends_on = depends_on + self.template = template + self.resource_group = resource_group + self.parameters = parameters + + +class TemplateArtifactProperties(BlueprintResourcePropertiesBase, ArtifactPropertiesBase): + """Properties of a Resource Manager template blueprint artifact. + + All required parameters must be populated in order to send to Azure. + + :param depends_on: Artifacts which need to be deployed before the specified artifact. + :type depends_on: list[str] + :param display_name: One-liner string explain this resource. + :type display_name: str + :param description: Multi-line explain this resource. + :type description: str + :param template: Required. The Resource Manager template blueprint artifact body. + :type template: any + :param resource_group: If applicable, the name of the resource group placeholder to which the + Resource Manager template blueprint artifact will be deployed. + :type resource_group: str + :param parameters: Required. Resource Manager template blueprint artifact parameter values. + :type parameters: dict[str, ~blueprint_management_client.models.ParameterValue] + """ + + _validation = { + 'display_name': {'max_length': 256, 'min_length': 0}, + 'description': {'max_length': 500, 'min_length': 0}, + 'template': {'required': True}, + 'parameters': {'required': True}, + } + + _attribute_map = { + 'depends_on': {'key': 'dependsOn', 'type': '[str]'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'template': {'key': 'template', 'type': 'object'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': '{ParameterValue}'}, + } + + def __init__( + self, + *, + template: Any, + parameters: Dict[str, "ParameterValue"], + depends_on: Optional[List[str]] = None, + display_name: Optional[str] = None, + description: Optional[str] = None, + resource_group: Optional[str] = None, + **kwargs + ): + super(TemplateArtifactProperties, self).__init__(display_name=display_name, description=description, depends_on=depends_on, **kwargs) + self.depends_on = depends_on + self.template = template + self.resource_group = resource_group + self.parameters = parameters + self.display_name = display_name + self.description = description + self.template = template + self.resource_group = resource_group + self.parameters = parameters + + +class UserAssignedIdentity(msrest.serialization.Model): + """User-assigned managed identity. + + :param principal_id: Azure Active Directory principal ID associated with this Identity. + :type principal_id: str + :param client_id: Client App Id associated with this identity. + :type client_id: str + """ + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + *, + principal_id: Optional[str] = None, + client_id: Optional[str] = None, + **kwargs + ): + super(UserAssignedIdentity, self).__init__(**kwargs) + self.principal_id = principal_id + self.client_id = client_id + + +class WhoIsBlueprintContract(msrest.serialization.Model): + """Response schema for querying the Azure Blueprints service principal in the tenant. + + :param object_id: AAD object Id of the Azure Blueprints service principal in the tenant. + :type object_id: str + """ + + _attribute_map = { + 'object_id': {'key': 'objectId', 'type': 'str'}, + } + + def __init__( + self, + *, + object_id: Optional[str] = None, + **kwargs + ): + super(WhoIsBlueprintContract, self).__init__(**kwargs) + self.object_id = object_id diff --git a/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/operations/__init__.py b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/operations/__init__.py new file mode 100644 index 0000000000000..b5c4b8a1b2c27 --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/operations/__init__.py @@ -0,0 +1,23 @@ +# 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 ._blueprints_operations import BlueprintsOperations +from ._artifacts_operations import ArtifactsOperations +from ._published_blueprints_operations import PublishedBlueprintsOperations +from ._published_artifacts_operations import PublishedArtifactsOperations +from ._assignments_operations import AssignmentsOperations +from ._assignment_operations_operations import AssignmentOperationsOperations + +__all__ = [ + 'BlueprintsOperations', + 'ArtifactsOperations', + 'PublishedBlueprintsOperations', + 'PublishedArtifactsOperations', + 'AssignmentsOperations', + 'AssignmentOperationsOperations', +] diff --git a/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/operations/_artifacts_operations.py b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/operations/_artifacts_operations.py new file mode 100644 index 0000000000000..11f392ec14767 --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/operations/_artifacts_operations.py @@ -0,0 +1,324 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ArtifactsOperations(object): + """ArtifactsOperations 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: ~blueprint_management_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, + resource_scope, # type: str + blueprint_name, # type: str + artifact_name, # type: str + artifact, # type: "_models.Artifact" + **kwargs # type: Any + ): + # type: (...) -> "_models.Artifact" + """Create or update blueprint artifact. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param blueprint_name: Name of the blueprint definition. + :type blueprint_name: str + :param artifact_name: Name of the blueprint artifact. + :type artifact_name: str + :param artifact: Blueprint artifact to create or update. + :type artifact: ~blueprint_management_client.models.Artifact + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Artifact, or the result of cls(response) + :rtype: ~blueprint_management_client.models.Artifact + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Artifact"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'blueprintName': self._serialize.url("blueprint_name", blueprint_name, 'str'), + 'artifactName': self._serialize.url("artifact_name", artifact_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(artifact, 'Artifact') + 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 [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Artifact', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/artifacts/{artifactName}'} # type: ignore + + def get( + self, + resource_scope, # type: str + blueprint_name, # type: str + artifact_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Artifact" + """Get a blueprint artifact. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param blueprint_name: Name of the blueprint definition. + :type blueprint_name: str + :param artifact_name: Name of the blueprint artifact. + :type artifact_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Artifact, or the result of cls(response) + :rtype: ~blueprint_management_client.models.Artifact + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Artifact"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'blueprintName': self._serialize.url("blueprint_name", blueprint_name, 'str'), + 'artifactName': self._serialize.url("artifact_name", artifact_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Artifact', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/artifacts/{artifactName}'} # type: ignore + + def delete( + self, + resource_scope, # type: str + blueprint_name, # type: str + artifact_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.Artifact"] + """Delete a blueprint artifact. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param blueprint_name: Name of the blueprint definition. + :type blueprint_name: str + :param artifact_name: Name of the blueprint artifact. + :type artifact_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Artifact, or the result of cls(response) + :rtype: ~blueprint_management_client.models.Artifact or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Artifact"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'blueprintName': self._serialize.url("blueprint_name", blueprint_name, 'str'), + 'artifactName': self._serialize.url("artifact_name", artifact_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Artifact', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + delete.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/artifacts/{artifactName}'} # type: ignore + + def list( + self, + resource_scope, # type: str + blueprint_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ArtifactList"] + """List artifacts for a given blueprint definition. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param blueprint_name: Name of the blueprint definition. + :type blueprint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ArtifactList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~blueprint_management_client.models.ArtifactList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArtifactList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'blueprintName': self._serialize.url("blueprint_name", blueprint_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ArtifactList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/artifacts'} # type: ignore diff --git a/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/operations/_assignment_operations_operations.py b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/operations/_assignment_operations_operations.py new file mode 100644 index 0000000000000..ff8d6912faa22 --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/operations/_assignment_operations_operations.py @@ -0,0 +1,186 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class AssignmentOperationsOperations(object): + """AssignmentOperationsOperations 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: ~blueprint_management_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, + resource_scope, # type: str + assignment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AssignmentOperationList"] + """List operations for given blueprint assignment within a subscription or a management group. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param assignment_name: Name of the blueprint assignment. + :type assignment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AssignmentOperationList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~blueprint_management_client.models.AssignmentOperationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AssignmentOperationList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'assignmentName': self._serialize.url("assignment_name", assignment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('AssignmentOperationList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprintAssignments/{assignmentName}/assignmentOperations'} # type: ignore + + def get( + self, + resource_scope, # type: str + assignment_name, # type: str + assignment_operation_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AssignmentOperation" + """Get a blueprint assignment operation. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param assignment_name: Name of the blueprint assignment. + :type assignment_name: str + :param assignment_operation_name: Name of the blueprint assignment operation. + :type assignment_operation_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AssignmentOperation, or the result of cls(response) + :rtype: ~blueprint_management_client.models.AssignmentOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AssignmentOperation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'assignmentName': self._serialize.url("assignment_name", assignment_name, 'str'), + 'assignmentOperationName': self._serialize.url("assignment_operation_name", assignment_operation_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AssignmentOperation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprintAssignments/{assignmentName}/assignmentOperations/{assignmentOperationName}'} # type: ignore diff --git a/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/operations/_assignments_operations.py b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/operations/_assignments_operations.py new file mode 100644 index 0000000000000..108467cb4518b --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/operations/_assignments_operations.py @@ -0,0 +1,374 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class AssignmentsOperations(object): + """AssignmentsOperations 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: ~blueprint_management_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, + resource_scope, # type: str + assignment_name, # type: str + assignment, # type: "_models.Assignment" + **kwargs # type: Any + ): + # type: (...) -> "_models.Assignment" + """Create or update a blueprint assignment. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param assignment_name: Name of the blueprint assignment. + :type assignment_name: str + :param assignment: Blueprint assignment object to save. + :type assignment: ~blueprint_management_client.models.Assignment + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Assignment, or the result of cls(response) + :rtype: ~blueprint_management_client.models.Assignment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Assignment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'assignmentName': self._serialize.url("assignment_name", assignment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(assignment, 'Assignment') + 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 [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Assignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprintAssignments/{assignmentName}'} # type: ignore + + def get( + self, + resource_scope, # type: str + assignment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Assignment" + """Get a blueprint assignment. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param assignment_name: Name of the blueprint assignment. + :type assignment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Assignment, or the result of cls(response) + :rtype: ~blueprint_management_client.models.Assignment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Assignment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'assignmentName': self._serialize.url("assignment_name", assignment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Assignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprintAssignments/{assignmentName}'} # type: ignore + + def delete( + self, + resource_scope, # type: str + assignment_name, # type: str + delete_behavior=None, # type: Optional[Union[str, "_models.AssignmentDeleteBehavior"]] + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.Assignment"] + """Delete a blueprint assignment. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param assignment_name: Name of the blueprint assignment. + :type assignment_name: str + :param delete_behavior: When deleteBehavior=all, the resources that were created by the + blueprint assignment will be deleted. + :type delete_behavior: str or ~blueprint_management_client.models.AssignmentDeleteBehavior + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Assignment, or the result of cls(response) + :rtype: ~blueprint_management_client.models.Assignment or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Assignment"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'assignmentName': self._serialize.url("assignment_name", assignment_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') + if delete_behavior is not None: + query_parameters['deleteBehavior'] = self._serialize.query("delete_behavior", delete_behavior, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 202: + deserialized = self._deserialize('Assignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + delete.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprintAssignments/{assignmentName}'} # type: ignore + + def who_is_blueprint( + self, + resource_scope, # type: str + assignment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.WhoIsBlueprintContract" + """Get Blueprints service SPN objectId. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param assignment_name: Name of the blueprint assignment. + :type assignment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WhoIsBlueprintContract, or the result of cls(response) + :rtype: ~blueprint_management_client.models.WhoIsBlueprintContract + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WhoIsBlueprintContract"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.who_is_blueprint.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'assignmentName': self._serialize.url("assignment_name", assignment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('WhoIsBlueprintContract', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + who_is_blueprint.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprintAssignments/{assignmentName}/whoIsBlueprint'} # type: ignore + + def list( + self, + resource_scope, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AssignmentList"] + """List blueprint assignments within a subscription or a management group. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AssignmentList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~blueprint_management_client.models.AssignmentList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AssignmentList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + } + 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('AssignmentList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprintAssignments'} # type: ignore diff --git a/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/operations/_blueprints_operations.py b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/operations/_blueprints_operations.py new file mode 100644 index 0000000000000..3bfa92b0e0b0a --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/operations/_blueprints_operations.py @@ -0,0 +1,308 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class BlueprintsOperations(object): + """BlueprintsOperations 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: ~blueprint_management_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, + resource_scope, # type: str + blueprint_name, # type: str + blueprint, # type: "_models.Blueprint" + **kwargs # type: Any + ): + # type: (...) -> "_models.Blueprint" + """Create or update a blueprint definition. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param blueprint_name: Name of the blueprint definition. + :type blueprint_name: str + :param blueprint: Blueprint definition. + :type blueprint: ~blueprint_management_client.models.Blueprint + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Blueprint, or the result of cls(response) + :rtype: ~blueprint_management_client.models.Blueprint + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Blueprint"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'blueprintName': self._serialize.url("blueprint_name", blueprint_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(blueprint, 'Blueprint') + 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 [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Blueprint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}'} # type: ignore + + def get( + self, + resource_scope, # type: str + blueprint_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Blueprint" + """Get a blueprint definition. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param blueprint_name: Name of the blueprint definition. + :type blueprint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Blueprint, or the result of cls(response) + :rtype: ~blueprint_management_client.models.Blueprint + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Blueprint"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'blueprintName': self._serialize.url("blueprint_name", blueprint_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Blueprint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}'} # type: ignore + + def delete( + self, + resource_scope, # type: str + blueprint_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.Blueprint"] + """Delete a blueprint definition. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param blueprint_name: Name of the blueprint definition. + :type blueprint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Blueprint, or the result of cls(response) + :rtype: ~blueprint_management_client.models.Blueprint or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Blueprint"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'blueprintName': self._serialize.url("blueprint_name", blueprint_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Blueprint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + delete.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}'} # type: ignore + + def list( + self, + resource_scope, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.BlueprintList"] + """List blueprint definitions. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BlueprintList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~blueprint_management_client.models.BlueprintList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BlueprintList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + } + 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('BlueprintList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprints'} # type: ignore diff --git a/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/operations/_published_artifacts_operations.py b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/operations/_published_artifacts_operations.py new file mode 100644 index 0000000000000..4b410efe5b03a --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/operations/_published_artifacts_operations.py @@ -0,0 +1,194 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class PublishedArtifactsOperations(object): + """PublishedArtifactsOperations 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: ~blueprint_management_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 get( + self, + resource_scope, # type: str + blueprint_name, # type: str + version_id, # type: str + artifact_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Artifact" + """Get an artifact for a published blueprint definition. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param blueprint_name: Name of the blueprint definition. + :type blueprint_name: str + :param version_id: Version of the published blueprint definition. + :type version_id: str + :param artifact_name: Name of the blueprint artifact. + :type artifact_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Artifact, or the result of cls(response) + :rtype: ~blueprint_management_client.models.Artifact + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Artifact"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'blueprintName': self._serialize.url("blueprint_name", blueprint_name, 'str'), + 'versionId': self._serialize.url("version_id", version_id, 'str'), + 'artifactName': self._serialize.url("artifact_name", artifact_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Artifact', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/versions/{versionId}/artifacts/{artifactName}'} # type: ignore + + def list( + self, + resource_scope, # type: str + blueprint_name, # type: str + version_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ArtifactList"] + """List artifacts for a version of a published blueprint definition. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param blueprint_name: Name of the blueprint definition. + :type blueprint_name: str + :param version_id: Version of the published blueprint definition. + :type version_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ArtifactList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~blueprint_management_client.models.ArtifactList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArtifactList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'blueprintName': self._serialize.url("blueprint_name", blueprint_name, 'str'), + 'versionId': self._serialize.url("version_id", version_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ArtifactList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/versions/{versionId}/artifacts'} # type: ignore diff --git a/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/operations/_published_blueprints_operations.py b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/operations/_published_blueprints_operations.py new file mode 100644 index 0000000000000..cdef9c9eb118a --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/operations/_published_blueprints_operations.py @@ -0,0 +1,328 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class PublishedBlueprintsOperations(object): + """PublishedBlueprintsOperations 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: ~blueprint_management_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( + self, + resource_scope, # type: str + blueprint_name, # type: str + version_id, # type: str + published_blueprint=None, # type: Optional["_models.PublishedBlueprint"] + **kwargs # type: Any + ): + # type: (...) -> "_models.PublishedBlueprint" + """Publish a new version of the blueprint definition with the latest artifacts. Published + blueprint definitions are immutable. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param blueprint_name: Name of the blueprint definition. + :type blueprint_name: str + :param version_id: Version of the published blueprint definition. + :type version_id: str + :param published_blueprint: Published Blueprint to create or update. + :type published_blueprint: ~blueprint_management_client.models.PublishedBlueprint + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublishedBlueprint, or the result of cls(response) + :rtype: ~blueprint_management_client.models.PublishedBlueprint + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PublishedBlueprint"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'blueprintName': self._serialize.url("blueprint_name", blueprint_name, 'str'), + 'versionId': self._serialize.url("version_id", version_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if published_blueprint is not None: + body_content = self._serialize.body(published_blueprint, 'PublishedBlueprint') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PublishedBlueprint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/versions/{versionId}'} # type: ignore + + def get( + self, + resource_scope, # type: str + blueprint_name, # type: str + version_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PublishedBlueprint" + """Get a published version of a blueprint definition. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param blueprint_name: Name of the blueprint definition. + :type blueprint_name: str + :param version_id: Version of the published blueprint definition. + :type version_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublishedBlueprint, or the result of cls(response) + :rtype: ~blueprint_management_client.models.PublishedBlueprint + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PublishedBlueprint"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'blueprintName': self._serialize.url("blueprint_name", blueprint_name, 'str'), + 'versionId': self._serialize.url("version_id", version_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PublishedBlueprint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/versions/{versionId}'} # type: ignore + + def delete( + self, + resource_scope, # type: str + blueprint_name, # type: str + version_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.PublishedBlueprint"] + """Delete a published version of a blueprint definition. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param blueprint_name: Name of the blueprint definition. + :type blueprint_name: str + :param version_id: Version of the published blueprint definition. + :type version_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublishedBlueprint, or the result of cls(response) + :rtype: ~blueprint_management_client.models.PublishedBlueprint or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PublishedBlueprint"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'blueprintName': self._serialize.url("blueprint_name", blueprint_name, 'str'), + 'versionId': self._serialize.url("version_id", version_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PublishedBlueprint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + delete.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/versions/{versionId}'} # type: ignore + + def list( + self, + resource_scope, # type: str + blueprint_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PublishedBlueprintList"] + """List published versions of given blueprint definition. + + :param resource_scope: The scope of the resource. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'). + :type resource_scope: str + :param blueprint_name: Name of the blueprint definition. + :type blueprint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PublishedBlueprintList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~blueprint_management_client.models.PublishedBlueprintList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PublishedBlueprintList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-11-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceScope': self._serialize.url("resource_scope", resource_scope, 'str', skip_quote=True), + 'blueprintName': self._serialize.url("blueprint_name", blueprint_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('PublishedBlueprintList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/versions'} # type: ignore diff --git a/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/py.typed b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/py.typed new file mode 100644 index 0000000000000..e5aff4f83af86 --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/azure/mgmt/blueprint/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/blueprint/azure-mgmt-blueprint/sdk_packaging.toml b/sdk/blueprint/azure-mgmt-blueprint/sdk_packaging.toml new file mode 100644 index 0000000000000..631d1bbe1653d --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/sdk_packaging.toml @@ -0,0 +1,9 @@ +[packaging] +package_name = "azure-mgmt-blueprint" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true diff --git a/sdk/blueprint/azure-mgmt-blueprint/setup.cfg b/sdk/blueprint/azure-mgmt-blueprint/setup.cfg new file mode 100644 index 0000000000000..3c6e79cf31da1 --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/blueprint/azure-mgmt-blueprint/setup.py b/sdk/blueprint/azure-mgmt-blueprint/setup.py new file mode 100644 index 0000000000000..f7956cb8e5ca8 --- /dev/null +++ b/sdk/blueprint/azure-mgmt-blueprint/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-blueprint" +PACKAGE_PPRINT_NAME = "MyService Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# azure v0.x is not compatible with this package +# azure v0.x used to have a __version__ attribute (newer versions don't) +try: + import azure + try: + ver = azure.__version__ + raise Exception( + 'This package is incompatible with azure=={}. '.format(ver) + + 'Uninstall it with "pip uninstall azure".' + ) + except AttributeError: + pass +except ImportError: + pass + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +with open('README.md', encoding='utf-8') as f: + readme = f.read() +with open('CHANGELOG.md', encoding='utf-8') as f: + changelog = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + '\n\n' + changelog, + long_description_content_type='text/markdown', + license='MIT License', + author='Microsoft Corporation', + author_email='azpysdkhelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python', + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.mgmt', + ]), + install_requires=[ + 'msrest>=0.6.21', + 'azure-common~=1.1', + 'azure-mgmt-core>=1.2.0,<2.0.0', + ], + extras_require={ + ":python_version<'3.0'": ['azure-mgmt-nspkg'], + } +) diff --git a/sdk/blueprint/ci.yml b/sdk/blueprint/ci.yml new file mode 100644 index 0000000000000..b85a9e0c25989 --- /dev/null +++ b/sdk/blueprint/ci.yml @@ -0,0 +1,33 @@ +# DO NOT EDIT THIS FILE +# This file is generated automatically and any changes will be lost. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/blueprint/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/blueprint/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: blueprint + Artifacts: + - name: azure-mgmt-blueprint + safeName: azuremgmtblueprint