Skip to content

Commit

Permalink
CodeGen from PR 13793 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
stable 2020-11-20 workbooktemplates (Azure#13793)

* stable 2020-11-20 workbooktemplates

* ref examples in readme

* fix path

* add swagger 2.0

* fix lintdiff failures

* update name

* Update readme.python.md

* Update readme.md

* Update readme.md

* Update readme.python.md

* Update readme.python.md

* update WorkbookError to WorkbookTemplateError

* Update readme.md

* add templateData examples

* Update specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-11-20/workbookTemplates_API.json

Co-authored-by: kai ru <69238381+kairu-ms@users.noreply.github.com>

* Update specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-11-20/workbookTemplates_API.json

Co-authored-by: kai ru <69238381+kairu-ms@users.noreply.github.com>

* updated errorfiledcontract name

* make prettier

* added templateData samples

* update to only workbooktemplates

* rename package-2020-11-20 to package-2020-11-only

Co-authored-by: kai ru <69238381+kairu-ms@users.noreply.github.com>
  • Loading branch information
SDKAuto and kairu-ms committed May 24, 2021
1 parent bdaea28 commit 8e528de
Show file tree
Hide file tree
Showing 38 changed files with 2,000 additions and 113 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include _meta.json
recursive-include tests *.py *.yaml
include *.md
include azure/__init__.py
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"autorest": "V2",
"use": "@microsoft.azure/autorest.python@~4.0.71",
"commit": "1750698ed191977807052004f6218588bfb5c11f",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest_command": "autorest specification/applicationinsights/resource-manager/readme.md --keep-version-file --multiapi --no-async --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --use=@microsoft.azure/autorest.python@~4.0.71 --version=V2",
"readme": "specification/applicationinsights/resource-manager/readme.md"
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class ApplicationInsightsManagementClient(MultiApiClientMixin, SDKClient):
'ea_subscription_rollback_to_legacy_pricing_model': '2017-10-01',
'export_configurations': '2015-05-01',
'favorites': '2015-05-01',
'operations': '2015-05-01',
'my_workbooks': '2015-05-01',
'proactive_detection_configurations': '2018-05-01-preview',
'queries': '2019-09-01-preview',
'query_packs': '2019-09-01-preview',
Expand Down Expand Up @@ -103,6 +103,7 @@ def models(cls, api_version=DEFAULT_API_VERSION):
* 2019-10-17-preview: :mod:`v2019_10_17_preview.models<azure.mgmt.applicationinsights.v2019_10_17_preview.models>`
* 2020-02-02-preview: :mod:`v2020_02_02_preview.models<azure.mgmt.applicationinsights.v2020_02_02_preview.models>`
* 2020-03-01-preview: :mod:`v2020_03_01_preview.models<azure.mgmt.applicationinsights.v2020_03_01_preview.models>`
* 2020-06-02-preview: :mod:`v2020_06_02_preview.models<azure.mgmt.applicationinsights.v2020_06_02_preview.models>`
"""
if api_version == '2015-05-01':
from .v2015_05_01 import models
Expand All @@ -128,6 +129,9 @@ def models(cls, api_version=DEFAULT_API_VERSION):
elif api_version == '2020-03-01-preview':
from .v2020_03_01_preview import models
return models
elif api_version == '2020-06-02-preview':
from .v2020_06_02_preview import models
return models
raise NotImplementedError("APIVersion {} is not available".format(api_version))

@property
Expand Down Expand Up @@ -331,15 +335,44 @@ def favorites(self):
raise NotImplementedError("APIVersion {} is not available".format(api_version))
return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))

@property
def live_token(self):
"""Instance depends on the API version:
* 2020-06-02-preview: :class:`LiveTokenOperations<azure.mgmt.applicationinsights.v2020_06_02_preview.operations.LiveTokenOperations>`
"""
api_version = self._get_api_version('live_token')
if api_version == '2020-06-02-preview':
from .v2020_06_02_preview.operations import LiveTokenOperations as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))

@property
def my_workbooks(self):
"""Instance depends on the API version:
* 2015-05-01: :class:`MyWorkbooksOperations<azure.mgmt.applicationinsights.v2015_05_01.operations.MyWorkbooksOperations>`
"""
api_version = self._get_api_version('my_workbooks')
if api_version == '2015-05-01':
from .v2015_05_01.operations import MyWorkbooksOperations as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))

@property
def operations(self):
"""Instance depends on the API version:
* 2015-05-01: :class:`Operations<azure.mgmt.applicationinsights.v2015_05_01.operations.Operations>`
* 2020-06-02-preview: :class:`Operations<azure.mgmt.applicationinsights.v2020_06_02_preview.operations.Operations>`
"""
api_version = self._get_api_version('operations')
if api_version == '2015-05-01':
from .v2015_05_01.operations import Operations as OperationClass
elif api_version == '2020-06-02-preview':
from .v2020_06_02_preview.operations import Operations as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from .operations import WebTestsOperations
from .operations import AnalyticsItemsOperations
from .operations import WorkbooksOperations
from .operations import MyWorkbooksOperations
from . import models


Expand Down Expand Up @@ -70,6 +71,8 @@ class ApplicationInsightsManagementClient(SDKClient):
:vartype analytics_items: azure.mgmt.applicationinsights.v2015_05_01.operations.AnalyticsItemsOperations
:ivar workbooks: Workbooks operations
:vartype workbooks: azure.mgmt.applicationinsights.v2015_05_01.operations.WorkbooksOperations
:ivar my_workbooks: MyWorkbooks operations
:vartype my_workbooks: azure.mgmt.applicationinsights.v2015_05_01.operations.MyWorkbooksOperations
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
Expand Down Expand Up @@ -122,3 +125,5 @@ def __init__(
self._client, self.config, self._serialize, self._deserialize)
self.workbooks = WorkbooksOperations(
self._client, self.config, self._serialize, self._deserialize)
self.my_workbooks = MyWorkbooksOperations(
self._client, self.config, self._serialize, self._deserialize)
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
from ._models_py3 import ErrorResponse, ErrorResponseException
from ._models_py3 import InnerError
from ._models_py3 import LinkProperties
from ._models_py3 import MyWorkbook
from ._models_py3 import MyWorkbookError, MyWorkbookErrorException
from ._models_py3 import MyWorkbookResource
from ._models_py3 import Operation
from ._models_py3 import OperationDisplay
from ._models_py3 import PrivateLinkScopedResource
Expand Down Expand Up @@ -83,6 +86,9 @@
from ._models import ErrorResponse, ErrorResponseException
from ._models import InnerError
from ._models import LinkProperties
from ._models import MyWorkbook
from ._models import MyWorkbookError, MyWorkbookErrorException
from ._models import MyWorkbookResource
from ._models import Operation
from ._models import OperationDisplay
from ._models import PrivateLinkScopedResource
Expand All @@ -101,6 +107,7 @@
from ._paged_models import ApplicationInsightsComponentAPIKeyPaged
from ._paged_models import ApplicationInsightsComponentPaged
from ._paged_models import ApplicationInsightsComponentWebTestLocationPaged
from ._paged_models import MyWorkbookPaged
from ._paged_models import OperationPaged
from ._paged_models import WebTestPaged
from ._paged_models import WorkbookPaged
Expand All @@ -109,6 +116,7 @@
ApplicationType,
FlowType,
RequestSource,
IngestionMode,
PurgeState,
FavoriteType,
WebTestKind,
Expand Down Expand Up @@ -151,6 +159,9 @@
'ErrorResponse', 'ErrorResponseException',
'InnerError',
'LinkProperties',
'MyWorkbook',
'MyWorkbookError', 'MyWorkbookErrorException',
'MyWorkbookResource',
'Operation',
'OperationDisplay',
'PrivateLinkScopedResource',
Expand All @@ -173,9 +184,11 @@
'ApplicationInsightsComponentWebTestLocationPaged',
'WebTestPaged',
'WorkbookPaged',
'MyWorkbookPaged',
'ApplicationType',
'FlowType',
'RequestSource',
'IngestionMode',
'PurgeState',
'FavoriteType',
'WebTestKind',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ class RequestSource(str, Enum):
rest = "rest"


class IngestionMode(str, Enum):

application_insights = "ApplicationInsights"
application_insights_with_diagnostic_settings = "ApplicationInsightsWithDiagnosticSettings"
log_analytics = "LogAnalytics"


class PurgeState(str, Enum):

pending = "pending"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,12 @@ class ApplicationInsightsComponent(ComponentsResource):
resources.
:vartype private_link_scoped_resources:
list[~azure.mgmt.applicationinsights.v2015_05_01.models.PrivateLinkScopedResource]
:param ingestion_mode: Indicates the flow of the ingestion. Possible
values include: 'ApplicationInsights',
'ApplicationInsightsWithDiagnosticSettings', 'LogAnalytics'. Default
value: "ApplicationInsights" .
:type ingestion_mode: str or
~azure.mgmt.applicationinsights.v2015_05_01.models.IngestionMode
"""

_validation = {
Expand Down Expand Up @@ -280,6 +286,7 @@ class ApplicationInsightsComponent(ComponentsResource):
'disable_ip_masking': {'key': 'properties.DisableIpMasking', 'type': 'bool'},
'immediate_purge_data_on30_days': {'key': 'properties.ImmediatePurgeDataOn30Days', 'type': 'bool'},
'private_link_scoped_resources': {'key': 'properties.PrivateLinkScopedResources', 'type': '[PrivateLinkScopedResource]'},
'ingestion_mode': {'key': 'properties.IngestionMode', 'type': 'str'},
}

def __init__(self, **kwargs):
Expand All @@ -302,6 +309,7 @@ def __init__(self, **kwargs):
self.disable_ip_masking = kwargs.get('disable_ip_masking', None)
self.immediate_purge_data_on30_days = kwargs.get('immediate_purge_data_on30_days', None)
self.private_link_scoped_resources = None
self.ingestion_mode = kwargs.get('ingestion_mode', "ApplicationInsights")


class ApplicationInsightsComponentAnalyticsItem(Model):
Expand Down Expand Up @@ -1381,6 +1389,162 @@ def __init__(self, **kwargs):
self.category = kwargs.get('category', None)


class MyWorkbookResource(Model):
"""An azure resource object.
:param id: Azure resource Id
:type id: str
:param name: Azure resource name
:type name: str
:param type: Azure resource type
:type type: str
:param location: Resource location
:type location: str
:param tags: Resource tags
:type tags: dict[str, str]
"""

_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}'},
}

def __init__(self, **kwargs):
super(MyWorkbookResource, self).__init__(**kwargs)
self.id = kwargs.get('id', None)
self.name = kwargs.get('name', None)
self.type = kwargs.get('type', None)
self.location = kwargs.get('location', None)
self.tags = kwargs.get('tags', None)


class MyWorkbook(MyWorkbookResource):
"""An Application Insights private workbook 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 id: Azure resource Id
:type id: str
:param name: Azure resource name
:type name: str
:param type: Azure resource type
:type 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.v2015_05_01.models.SharedTypeKind
:param display_name: Required. The user-defined name of the private
workbook.
:type display_name: str
:param serialized_data: Required. Configuration of this particular private
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 private workbook.
:type version: str
:ivar time_modified: Date and time in UTC of the last modification that
was made to this private workbook definition.
:vartype time_modified: str
:param category: Required. Workbook category, as defined by the user at
creation time.
:type category: str
:param my_workbook_tags: A list of 0 or more tags that are associated with
this private workbook definition
:type my_workbook_tags: list[str]
:ivar user_id: Unique user id of the specific user that owns this private
workbook.
:vartype user_id: str
:param source_id: Optional resourceId for a source resource.
:type source_id: str
"""

_validation = {
'display_name': {'required': True},
'serialized_data': {'required': True},
'time_modified': {'readonly': True},
'category': {'required': True},
'user_id': {'readonly': 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'},
'display_name': {'key': 'properties.displayName', 'type': 'str'},
'serialized_data': {'key': 'properties.serializedData', 'type': 'str'},
'version': {'key': 'properties.version', 'type': 'str'},
'time_modified': {'key': 'properties.timeModified', 'type': 'str'},
'category': {'key': 'properties.category', 'type': 'str'},
'my_workbook_tags': {'key': 'properties.tags', 'type': '[str]'},
'user_id': {'key': 'properties.userId', 'type': 'str'},
'source_id': {'key': 'properties.sourceId', 'type': 'str'},
}

def __init__(self, **kwargs):
super(MyWorkbook, self).__init__(**kwargs)
self.kind = kwargs.get('kind', None)
self.display_name = kwargs.get('display_name', None)
self.serialized_data = kwargs.get('serialized_data', None)
self.version = kwargs.get('version', None)
self.time_modified = None
self.category = kwargs.get('category', None)
self.my_workbook_tags = kwargs.get('my_workbook_tags', None)
self.user_id = None
self.source_id = kwargs.get('source_id', None)


class MyWorkbookError(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.v2015_05_01.models.ErrorFieldContract]
"""

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

def __init__(self, **kwargs):
super(MyWorkbookError, self).__init__(**kwargs)
self.code = kwargs.get('code', None)
self.message = kwargs.get('message', None)
self.details = kwargs.get('details', None)


class MyWorkbookErrorException(HttpOperationError):
"""Server responsed with exception of type: 'MyWorkbookError'.
:param deserialize: A deserializer
:param response: Server response to be deserialized.
"""

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

super(MyWorkbookErrorException, self).__init__(deserialize, response, 'MyWorkbookError', *args)


class Operation(Model):
"""CDN REST API operation.
Expand Down
Loading

0 comments on commit 8e528de

Please sign in to comment.