Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR applicationinsights/resource-manager] Adding Workbooks resource type #2307

Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
from .operations.favorite_operations import FavoriteOperations
from .operations.web_test_locations_operations import WebTestLocationsOperations
from .operations.web_tests_operations import WebTestsOperations
from .operations.workbooks_operations import WorkbooksOperations
from .operations.workbook_operations import WorkbookOperations
from . import models


Expand Down Expand Up @@ -99,6 +101,10 @@ class ApplicationInsightsManagementClient(object):
:vartype web_test_locations: azure.mgmt.applicationinsights.operations.WebTestLocationsOperations
:ivar web_tests: WebTests operations
:vartype web_tests: azure.mgmt.applicationinsights.operations.WebTestsOperations
:ivar workbooks: Workbooks operations
:vartype workbooks: azure.mgmt.applicationinsights.operations.WorkbooksOperations
:ivar workbook: Workbook operations
:vartype workbook: azure.mgmt.applicationinsights.operations.WorkbookOperations

:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
Expand Down Expand Up @@ -149,3 +155,7 @@ def __init__(
self._client, self.config, self._serialize, self._deserialize)
self.web_tests = WebTestsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.workbooks = WorkbooksOperations(
self._client, self.config, self._serialize, self._deserialize)
self.workbook = WorkbookOperations(
self._client, self.config, self._serialize, self._deserialize)
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@
from .web_test_geolocation import WebTestGeolocation
from .web_test_properties_configuration import WebTestPropertiesConfiguration
from .web_test import WebTest
from .workbook import Workbook
from .workbooks import Workbooks
from .link_properties import LinkProperties
from .error_field_contract import ErrorFieldContract
from .workbook_error import WorkbookError, WorkbookErrorException
from .operation_paged import OperationPaged
from .application_insights_component_api_key_paged import ApplicationInsightsComponentAPIKeyPaged
from .application_insights_component_paged import ApplicationInsightsComponentPaged
Expand All @@ -55,7 +60,9 @@
PurgeState,
FavoriteType,
WebTestKind,
SharedTypeKind,
FavoriteSourceType,
CategoryType,
)

__all__ = [
Expand Down Expand Up @@ -93,6 +100,11 @@
'WebTestGeolocation',
'WebTestPropertiesConfiguration',
'WebTest',
'Workbook',
'Workbooks',
'LinkProperties',
'ErrorFieldContract',
'WorkbookError', 'WorkbookErrorException',
'OperationPaged',
'ApplicationInsightsComponentAPIKeyPaged',
'ApplicationInsightsComponentPaged',
Expand All @@ -104,5 +116,7 @@
'PurgeState',
'FavoriteType',
'WebTestKind',
'SharedTypeKind',
'FavoriteSourceType',
'CategoryType',
]
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ class WebTestKind(Enum):
multistep = "multistep"


class SharedTypeKind(Enum):

user = "user"
shared = "shared"


class FavoriteSourceType(Enum):

retention = "retention"
Expand All @@ -56,3 +62,11 @@ class FavoriteSourceType(Enum):
funnel = "funnel"
impact = "impact"
segmentation = "segmentation"


class CategoryType(Enum):

workbook = "workbook"
tsg = "TSG"
performance = "performance"
retention = "retention"
Original file line number Diff line number Diff line change
@@ -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 ErrorFieldContract(Model):
"""Error Field contract.

:param code: Property level error code.
:type code: str
:param message: Human-readable representation of property-level error.
:type message: str
:param target: Property name.
:type target: str
"""

_attribute_map = {
'code': {'key': 'code', 'type': 'str'},
'message': {'key': 'message', 'type': 'str'},
'target': {'key': 'target', 'type': 'str'},
}

def __init__(self, code=None, message=None, target=None):
super(ErrorFieldContract, self).__init__()
self.code = code
self.message = message
self.target = target
Original file line number Diff line number Diff line change
@@ -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 LinkProperties(Model):
"""Contains a sourceId and workbook resource id to link two resources.

:param source_id: The source Azure resource id
:type source_id: str
:param target_id: The workbook Azure resource id
:type target_id: str
:param category: The category of workbook
:type category: str
"""

_attribute_map = {
'source_id': {'key': 'sourceId', 'type': 'str'},
'target_id': {'key': 'targetId', 'type': 'str'},
'category': {'key': 'category', 'type': 'str'},
}

def __init__(self, source_id=None, target_id=None, category=None):
super(LinkProperties, self).__init__()
self.source_id = source_id
self.target_id = target_id
self.category = category
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# 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 .resource import Resource


class Workbook(Resource):
"""An Application Insights workbook definition.

Variables are only populated by the server, and will be ignored when
sending a request.

:ivar id: Azure resource Id
:vartype id: str
:ivar name: Azure resource name
:vartype name: str
:ivar type: Azure resource type
:vartype type: str
:param location: Resource location
:type location: str
:param tags: Resource tags
:type tags: dict[str, str]
:param kind: The kind of workbook. Choices are user and shared. Possible
values include: 'user', 'shared'
:type kind: str or ~azure.mgmt.applicationinsights.models.SharedTypeKind
:param workbook_name: The user-defined name of the workbook.
:type workbook_name: str
:param serialized_data: Configuration of this particular workbook.
Configuration data is a string containing valid JSON
:type serialized_data: str
:param version: This instance's version of the data model. This can change
as new features are added that can be marked workbook.
:type version: str
:param workbook_id: Internally assigned unique id of the workbook
definition.
:type workbook_id: str
:param shared_type_kind: Enum indicating if this workbook definition is
owned by a specific user or is shared between all users with access to the
Application Insights component. Possible values include: 'user', 'shared'.
Default value: "shared" .
:type shared_type_kind: str or
~azure.mgmt.applicationinsights.models.SharedTypeKind
:ivar time_modified: Date and time in UTC of the last modification that
was made to this workbook definition.
:vartype time_modified: str
:param category: Workbook category, as defined by the user at creation
time.
:type category: str
:param workbook_tags: A list of 0 or more tags that are associated with
this workbook definition
:type workbook_tags: list[str]
:param user_id: Unique user id of the specific user that owns this
workbook.
:type user_id: str
:param source_resource_id: Optional resourceId for a source resource.
:type source_resource_id: str
"""

_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'location': {'required': True},
'workbook_name': {'required': True},
'serialized_data': {'required': True},
'workbook_id': {'required': True},
'shared_type_kind': {'required': True},
'time_modified': {'readonly': True},
'category': {'required': True},
'user_id': {'required': True},
}

_attribute_map = {
'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}'},
'kind': {'key': 'kind', 'type': 'str'},
'workbook_name': {'key': 'properties.name', 'type': 'str'},
'serialized_data': {'key': 'properties.serializedData', 'type': 'str'},
'version': {'key': 'properties.version', 'type': 'str'},
'workbook_id': {'key': 'properties.workbookId', 'type': 'str'},
'shared_type_kind': {'key': 'properties.kind', 'type': 'str'},
'time_modified': {'key': 'properties.timeModified', 'type': 'str'},
'category': {'key': 'properties.category', 'type': 'str'},
'workbook_tags': {'key': 'properties.tags', 'type': '[str]'},
'user_id': {'key': 'properties.userId', 'type': 'str'},
'source_resource_id': {'key': 'properties.sourceResourceId', 'type': 'str'},
}

def __init__(self, location, workbook_name, serialized_data, workbook_id, category, user_id, tags=None, kind=None, version=None, shared_type_kind="shared", workbook_tags=None, source_resource_id=None):
super(Workbook, self).__init__(location=location, tags=tags)
self.kind = kind
self.workbook_name = workbook_name
self.serialized_data = serialized_data
self.version = version
self.workbook_id = workbook_id
self.shared_type_kind = shared_type_kind
self.time_modified = None
self.category = category
self.workbook_tags = workbook_tags
self.user_id = user_id
self.source_resource_id = source_resource_id
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# 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 WorkbookError(Model):
"""Error message body that will indicate why the operation failed.

:param code: Service-defined error code. This code serves as a sub-status
for the HTTP error code specified in the response.
:type code: str
:param message: Human-readable representation of the error.
:type message: str
:param details: The list of invalid fields send in request, in case of
validation error.
:type details:
list[~azure.mgmt.applicationinsights.models.ErrorFieldContract]
"""

_attribute_map = {
'code': {'key': 'code', 'type': 'str'},
'message': {'key': 'message', 'type': 'str'},
'details': {'key': 'details', 'type': '[ErrorFieldContract]'},
}

def __init__(self, code=None, message=None, details=None):
super(WorkbookError, self).__init__()
self.code = code
self.message = message
self.details = details


class WorkbookErrorException(HttpOperationError):
"""Server responsed with exception of type: 'WorkbookError'.

:param deserialize: A deserializer
:param response: Server response to be deserialized.
"""

def __init__(self, deserialize, response, *args):

super(WorkbookErrorException, self).__init__(deserialize, response, 'WorkbookError', *args)
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 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 Workbooks(Model):
"""Workbook list result.

:param value: An array of workbooks.
:type value: list[~azure.mgmt.applicationinsights.models.Workbook]
"""

_attribute_map = {
'value': {'key': 'value', 'type': '[Workbook]'},
}

def __init__(self, value=None):
super(Workbooks, self).__init__()
self.value = value
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
from .favorite_operations import FavoriteOperations
from .web_test_locations_operations import WebTestLocationsOperations
from .web_tests_operations import WebTestsOperations
from .workbooks_operations import WorkbooksOperations
from .workbook_operations import WorkbookOperations

__all__ = [
'Operations',
Expand All @@ -41,4 +43,6 @@
'FavoriteOperations',
'WebTestLocationsOperations',
'WebTestsOperations',
'WorkbooksOperations',
'WorkbookOperations',
]
Loading