diff --git a/sdk/azure-mgmt/portal/__init__.py b/sdk/azure-mgmt/portal/__init__.py new file mode 100644 index 000000000000..03d9e94ea57d --- /dev/null +++ b/sdk/azure-mgmt/portal/__init__.py @@ -0,0 +1,18 @@ +# 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 .portal_client import portalClient +from .version import VERSION + +__all__ = ['portalClient'] + +__version__ = VERSION + diff --git a/sdk/azure-mgmt/portal/models/__init__.py b/sdk/azure-mgmt/portal/models/__init__.py new file mode 100644 index 000000000000..65c173da7585 --- /dev/null +++ b/sdk/azure-mgmt/portal/models/__init__.py @@ -0,0 +1,47 @@ +# 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 .dashboard_parts_position_py3 import DashboardPartsPosition + from .dashboard_parts_py3 import DashboardParts + from .dashboard_lens_py3 import DashboardLens + from .dashboard_py3 import Dashboard + from .patchable_dashboard_py3 import PatchableDashboard + from .resource_provider_operation_display_py3 import ResourceProviderOperationDisplay + from .resource_provider_operation_py3 import ResourceProviderOperation + from .error_definition_py3 import ErrorDefinition + from .error_response_py3 import ErrorResponse, ErrorResponseException +except (SyntaxError, ImportError): + from .dashboard_parts_position import DashboardPartsPosition + from .dashboard_parts import DashboardParts + from .dashboard_lens import DashboardLens + from .dashboard import Dashboard + from .patchable_dashboard import PatchableDashboard + from .resource_provider_operation_display import ResourceProviderOperationDisplay + from .resource_provider_operation import ResourceProviderOperation + from .error_definition import ErrorDefinition + from .error_response import ErrorResponse, ErrorResponseException +from .resource_provider_operation_paged import ResourceProviderOperationPaged +from .dashboard_paged import DashboardPaged + +__all__ = [ + 'DashboardPartsPosition', + 'DashboardParts', + 'DashboardLens', + 'Dashboard', + 'PatchableDashboard', + 'ResourceProviderOperationDisplay', + 'ResourceProviderOperation', + 'ErrorDefinition', + 'ErrorResponse', 'ErrorResponseException', + 'ResourceProviderOperationPaged', + 'DashboardPaged', +] diff --git a/sdk/azure-mgmt/portal/models/dashboard.py b/sdk/azure-mgmt/portal/models/dashboard.py new file mode 100644 index 000000000000..8fb82102fc17 --- /dev/null +++ b/sdk/azure-mgmt/portal/models/dashboard.py @@ -0,0 +1,64 @@ +# 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 + + +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: dict[str, ~microsoft.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) diff --git a/sdk/azure-mgmt/portal/models/dashboard_lens.py b/sdk/azure-mgmt/portal/models/dashboard_lens.py new file mode 100644 index 000000000000..94e2b4e0e84d --- /dev/null +++ b/sdk/azure-mgmt/portal/models/dashboard_lens.py @@ -0,0 +1,43 @@ +# 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 + + +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: dict[str, ~microsoft.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) diff --git a/sdk/azure-mgmt/portal/models/dashboard_lens_py3.py b/sdk/azure-mgmt/portal/models/dashboard_lens_py3.py new file mode 100644 index 000000000000..516aca5fc3c2 --- /dev/null +++ b/sdk/azure-mgmt/portal/models/dashboard_lens_py3.py @@ -0,0 +1,43 @@ +# 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 + + +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: dict[str, ~microsoft.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 diff --git a/sdk/azure-mgmt/portal/models/dashboard_paged.py b/sdk/azure-mgmt/portal/models/dashboard_paged.py new file mode 100644 index 000000000000..aca888afc936 --- /dev/null +++ b/sdk/azure-mgmt/portal/models/dashboard_paged.py @@ -0,0 +1,27 @@ +# 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 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) diff --git a/sdk/azure-mgmt/portal/models/dashboard_parts.py b/sdk/azure-mgmt/portal/models/dashboard_parts.py new file mode 100644 index 000000000000..6c794b24ee06 --- /dev/null +++ b/sdk/azure-mgmt/portal/models/dashboard_parts.py @@ -0,0 +1,38 @@ +# 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 + + +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: ~microsoft.portal.models.DashboardPartsPosition + :param metadata: The dashboard part's metadata. + :type metadata: dict[str, object] + """ + + _validation = { + 'position': {'required': True}, + } + + _attribute_map = { + 'position': {'key': 'position', 'type': 'DashboardPartsPosition'}, + 'metadata': {'key': 'metadata', 'type': '{object}'}, + } + + def __init__(self, **kwargs): + super(DashboardParts, self).__init__(**kwargs) + self.position = kwargs.get('position', None) + self.metadata = kwargs.get('metadata', None) diff --git a/sdk/azure-mgmt/portal/models/dashboard_parts_position.py b/sdk/azure-mgmt/portal/models/dashboard_parts_position.py new file mode 100644 index 000000000000..a395c6e22554 --- /dev/null +++ b/sdk/azure-mgmt/portal/models/dashboard_parts_position.py @@ -0,0 +1,53 @@ +# 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 + + +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: float + :param y: Required. The dashboard's part y coordinate. + :type y: float + :param row_span: Required. The dashboard's part row span. + :type row_span: float + :param col_span: Required. The dashboard's part column span. + :type col_span: float + :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': 'float'}, + 'y': {'key': 'y', 'type': 'float'}, + 'row_span': {'key': 'rowSpan', 'type': 'float'}, + 'col_span': {'key': 'colSpan', 'type': 'float'}, + '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) diff --git a/sdk/azure-mgmt/portal/models/dashboard_parts_position_py3.py b/sdk/azure-mgmt/portal/models/dashboard_parts_position_py3.py new file mode 100644 index 000000000000..f3119067949a --- /dev/null +++ b/sdk/azure-mgmt/portal/models/dashboard_parts_position_py3.py @@ -0,0 +1,53 @@ +# 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 + + +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: float + :param y: Required. The dashboard's part y coordinate. + :type y: float + :param row_span: Required. The dashboard's part row span. + :type row_span: float + :param col_span: Required. The dashboard's part column span. + :type col_span: float + :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': 'float'}, + 'y': {'key': 'y', 'type': 'float'}, + 'row_span': {'key': 'rowSpan', 'type': 'float'}, + 'col_span': {'key': 'colSpan', 'type': 'float'}, + 'metadata': {'key': 'metadata', 'type': '{object}'}, + } + + def __init__(self, *, x: float, y: float, row_span: float, col_span: float, 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 diff --git a/sdk/azure-mgmt/portal/models/dashboard_parts_py3.py b/sdk/azure-mgmt/portal/models/dashboard_parts_py3.py new file mode 100644 index 000000000000..76c2050ce07f --- /dev/null +++ b/sdk/azure-mgmt/portal/models/dashboard_parts_py3.py @@ -0,0 +1,38 @@ +# 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 + + +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: ~microsoft.portal.models.DashboardPartsPosition + :param metadata: The dashboard part's metadata. + :type metadata: dict[str, object] + """ + + _validation = { + 'position': {'required': True}, + } + + _attribute_map = { + 'position': {'key': 'position', 'type': 'DashboardPartsPosition'}, + 'metadata': {'key': 'metadata', 'type': '{object}'}, + } + + def __init__(self, *, position, metadata=None, **kwargs) -> None: + super(DashboardParts, self).__init__(**kwargs) + self.position = position + self.metadata = metadata diff --git a/sdk/azure-mgmt/portal/models/dashboard_py3.py b/sdk/azure-mgmt/portal/models/dashboard_py3.py new file mode 100644 index 000000000000..2d7110b7ca61 --- /dev/null +++ b/sdk/azure-mgmt/portal/models/dashboard_py3.py @@ -0,0 +1,64 @@ +# 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 + + +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: dict[str, ~microsoft.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 diff --git a/sdk/azure-mgmt/portal/models/error_definition.py b/sdk/azure-mgmt/portal/models/error_definition.py new file mode 100644 index 000000000000..0c6bfe24ee18 --- /dev/null +++ b/sdk/azure-mgmt/portal/models/error_definition.py @@ -0,0 +1,46 @@ +# 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 + + +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: str + :ivar message: Description of the error. + :vartype message: str + :ivar details: Internal error details. + :vartype details: list[~microsoft.portal.models.ErrorDefinition] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'details': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDefinition]'}, + } + + def __init__(self, **kwargs): + super(ErrorDefinition, self).__init__(**kwargs) + self.code = None + self.message = None + self.details = None diff --git a/sdk/azure-mgmt/portal/models/error_definition_py3.py b/sdk/azure-mgmt/portal/models/error_definition_py3.py new file mode 100644 index 000000000000..2aeaf399c6b8 --- /dev/null +++ b/sdk/azure-mgmt/portal/models/error_definition_py3.py @@ -0,0 +1,46 @@ +# 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 + + +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: str + :ivar message: Description of the error. + :vartype message: str + :ivar details: Internal error details. + :vartype details: list[~microsoft.portal.models.ErrorDefinition] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'details': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDefinition]'}, + } + + def __init__(self, **kwargs) -> None: + super(ErrorDefinition, self).__init__(**kwargs) + self.code = None + self.message = None + self.details = None diff --git a/sdk/azure-mgmt/portal/models/error_response.py b/sdk/azure-mgmt/portal/models/error_response.py new file mode 100644 index 000000000000..13e76d150845 --- /dev/null +++ b/sdk/azure-mgmt/portal/models/error_response.py @@ -0,0 +1,41 @@ +# 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 ErrorResponse(Model): + """Error response. + + :param error: The error details. + :type error: ~microsoft.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) diff --git a/sdk/azure-mgmt/portal/models/error_response_py3.py b/sdk/azure-mgmt/portal/models/error_response_py3.py new file mode 100644 index 000000000000..a8fca5467dad --- /dev/null +++ b/sdk/azure-mgmt/portal/models/error_response_py3.py @@ -0,0 +1,41 @@ +# 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 ErrorResponse(Model): + """Error response. + + :param error: The error details. + :type error: ~microsoft.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) diff --git a/sdk/azure-mgmt/portal/models/patchable_dashboard.py b/sdk/azure-mgmt/portal/models/patchable_dashboard.py new file mode 100644 index 000000000000..65689266bd8d --- /dev/null +++ b/sdk/azure-mgmt/portal/models/patchable_dashboard.py @@ -0,0 +1,36 @@ +# 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 + + +class PatchableDashboard(Model): + """The shared dashboard resource definition. + + :param lenses: The dashboard lenses. + :type lenses: dict[str, ~microsoft.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) diff --git a/sdk/azure-mgmt/portal/models/patchable_dashboard_py3.py b/sdk/azure-mgmt/portal/models/patchable_dashboard_py3.py new file mode 100644 index 000000000000..5b2877f64352 --- /dev/null +++ b/sdk/azure-mgmt/portal/models/patchable_dashboard_py3.py @@ -0,0 +1,36 @@ +# 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 + + +class PatchableDashboard(Model): + """The shared dashboard resource definition. + + :param lenses: The dashboard lenses. + :type lenses: dict[str, ~microsoft.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 diff --git a/sdk/azure-mgmt/portal/models/resource_provider_operation.py b/sdk/azure-mgmt/portal/models/resource_provider_operation.py new file mode 100644 index 000000000000..d9c95a19420a --- /dev/null +++ b/sdk/azure-mgmt/portal/models/resource_provider_operation.py @@ -0,0 +1,38 @@ +# 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 + + +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: ~microsoft.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) diff --git a/sdk/azure-mgmt/portal/models/resource_provider_operation_display.py b/sdk/azure-mgmt/portal/models/resource_provider_operation_display.py new file mode 100644 index 000000000000..5ec9125156a1 --- /dev/null +++ b/sdk/azure-mgmt/portal/models/resource_provider_operation_display.py @@ -0,0 +1,40 @@ +# 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 + + +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) diff --git a/sdk/azure-mgmt/portal/models/resource_provider_operation_display_py3.py b/sdk/azure-mgmt/portal/models/resource_provider_operation_display_py3.py new file mode 100644 index 000000000000..1b4dd199c20d --- /dev/null +++ b/sdk/azure-mgmt/portal/models/resource_provider_operation_display_py3.py @@ -0,0 +1,40 @@ +# 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 + + +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 diff --git a/sdk/azure-mgmt/portal/models/resource_provider_operation_paged.py b/sdk/azure-mgmt/portal/models/resource_provider_operation_paged.py new file mode 100644 index 000000000000..49848d328db1 --- /dev/null +++ b/sdk/azure-mgmt/portal/models/resource_provider_operation_paged.py @@ -0,0 +1,27 @@ +# 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) diff --git a/sdk/azure-mgmt/portal/models/resource_provider_operation_py3.py b/sdk/azure-mgmt/portal/models/resource_provider_operation_py3.py new file mode 100644 index 000000000000..94825826bac1 --- /dev/null +++ b/sdk/azure-mgmt/portal/models/resource_provider_operation_py3.py @@ -0,0 +1,38 @@ +# 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 + + +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: ~microsoft.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 diff --git a/sdk/azure-mgmt/portal/operations/__init__.py b/sdk/azure-mgmt/portal/operations/__init__.py new file mode 100644 index 000000000000..b2f9225a1785 --- /dev/null +++ b/sdk/azure-mgmt/portal/operations/__init__.py @@ -0,0 +1,18 @@ +# 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 + +__all__ = [ + 'Operations', + 'DashboardsOperations', +] diff --git a/sdk/azure-mgmt/portal/operations/dashboards_operations.py b/sdk/azure-mgmt/portal/operations/dashboards_operations.py new file mode 100644 index 000000000000..2368780c66be --- /dev/null +++ b/sdk/azure-mgmt/portal/operations/dashboards_operations.py @@ -0,0 +1,416 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class DashboardsOperations(object): + """DashboardsOperations operations. + + :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: "2019-01-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-01-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: ~microsoft.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: ~microsoft.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: ~microsoft.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]: + 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: ~microsoft.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: ~microsoft.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]: + 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: + ~microsoft.portal.models.DashboardPaged[~microsoft.portal.models.Dashboard] + :raises: + :class:`ErrorResponseException` + """ + def internal_paging(next_link=None, raw=False): + + 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) + 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 + deserialized = models.DashboardPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.DashboardPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + 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: + ~microsoft.portal.models.DashboardPaged[~microsoft.portal.models.Dashboard] + :raises: + :class:`ErrorResponseException` + """ + def internal_paging(next_link=None, raw=False): + + 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) + 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 + deserialized = models.DashboardPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.DashboardPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Portal/dashboards'} diff --git a/sdk/azure-mgmt/portal/operations/operations.py b/sdk/azure-mgmt/portal/operations/operations.py new file mode 100644 index 000000000000..2c2178ee889d --- /dev/null +++ b/sdk/azure-mgmt/portal/operations/operations.py @@ -0,0 +1,96 @@ +# 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. + + :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: "2019-01-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-01-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: + ~microsoft.portal.models.ResourceProviderOperationPaged[~microsoft.portal.models.ResourceProviderOperation] + :raises: + :class:`ErrorResponseException` + """ + def internal_paging(next_link=None, raw=False): + + 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) + 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 + deserialized = models.ResourceProviderOperationPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ResourceProviderOperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Portal/operations'} diff --git a/sdk/azure-mgmt/portal/portal_client.py b/sdk/azure-mgmt/portal/portal_client.py new file mode 100644 index 000000000000..cdfe34057b05 --- /dev/null +++ b/sdk/azure-mgmt/portal/portal_client.py @@ -0,0 +1,88 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.service_client import SDKClient +from msrest import Serializer, Deserializer +from msrestazure import AzureConfiguration +from .version import VERSION +from .operations.operations import Operations +from .operations.dashboards_operations import DashboardsOperations +from . import models + + +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) + + self.add_user_agent('portal/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id + + +class portalClient(SDKClient): + """Allows creation and deletion of Azure Shared Dashboards. + + :ivar config: Configuration for client. + :vartype config: portalClientConfiguration + + :ivar operations: Operations operations + :vartype operations: microsoft.portal.operations.Operations + :ivar dashboards: Dashboards operations + :vartype dashboards: microsoft.portal.operations.DashboardsOperations + + :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 = '2019-01-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) diff --git a/sdk/azure-mgmt/portal/version.py b/sdk/azure-mgmt/portal/version.py new file mode 100644 index 000000000000..22ee9818a3e5 --- /dev/null +++ b/sdk/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 = "2015-08-01-preview" +