diff --git a/sdk/portal/azure-mgmt-portal/CHANGELOG.md b/sdk/portal/azure-mgmt-portal/CHANGELOG.md new file mode 100644 index 00000000000..578ed6acf47 --- /dev/null +++ b/sdk/portal/azure-mgmt-portal/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/portal/azure-mgmt-portal/MANIFEST.in b/sdk/portal/azure-mgmt-portal/MANIFEST.in new file mode 100644 index 00000000000..a3cb07df876 --- /dev/null +++ b/sdk/portal/azure-mgmt-portal/MANIFEST.in @@ -0,0 +1,5 @@ +recursive-include tests *.py *.yaml +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py + diff --git a/sdk/portal/azure-mgmt-portal/README.md b/sdk/portal/azure-mgmt-portal/README.md new file mode 100644 index 00000000000..2b5297a1aa5 --- /dev/null +++ b/sdk/portal/azure-mgmt-portal/README.md @@ -0,0 +1,21 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure MyService Management Client Library. +This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + + +# Usage + +For code examples, see [MyService Management](https://docs.microsoft.com/python/api/overview/azure/) +on docs.microsoft.com. + + +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-portal%2FREADME.png) diff --git a/sdk/portal/azure-mgmt-portal/azure/__init__.py b/sdk/portal/azure-mgmt-portal/azure/__init__.py new file mode 100644 index 00000000000..0260537a02b --- /dev/null +++ b/sdk/portal/azure-mgmt-portal/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/portal/azure-mgmt-portal/azure/mgmt/__init__.py b/sdk/portal/azure-mgmt-portal/azure/mgmt/__init__.py new file mode 100644 index 00000000000..0260537a02b --- /dev/null +++ b/sdk/portal/azure-mgmt-portal/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/__init__.py b/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/__init__.py new file mode 100644 index 00000000000..dbf69957e6e --- /dev/null +++ b/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/__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 ._configuration import portalClientConfiguration +from ._portal_client import portalClient +__all__ = ['portalClient', 'portalClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/_configuration.py b/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/_configuration.py new file mode 100644 index 00000000000..edc00d7c494 --- /dev/null +++ b/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/_configuration.py @@ -0,0 +1,49 @@ +# 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 msrestazure import AzureConfiguration + +from .version import VERSION + + +class portalClientConfiguration(AzureConfiguration): + """Configuration for portalClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The Azure subscription ID. This is a + GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000) + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(portalClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-portal/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id diff --git a/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/_portal_client.py b/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/_portal_client.py new file mode 100644 index 00000000000..ad68414abdc --- /dev/null +++ b/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/_portal_client.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 msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import portalClientConfiguration +from .operations import Operations +from .operations import DashboardsOperations +from .operations import TenantConfigurationsOperations +from .operations import ListTenantConfigurationViolationsOperations +from . import models + + +class portalClient(SDKClient): + """portalClient + + :ivar config: Configuration for client. + :vartype config: portalClientConfiguration + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.portal.operations.Operations + :ivar dashboards: Dashboards operations + :vartype dashboards: azure.mgmt.portal.operations.DashboardsOperations + :ivar tenant_configurations: TenantConfigurations operations + :vartype tenant_configurations: azure.mgmt.portal.operations.TenantConfigurationsOperations + :ivar list_tenant_configuration_violations: ListTenantConfigurationViolations operations + :vartype list_tenant_configuration_violations: azure.mgmt.portal.operations.ListTenantConfigurationViolationsOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The Azure subscription ID. This is a + GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000) + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = portalClientConfiguration(credentials, subscription_id, base_url) + super(portalClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2020-09-01-preview' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self.config, self._serialize, self._deserialize) + self.dashboards = DashboardsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.tenant_configurations = TenantConfigurationsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.list_tenant_configuration_violations = ListTenantConfigurationViolationsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/models/__init__.py b/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/models/__init__.py new file mode 100644 index 00000000000..b09519446f9 --- /dev/null +++ b/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/models/__init__.py @@ -0,0 +1,84 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import AzureEntityResource + from ._models_py3 import Configuration + from ._models_py3 import Dashboard + from ._models_py3 import DashboardLens + from ._models_py3 import DashboardPartMetadata + from ._models_py3 import DashboardParts + from ._models_py3 import DashboardPartsPosition + from ._models_py3 import ErrorDefinition + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import MarkdownPartMetadata + from ._models_py3 import MarkdownPartMetadataSettings + from ._models_py3 import MarkdownPartMetadataSettingsContent + from ._models_py3 import MarkdownPartMetadataSettingsContentSettings + from ._models_py3 import PatchableDashboard + from ._models_py3 import ProxyResource + from ._models_py3 import Resource + from ._models_py3 import ResourceProviderOperation + from ._models_py3 import ResourceProviderOperationDisplay + from ._models_py3 import TrackedResource + from ._models_py3 import Violation +except (SyntaxError, ImportError): + from ._models import AzureEntityResource + from ._models import Configuration + from ._models import Dashboard + from ._models import DashboardLens + from ._models import DashboardPartMetadata + from ._models import DashboardParts + from ._models import DashboardPartsPosition + from ._models import ErrorDefinition + from ._models import ErrorResponse, ErrorResponseException + from ._models import MarkdownPartMetadata + from ._models import MarkdownPartMetadataSettings + from ._models import MarkdownPartMetadataSettingsContent + from ._models import MarkdownPartMetadataSettingsContentSettings + from ._models import PatchableDashboard + from ._models import ProxyResource + from ._models import Resource + from ._models import ResourceProviderOperation + from ._models import ResourceProviderOperationDisplay + from ._models import TrackedResource + from ._models import Violation +from ._paged_models import ConfigurationPaged +from ._paged_models import DashboardPaged +from ._paged_models import ResourceProviderOperationPaged +from ._paged_models import ViolationPaged + +__all__ = [ + 'AzureEntityResource', + 'Configuration', + 'Dashboard', + 'DashboardLens', + 'DashboardPartMetadata', + 'DashboardParts', + 'DashboardPartsPosition', + 'ErrorDefinition', + 'ErrorResponse', 'ErrorResponseException', + 'MarkdownPartMetadata', + 'MarkdownPartMetadataSettings', + 'MarkdownPartMetadataSettingsContent', + 'MarkdownPartMetadataSettingsContentSettings', + 'PatchableDashboard', + 'ProxyResource', + 'Resource', + 'ResourceProviderOperation', + 'ResourceProviderOperationDisplay', + 'TrackedResource', + 'Violation', + 'ResourceProviderOperationPaged', + 'DashboardPaged', + 'ConfigurationPaged', + 'ViolationPaged', +] diff --git a/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/models/_models.py b/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/models/_models.py new file mode 100644 index 00000000000..7468c0d1184 --- /dev/null +++ b/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/models/_models.py @@ -0,0 +1,658 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class Resource(Model): + """Common fields that are returned in the response for all Azure Resource + Manager resources. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class AzureEntityResource(Resource): + """The resource model definition for an Azure Resource Manager resource with + an etag. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + :vartype type: str + :ivar etag: Resource Etag. + :vartype etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AzureEntityResource, self).__init__(**kwargs) + self.etag = None + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ProxyResource(Resource): + """The resource model definition for an Azure Resource Manager proxy resource. + It will have everything other than required location and tags. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ProxyResource, self).__init__(**kwargs) + + +class Configuration(ProxyResource): + """Tenant configuration. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + :vartype type: str + :param enforce_private_markdown_storage: When flag is set to true Markdown + tile will require external storage configuration (URI). The inline content + configuration will be prohibited. + :type enforce_private_markdown_storage: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'enforce_private_markdown_storage': {'key': 'properties.enforcePrivateMarkdownStorage', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(Configuration, self).__init__(**kwargs) + self.enforce_private_markdown_storage = kwargs.get('enforce_private_markdown_storage', None) + + +class Dashboard(Model): + """The shared dashboard resource definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param lenses: The dashboard lenses. + :type lenses: list[~azure.mgmt.portal.models.DashboardLens] + :param metadata: The dashboard metadata. + :type metadata: dict[str, object] + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'lenses': {'key': 'properties.lenses', 'type': '[DashboardLens]'}, + 'metadata': {'key': 'properties.metadata', 'type': '{object}'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(Dashboard, self).__init__(**kwargs) + self.lenses = kwargs.get('lenses', None) + self.metadata = kwargs.get('metadata', None) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + + +class DashboardLens(Model): + """A dashboard lens. + + All required parameters must be populated in order to send to Azure. + + :param order: Required. The lens order. + :type order: int + :param parts: Required. The dashboard parts. + :type parts: list[~azure.mgmt.portal.models.DashboardParts] + :param metadata: The dashboard len's metadata. + :type metadata: dict[str, object] + """ + + _validation = { + 'order': {'required': True}, + 'parts': {'required': True}, + } + + _attribute_map = { + 'order': {'key': 'order', 'type': 'int'}, + 'parts': {'key': 'parts', 'type': '[DashboardParts]'}, + 'metadata': {'key': 'metadata', 'type': '{object}'}, + } + + def __init__(self, **kwargs): + super(DashboardLens, self).__init__(**kwargs) + self.order = kwargs.get('order', None) + self.parts = kwargs.get('parts', None) + self.metadata = kwargs.get('metadata', None) + + +class DashboardPartMetadata(Model): + """A dashboard part metadata. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: MarkdownPartMetadata + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Constant filled by server. + :type type: str + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'Extension/HubsExtension/PartType/MarkdownPart': 'MarkdownPartMetadata'} + } + + def __init__(self, **kwargs): + super(DashboardPartMetadata, self).__init__(**kwargs) + self.type = None + + +class DashboardParts(Model): + """A dashboard part. + + All required parameters must be populated in order to send to Azure. + + :param position: Required. The dashboard's part position. + :type position: ~azure.mgmt.portal.models.DashboardPartsPosition + :param metadata: The dashboard part's metadata. + :type metadata: ~azure.mgmt.portal.models.DashboardPartMetadata + """ + + _validation = { + 'position': {'required': True}, + } + + _attribute_map = { + 'position': {'key': 'position', 'type': 'DashboardPartsPosition'}, + 'metadata': {'key': 'metadata', 'type': 'DashboardPartMetadata'}, + } + + def __init__(self, **kwargs): + super(DashboardParts, self).__init__(**kwargs) + self.position = kwargs.get('position', None) + self.metadata = kwargs.get('metadata', None) + + +class DashboardPartsPosition(Model): + """The dashboard's part position. + + All required parameters must be populated in order to send to Azure. + + :param x: Required. The dashboard's part x coordinate. + :type x: int + :param y: Required. The dashboard's part y coordinate. + :type y: int + :param row_span: Required. The dashboard's part row span. + :type row_span: int + :param col_span: Required. The dashboard's part column span. + :type col_span: int + :param metadata: The dashboard part's metadata. + :type metadata: dict[str, object] + """ + + _validation = { + 'x': {'required': True}, + 'y': {'required': True}, + 'row_span': {'required': True}, + 'col_span': {'required': True}, + } + + _attribute_map = { + 'x': {'key': 'x', 'type': 'int'}, + 'y': {'key': 'y', 'type': 'int'}, + 'row_span': {'key': 'rowSpan', 'type': 'int'}, + 'col_span': {'key': 'colSpan', 'type': 'int'}, + 'metadata': {'key': 'metadata', 'type': '{object}'}, + } + + def __init__(self, **kwargs): + super(DashboardPartsPosition, self).__init__(**kwargs) + self.x = kwargs.get('x', None) + self.y = kwargs.get('y', None) + self.row_span = kwargs.get('row_span', None) + self.col_span = kwargs.get('col_span', None) + self.metadata = kwargs.get('metadata', None) + + +class ErrorDefinition(Model): + """Error definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar code: Service specific error code which serves as the substatus for + the HTTP error code. + :vartype code: int + :ivar message: Description of the error. + :vartype message: str + :ivar details: Internal error details. + :vartype details: list[~azure.mgmt.portal.models.ErrorDefinition] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'details': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDefinition]'}, + } + + def __init__(self, **kwargs): + super(ErrorDefinition, self).__init__(**kwargs) + self.code = None + self.message = None + self.details = None + + +class ErrorResponse(Model): + """Error response. + + :param error: The error details. + :type error: ~azure.mgmt.portal.models.ErrorDefinition + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class MarkdownPartMetadata(DashboardPartMetadata): + """Markdown part metadata. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Constant filled by server. + :type type: str + :param inputs: Input to dashboard part. + :type inputs: list[object] + :param settings: Markdown part settings. + :type settings: ~azure.mgmt.portal.models.MarkdownPartMetadataSettings + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'inputs': {'key': 'inputs', 'type': '[object]'}, + 'settings': {'key': 'settings', 'type': 'MarkdownPartMetadataSettings'}, + } + + def __init__(self, **kwargs): + super(MarkdownPartMetadata, self).__init__(**kwargs) + self.inputs = kwargs.get('inputs', None) + self.settings = kwargs.get('settings', None) + self.type = 'Extension/HubsExtension/PartType/MarkdownPart' + + +class MarkdownPartMetadataSettings(Model): + """Markdown part settings. + + :param content: The content of markdown part. + :type content: + ~azure.mgmt.portal.models.MarkdownPartMetadataSettingsContent + """ + + _attribute_map = { + 'content': {'key': 'content', 'type': 'MarkdownPartMetadataSettingsContent'}, + } + + def __init__(self, **kwargs): + super(MarkdownPartMetadataSettings, self).__init__(**kwargs) + self.content = kwargs.get('content', None) + + +class MarkdownPartMetadataSettingsContent(Model): + """The content of markdown part. + + :param settings: The setting of the content of markdown part. + :type settings: + ~azure.mgmt.portal.models.MarkdownPartMetadataSettingsContentSettings + """ + + _attribute_map = { + 'settings': {'key': 'settings', 'type': 'MarkdownPartMetadataSettingsContentSettings'}, + } + + def __init__(self, **kwargs): + super(MarkdownPartMetadataSettingsContent, self).__init__(**kwargs) + self.settings = kwargs.get('settings', None) + + +class MarkdownPartMetadataSettingsContentSettings(Model): + """The setting of the content of markdown part. + + :param content: The content of the markdown part. + :type content: str + :param title: The title of the markdown part. + :type title: str + :param subtitle: The subtitle of the markdown part. + :type subtitle: str + :param markdown_source: The source of the content of the markdown part. + :type markdown_source: int + :param markdown_uri: The uri of markdown content. + :type markdown_uri: str + """ + + _attribute_map = { + 'content': {'key': 'content', 'type': 'str'}, + 'title': {'key': 'title', 'type': 'str'}, + 'subtitle': {'key': 'subtitle', 'type': 'str'}, + 'markdown_source': {'key': 'markdownSource', 'type': 'int'}, + 'markdown_uri': {'key': 'markdownUri', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(MarkdownPartMetadataSettingsContentSettings, self).__init__(**kwargs) + self.content = kwargs.get('content', None) + self.title = kwargs.get('title', None) + self.subtitle = kwargs.get('subtitle', None) + self.markdown_source = kwargs.get('markdown_source', None) + self.markdown_uri = kwargs.get('markdown_uri', None) + + +class PatchableDashboard(Model): + """The shared dashboard resource definition. + + :param lenses: The dashboard lenses. + :type lenses: list[~azure.mgmt.portal.models.DashboardLens] + :param metadata: The dashboard metadata. + :type metadata: dict[str, object] + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _attribute_map = { + 'lenses': {'key': 'properties.lenses', 'type': '[DashboardLens]'}, + 'metadata': {'key': 'properties.metadata', 'type': '{object}'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(PatchableDashboard, self).__init__(**kwargs) + self.lenses = kwargs.get('lenses', None) + self.metadata = kwargs.get('metadata', None) + self.tags = kwargs.get('tags', None) + + +class ResourceProviderOperation(Model): + """Supported operations of this resource provider. + + :param name: Operation name, in format of + {provider}/{resource}/{operation} + :type name: str + :param is_data_action: Indicates whether the operation applies to + data-plane. + :type is_data_action: str + :param display: Display metadata associated with the operation. + :type display: ~azure.mgmt.portal.models.ResourceProviderOperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'ResourceProviderOperationDisplay'}, + } + + def __init__(self, **kwargs): + super(ResourceProviderOperation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.is_data_action = kwargs.get('is_data_action', None) + self.display = kwargs.get('display', None) + + +class ResourceProviderOperationDisplay(Model): + """Display metadata associated with the operation. + + :param provider: Resource provider: Microsoft Custom Providers. + :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 TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top + level resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + :vartype type: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(TrackedResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.location = kwargs.get('location', None) + + +class Violation(Model): + """Violation information. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Id of the item that violates tenant configuration. + :vartype id: str + :ivar user_id: Id of the user who owns violated item. + :vartype user_id: str + :ivar error_message: Error message. + :vartype error_message: str + """ + + _validation = { + 'id': {'readonly': True}, + 'user_id': {'readonly': True}, + 'error_message': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'user_id': {'key': 'userId', 'type': 'str'}, + 'error_message': {'key': 'errorMessage', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Violation, self).__init__(**kwargs) + self.id = None + self.user_id = None + self.error_message = None diff --git a/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/models/_models_py3.py b/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/models/_models_py3.py new file mode 100644 index 00000000000..898b0586ea6 --- /dev/null +++ b/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/models/_models_py3.py @@ -0,0 +1,658 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class Resource(Model): + """Common fields that are returned in the response for all Azure Resource + Manager resources. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class AzureEntityResource(Resource): + """The resource model definition for an Azure Resource Manager resource with + an etag. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + :vartype type: str + :ivar etag: Resource Etag. + :vartype etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(AzureEntityResource, self).__init__(**kwargs) + self.etag = None + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ProxyResource(Resource): + """The resource model definition for an Azure Resource Manager proxy resource. + It will have everything other than required location and tags. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(ProxyResource, self).__init__(**kwargs) + + +class Configuration(ProxyResource): + """Tenant configuration. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + :vartype type: str + :param enforce_private_markdown_storage: When flag is set to true Markdown + tile will require external storage configuration (URI). The inline content + configuration will be prohibited. + :type enforce_private_markdown_storage: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'enforce_private_markdown_storage': {'key': 'properties.enforcePrivateMarkdownStorage', 'type': 'bool'}, + } + + def __init__(self, *, enforce_private_markdown_storage: bool=None, **kwargs) -> None: + super(Configuration, self).__init__(**kwargs) + self.enforce_private_markdown_storage = enforce_private_markdown_storage + + +class Dashboard(Model): + """The shared dashboard resource definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param lenses: The dashboard lenses. + :type lenses: list[~azure.mgmt.portal.models.DashboardLens] + :param metadata: The dashboard metadata. + :type metadata: dict[str, object] + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'lenses': {'key': 'properties.lenses', 'type': '[DashboardLens]'}, + 'metadata': {'key': 'properties.metadata', 'type': '{object}'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, location: str, lenses=None, metadata=None, tags=None, **kwargs) -> None: + super(Dashboard, self).__init__(**kwargs) + self.lenses = lenses + self.metadata = metadata + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class DashboardLens(Model): + """A dashboard lens. + + All required parameters must be populated in order to send to Azure. + + :param order: Required. The lens order. + :type order: int + :param parts: Required. The dashboard parts. + :type parts: list[~azure.mgmt.portal.models.DashboardParts] + :param metadata: The dashboard len's metadata. + :type metadata: dict[str, object] + """ + + _validation = { + 'order': {'required': True}, + 'parts': {'required': True}, + } + + _attribute_map = { + 'order': {'key': 'order', 'type': 'int'}, + 'parts': {'key': 'parts', 'type': '[DashboardParts]'}, + 'metadata': {'key': 'metadata', 'type': '{object}'}, + } + + def __init__(self, *, order: int, parts, metadata=None, **kwargs) -> None: + super(DashboardLens, self).__init__(**kwargs) + self.order = order + self.parts = parts + self.metadata = metadata + + +class DashboardPartMetadata(Model): + """A dashboard part metadata. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: MarkdownPartMetadata + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Constant filled by server. + :type type: str + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'Extension/HubsExtension/PartType/MarkdownPart': 'MarkdownPartMetadata'} + } + + def __init__(self, **kwargs) -> None: + super(DashboardPartMetadata, self).__init__(**kwargs) + self.type = None + + +class DashboardParts(Model): + """A dashboard part. + + All required parameters must be populated in order to send to Azure. + + :param position: Required. The dashboard's part position. + :type position: ~azure.mgmt.portal.models.DashboardPartsPosition + :param metadata: The dashboard part's metadata. + :type metadata: ~azure.mgmt.portal.models.DashboardPartMetadata + """ + + _validation = { + 'position': {'required': True}, + } + + _attribute_map = { + 'position': {'key': 'position', 'type': 'DashboardPartsPosition'}, + 'metadata': {'key': 'metadata', 'type': 'DashboardPartMetadata'}, + } + + def __init__(self, *, position, metadata=None, **kwargs) -> None: + super(DashboardParts, self).__init__(**kwargs) + self.position = position + self.metadata = metadata + + +class DashboardPartsPosition(Model): + """The dashboard's part position. + + All required parameters must be populated in order to send to Azure. + + :param x: Required. The dashboard's part x coordinate. + :type x: int + :param y: Required. The dashboard's part y coordinate. + :type y: int + :param row_span: Required. The dashboard's part row span. + :type row_span: int + :param col_span: Required. The dashboard's part column span. + :type col_span: int + :param metadata: The dashboard part's metadata. + :type metadata: dict[str, object] + """ + + _validation = { + 'x': {'required': True}, + 'y': {'required': True}, + 'row_span': {'required': True}, + 'col_span': {'required': True}, + } + + _attribute_map = { + 'x': {'key': 'x', 'type': 'int'}, + 'y': {'key': 'y', 'type': 'int'}, + 'row_span': {'key': 'rowSpan', 'type': 'int'}, + 'col_span': {'key': 'colSpan', 'type': 'int'}, + 'metadata': {'key': 'metadata', 'type': '{object}'}, + } + + def __init__(self, *, x: int, y: int, row_span: int, col_span: int, metadata=None, **kwargs) -> None: + super(DashboardPartsPosition, self).__init__(**kwargs) + self.x = x + self.y = y + self.row_span = row_span + self.col_span = col_span + self.metadata = metadata + + +class ErrorDefinition(Model): + """Error definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar code: Service specific error code which serves as the substatus for + the HTTP error code. + :vartype code: int + :ivar message: Description of the error. + :vartype message: str + :ivar details: Internal error details. + :vartype details: list[~azure.mgmt.portal.models.ErrorDefinition] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'details': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDefinition]'}, + } + + def __init__(self, **kwargs) -> None: + super(ErrorDefinition, self).__init__(**kwargs) + self.code = None + self.message = None + self.details = None + + +class ErrorResponse(Model): + """Error response. + + :param error: The error details. + :type error: ~azure.mgmt.portal.models.ErrorDefinition + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class MarkdownPartMetadata(DashboardPartMetadata): + """Markdown part metadata. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Constant filled by server. + :type type: str + :param inputs: Input to dashboard part. + :type inputs: list[object] + :param settings: Markdown part settings. + :type settings: ~azure.mgmt.portal.models.MarkdownPartMetadataSettings + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'inputs': {'key': 'inputs', 'type': '[object]'}, + 'settings': {'key': 'settings', 'type': 'MarkdownPartMetadataSettings'}, + } + + def __init__(self, *, inputs=None, settings=None, **kwargs) -> None: + super(MarkdownPartMetadata, self).__init__(**kwargs) + self.inputs = inputs + self.settings = settings + self.type = 'Extension/HubsExtension/PartType/MarkdownPart' + + +class MarkdownPartMetadataSettings(Model): + """Markdown part settings. + + :param content: The content of markdown part. + :type content: + ~azure.mgmt.portal.models.MarkdownPartMetadataSettingsContent + """ + + _attribute_map = { + 'content': {'key': 'content', 'type': 'MarkdownPartMetadataSettingsContent'}, + } + + def __init__(self, *, content=None, **kwargs) -> None: + super(MarkdownPartMetadataSettings, self).__init__(**kwargs) + self.content = content + + +class MarkdownPartMetadataSettingsContent(Model): + """The content of markdown part. + + :param settings: The setting of the content of markdown part. + :type settings: + ~azure.mgmt.portal.models.MarkdownPartMetadataSettingsContentSettings + """ + + _attribute_map = { + 'settings': {'key': 'settings', 'type': 'MarkdownPartMetadataSettingsContentSettings'}, + } + + def __init__(self, *, settings=None, **kwargs) -> None: + super(MarkdownPartMetadataSettingsContent, self).__init__(**kwargs) + self.settings = settings + + +class MarkdownPartMetadataSettingsContentSettings(Model): + """The setting of the content of markdown part. + + :param content: The content of the markdown part. + :type content: str + :param title: The title of the markdown part. + :type title: str + :param subtitle: The subtitle of the markdown part. + :type subtitle: str + :param markdown_source: The source of the content of the markdown part. + :type markdown_source: int + :param markdown_uri: The uri of markdown content. + :type markdown_uri: str + """ + + _attribute_map = { + 'content': {'key': 'content', 'type': 'str'}, + 'title': {'key': 'title', 'type': 'str'}, + 'subtitle': {'key': 'subtitle', 'type': 'str'}, + 'markdown_source': {'key': 'markdownSource', 'type': 'int'}, + 'markdown_uri': {'key': 'markdownUri', 'type': 'str'}, + } + + def __init__(self, *, content: str=None, title: str=None, subtitle: str=None, markdown_source: int=None, markdown_uri: str=None, **kwargs) -> None: + super(MarkdownPartMetadataSettingsContentSettings, self).__init__(**kwargs) + self.content = content + self.title = title + self.subtitle = subtitle + self.markdown_source = markdown_source + self.markdown_uri = markdown_uri + + +class PatchableDashboard(Model): + """The shared dashboard resource definition. + + :param lenses: The dashboard lenses. + :type lenses: list[~azure.mgmt.portal.models.DashboardLens] + :param metadata: The dashboard metadata. + :type metadata: dict[str, object] + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _attribute_map = { + 'lenses': {'key': 'properties.lenses', 'type': '[DashboardLens]'}, + 'metadata': {'key': 'properties.metadata', 'type': '{object}'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, lenses=None, metadata=None, tags=None, **kwargs) -> None: + super(PatchableDashboard, self).__init__(**kwargs) + self.lenses = lenses + self.metadata = metadata + self.tags = tags + + +class ResourceProviderOperation(Model): + """Supported operations of this resource provider. + + :param name: Operation name, in format of + {provider}/{resource}/{operation} + :type name: str + :param is_data_action: Indicates whether the operation applies to + data-plane. + :type is_data_action: str + :param display: Display metadata associated with the operation. + :type display: ~azure.mgmt.portal.models.ResourceProviderOperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'ResourceProviderOperationDisplay'}, + } + + def __init__(self, *, name: str=None, is_data_action: str=None, display=None, **kwargs) -> None: + super(ResourceProviderOperation, self).__init__(**kwargs) + self.name = name + self.is_data_action = is_data_action + self.display = display + + +class ResourceProviderOperationDisplay(Model): + """Display metadata associated with the operation. + + :param provider: Resource provider: Microsoft Custom Providers. + :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: str=None, resource: str=None, operation: str=None, description: str=None, **kwargs) -> None: + super(ResourceProviderOperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top + level resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + :vartype type: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__(self, *, location: str, tags=None, **kwargs) -> None: + super(TrackedResource, self).__init__(**kwargs) + self.tags = tags + self.location = location + + +class Violation(Model): + """Violation information. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Id of the item that violates tenant configuration. + :vartype id: str + :ivar user_id: Id of the user who owns violated item. + :vartype user_id: str + :ivar error_message: Error message. + :vartype error_message: str + """ + + _validation = { + 'id': {'readonly': True}, + 'user_id': {'readonly': True}, + 'error_message': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'user_id': {'key': 'userId', 'type': 'str'}, + 'error_message': {'key': 'errorMessage', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(Violation, self).__init__(**kwargs) + self.id = None + self.user_id = None + self.error_message = None diff --git a/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/models/_paged_models.py b/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/models/_paged_models.py new file mode 100644 index 00000000000..cd908b0dc11 --- /dev/null +++ b/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/models/_paged_models.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class ResourceProviderOperationPaged(Paged): + """ + A paging container for iterating over a list of :class:`ResourceProviderOperation ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ResourceProviderOperation]'} + } + + def __init__(self, *args, **kwargs): + + super(ResourceProviderOperationPaged, self).__init__(*args, **kwargs) +class DashboardPaged(Paged): + """ + A paging container for iterating over a list of :class:`Dashboard ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Dashboard]'} + } + + def __init__(self, *args, **kwargs): + + super(DashboardPaged, self).__init__(*args, **kwargs) +class ConfigurationPaged(Paged): + """ + A paging container for iterating over a list of :class:`Configuration ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Configuration]'} + } + + def __init__(self, *args, **kwargs): + + super(ConfigurationPaged, self).__init__(*args, **kwargs) +class ViolationPaged(Paged): + """ + A paging container for iterating over a list of :class:`Violation ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Violation]'} + } + + def __init__(self, *args, **kwargs): + + super(ViolationPaged, self).__init__(*args, **kwargs) diff --git a/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/operations/__init__.py b/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/operations/__init__.py new file mode 100644 index 00000000000..a1a3756b57b --- /dev/null +++ b/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._dashboards_operations import DashboardsOperations +from ._tenant_configurations_operations import TenantConfigurationsOperations +from ._list_tenant_configuration_violations_operations import ListTenantConfigurationViolationsOperations + +__all__ = [ + 'Operations', + 'DashboardsOperations', + 'TenantConfigurationsOperations', + 'ListTenantConfigurationViolationsOperations', +] diff --git a/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/operations/_dashboards_operations.py b/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/operations/_dashboards_operations.py new file mode 100644 index 00000000000..41cc0846c08 --- /dev/null +++ b/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/operations/_dashboards_operations.py @@ -0,0 +1,419 @@ +# 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 uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class DashboardsOperations(object): + """DashboardsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to be used with the HTTP request. Constant value: "2020-09-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-09-01-preview" + + self.config = config + + def create_or_update( + self, resource_group_name, dashboard_name, dashboard, custom_headers=None, raw=False, **operation_config): + """Creates or updates a Dashboard. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dashboard_name: The name of the dashboard. + :type dashboard_name: str + :param dashboard: The parameters required to create or update a + dashboard. + :type dashboard: ~azure.mgmt.portal.models.Dashboard + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Dashboard or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.portal.models.Dashboard or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'dashboardName': self._serialize.url("dashboard_name", dashboard_name, 'str', max_length=64, min_length=3) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(dashboard, 'Dashboard') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Dashboard', response) + if response.status_code == 201: + deserialized = self._deserialize('Dashboard', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}'} + + def delete( + self, resource_group_name, dashboard_name, custom_headers=None, raw=False, **operation_config): + """Deletes the Dashboard. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dashboard_name: The name of the dashboard. + :type dashboard_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'dashboardName': self._serialize.url("dashboard_name", dashboard_name, 'str', max_length=64, min_length=3) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}'} + + def get( + self, resource_group_name, dashboard_name, custom_headers=None, raw=False, **operation_config): + """Gets the Dashboard. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dashboard_name: The name of the dashboard. + :type dashboard_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Dashboard or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.portal.models.Dashboard or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'dashboardName': self._serialize.url("dashboard_name", dashboard_name, 'str', max_length=64, min_length=3) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 404]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Dashboard', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}'} + + def update( + self, resource_group_name, dashboard_name, dashboard, custom_headers=None, raw=False, **operation_config): + """Updates an existing Dashboard. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dashboard_name: The name of the dashboard. + :type dashboard_name: str + :param dashboard: The updatable fields of a Dashboard. + :type dashboard: ~azure.mgmt.portal.models.PatchableDashboard + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Dashboard or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.portal.models.Dashboard or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'dashboardName': self._serialize.url("dashboard_name", dashboard_name, 'str', max_length=64, min_length=3) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(dashboard, 'PatchableDashboard') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 404]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Dashboard', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Gets all the Dashboards within a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Dashboard + :rtype: + ~azure.mgmt.portal.models.DashboardPaged[~azure.mgmt.portal.models.Dashboard] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.DashboardPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards'} + + def list_by_subscription( + self, custom_headers=None, raw=False, **operation_config): + """Gets all the dashboards within a subscription. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Dashboard + :rtype: + ~azure.mgmt.portal.models.DashboardPaged[~azure.mgmt.portal.models.Dashboard] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.DashboardPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Portal/dashboards'} diff --git a/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/operations/_list_tenant_configuration_violations_operations.py b/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/operations/_list_tenant_configuration_violations_operations.py new file mode 100644 index 00000000000..f7066a6e2b9 --- /dev/null +++ b/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/operations/_list_tenant_configuration_violations_operations.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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class ListTenantConfigurationViolationsOperations(object): + """ListTenantConfigurationViolationsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to be used with the HTTP request. Constant value: "2020-09-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-09-01-preview" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Gets list of items that violate tenant's configuration. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Violation + :rtype: + ~azure.mgmt.portal.models.ViolationPaged[~azure.mgmt.portal.models.Violation] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ViolationPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Portal/listTenantConfigurationViolations'} diff --git a/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/operations/_operations.py b/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/operations/_operations.py new file mode 100644 index 00000000000..3ef603e696d --- /dev/null +++ b/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/operations/_operations.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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class Operations(object): + """Operations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to be used with the HTTP request. Constant value: "2020-09-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-09-01-preview" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """The Microsoft Portal operations API. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ResourceProviderOperation + :rtype: + ~azure.mgmt.portal.models.ResourceProviderOperationPaged[~azure.mgmt.portal.models.ResourceProviderOperation] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ResourceProviderOperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Portal/operations'} diff --git a/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/operations/_tenant_configurations_operations.py b/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/operations/_tenant_configurations_operations.py new file mode 100644 index 00000000000..5bce5716439 --- /dev/null +++ b/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/operations/_tenant_configurations_operations.py @@ -0,0 +1,270 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class TenantConfigurationsOperations(object): + """TenantConfigurationsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to be used with the HTTP request. Constant value: "2020-09-01-preview". + :ivar configuration_name: The configuration name. Value must be 'default'. Constant value: "default". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-09-01-preview" + self.configuration_name = "default" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Gets list of the tenant configurations. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Configuration + :rtype: + ~azure.mgmt.portal.models.ConfigurationPaged[~azure.mgmt.portal.models.Configuration] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ConfigurationPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Portal/tenantConfigurations'} + + def get( + self, custom_headers=None, raw=False, **operation_config): + """Gets the tenant configuration. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Configuration or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.portal.models.Configuration or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'configurationName': self._serialize.url("self.configuration_name", self.configuration_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 404]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Configuration', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/providers/Microsoft.Portal/tenantConfigurations/{configurationName}'} + + def create( + self, enforce_private_markdown_storage=None, custom_headers=None, raw=False, **operation_config): + """Create the tenant configuration. If configuration already exists - + update it. User has to be a Tenant Admin for this operation. + + :param enforce_private_markdown_storage: When flag is set to true + Markdown tile will require external storage configuration (URI). The + inline content configuration will be prohibited. + :type enforce_private_markdown_storage: bool + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Configuration or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.portal.models.Configuration or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + tenant_configuration = models.Configuration(enforce_private_markdown_storage=enforce_private_markdown_storage) + + # Construct URL + url = self.create.metadata['url'] + path_format_arguments = { + 'configurationName': self._serialize.url("self.configuration_name", self.configuration_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(tenant_configuration, 'Configuration') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Configuration', response) + if response.status_code == 201: + deserialized = self._deserialize('Configuration', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create.metadata = {'url': '/providers/Microsoft.Portal/tenantConfigurations/{configurationName}'} + + def delete( + self, custom_headers=None, raw=False, **operation_config): + """Delete the tenant configuration. User has to be a Tenant Admin for this + operation. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'configurationName': self._serialize.url("self.configuration_name", self.configuration_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/providers/Microsoft.Portal/tenantConfigurations/{configurationName}'} diff --git a/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/version.py b/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/version.py new file mode 100644 index 00000000000..e0ec669828c --- /dev/null +++ b/sdk/portal/azure-mgmt-portal/azure/mgmt/portal/version.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +VERSION = "0.1.0" + diff --git a/sdk/portal/azure-mgmt-portal/sdk_packaging.toml b/sdk/portal/azure-mgmt-portal/sdk_packaging.toml new file mode 100644 index 00000000000..d721eab15ce --- /dev/null +++ b/sdk/portal/azure-mgmt-portal/sdk_packaging.toml @@ -0,0 +1,8 @@ +[packaging] +package_name = "azure-mgmt-portal" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = true diff --git a/sdk/portal/azure-mgmt-portal/setup.cfg b/sdk/portal/azure-mgmt-portal/setup.cfg new file mode 100644 index 00000000000..3c6e79cf31d --- /dev/null +++ b/sdk/portal/azure-mgmt-portal/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/portal/azure-mgmt-portal/setup.py b/sdk/portal/azure-mgmt-portal/setup.py new file mode 100644 index 00000000000..c224b7af5c5 --- /dev/null +++ b/sdk/portal/azure-mgmt-portal/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-portal" +PACKAGE_PPRINT_NAME = "MyService Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# azure v0.x is not compatible with this package +# azure v0.x used to have a __version__ attribute (newer versions don't) +try: + import azure + try: + ver = azure.__version__ + raise Exception( + 'This package is incompatible with azure=={}. '.format(ver) + + 'Uninstall it with "pip uninstall azure".' + ) + except AttributeError: + pass +except ImportError: + pass + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +with open('README.md', encoding='utf-8') as f: + readme = f.read() +with open('CHANGELOG.md', encoding='utf-8') as f: + changelog = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + '\n\n' + changelog, + long_description_content_type='text/markdown', + license='MIT License', + author='Microsoft Corporation', + author_email='azpysdkhelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python', + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.mgmt', + ]), + install_requires=[ + 'msrest>=0.5.0', + 'msrestazure>=0.4.32,<2.0.0', + 'azure-common~=1.1', + ], + extras_require={ + ":python_version<'3.0'": ['azure-mgmt-nspkg'], + } +)